lb-phone image upload
Uses lb-phone's Custom upload method with one-time links: your server asks for a link with the key, the phone uploads to it, and the key never reaches players.
- Uploads
- Images, video and audio
- Sent by
- The player's game, to a one-time link
- Key goes in
- lb-phone/server/apiKeys.lua
- Calls
- /api/v3/file/presigned-url
- Steps
- 4
Watch for
- Keep the domains already listed in both whitelists, and add fxvault.link to each.
- Already run lb-presigned? It works through S3 with an S3 key and LB Phone 2.5.5 or newer, but the Custom method needs no S3 key and is the simpler choice.
Format checked against lbphone/files: lb-phone/config/config.lua, lbphone/files: lb-phone/shared/upload.lua, lbphone/files: lb-phone/server/custom/functions/functions.lua and lbphone/files: lb-phone/server/apiKeys.lua.
Step 1: lb-phone/config/config.lua
Send uploads through the Custom method, and let the phone show files from fxvault.link. Keep the other entries already in each list.
Config.UploadMethod.Video = "Custom" Config.UploadMethod.Image = "Custom" Config.UploadMethod.Audio = "Custom" Config.UploadWhitelistedDomains = { "fxvault.link", } Config.ExternalWhitelistedDomains = { "fxvault.link", }Step 2: lb-phone/server/apiKeys.lua
The key stays on your server; lb-phone passes it to GetPresignedUrl.
API_KEYS = { Video = "YOUR_API_KEY", Image = "YOUR_API_KEY", Audio = "YOUR_API_KEY", }Step 3: lb-phone/shared/upload.lua
Replace the whole Custom entry inside UploadMethods with this one. It has the same shape as the Fivemanage entry below it.
Custom = { Default = { url = "PRESIGNED_URL", field = "file", success = { path = "data.url" }, sendPlayer = "metadata" }, },Step 4: lb-phone/server/custom/functions/functions.lua
In GetPresignedUrl, add this branch after the Qbox one, just before the final "end". It asks for a one-time upload link with your key.
elseif uploadMethod == "Custom" then return Citizen.Await(promise.new(function(p) PerformHttpRequest("https://api.fxvault.link/api/v3/file/presigned-url", function(status, body) if status ~= 200 then p:resolve() infoprint("error", "Could not get an upload link from fxvault Media (" .. tostring(status) .. ")") return end local data = json.decode(body) p:resolve(data?.data?.presignedUrl) end, "GET", nil, { Accept = "application/json", Authorization = apiKey }) end))