Skip to main content
Use FiveMesh CDN with LB-Phone or LB-Tablet by configuring a custom upload method. Use presigned uploads so the script can upload phone or tablet media without exposing your FiveMesh API key to clients.
If you use both LB-Phone and LB-Tablet, give each script its own CDN path prefix such as /phone and /tablet. You can restrict Developer API Keys to those prefixes from the FiveMesh dashboard.

Prerequisites

Before you begin, confirm:
  • FiveMesh CDN is set up for the active workspace.
  • You have either a Server API Key or a Developer API Key with cdn:write permission.
  • If you use a Developer API Key with path restrictions, its allowed prefixes cover the paths the script should manage.
  • You can edit the LB-Phone or LB-Tablet server files.
Both LB-Phone and LB-Tablet support Server API Keys (fm_server_...) and Developer API Keys (fm_live_...). Use a Developer API Key with cdn:write and allowed prefixes such as phone or tablet when you need path isolation. A Server API Key includes CDN write access, but its server binding does not restrict CDN paths. See API keys for how to generate either type. The presigned endpoint is https://api.fivemesh.io/v1/presigned-url. The public workspace slug comes from your CDN settings; you do not pass it in this request.
Do not configure direct uploads with a permanent API key in client-visible files. Keep the API key in server-side LB-Scripts files and return presigned upload URLs to the client.

LB-Phone configuration

To use presigned uploads with LB-Phone, update the server and upload configuration.
1

Configure server credentials

Open lb-phone/server/apiKeys.lua and configure the API keys and target path prefixes.Each API_KEYS value accepts either a Server API Key or a Developer API Key with cdn:write. You can use the same key for all three media types.
2

Request a presigned upload URL

Update lb-phone/server/custom/functions/functions.lua to implement GetPresignedUrl.
3

Use presigned URLs in upload settings

In lb-phone/shared/upload.lua, set url to "PRESIGNED_URL" for custom methods. Set each media type in Config.UploadMethod to "Custom" in your phone configuration.
4

Return the custom method

Confirm CustomGetUploadMethod exists in lb-phone/client/custom/functions/functions.lua.

LB-Tablet configuration

LB-Tablet uses the same presigned upload pattern.
1

Configure server credentials

Open lb-tablet/server/apiKeys.lua and add the same API_KEYS and UPLOAD_PATHS values. Either key type works here too.
2

Request a presigned upload URL

Update lb-tablet/server/custom/functions/functions.lua with the same GetPresignedUrl function used for LB-Phone.
3

Use presigned URLs in upload settings

In lb-tablet/config/upload.lua, set url = "PRESIGNED_URL" for each custom media type. Set the corresponding Config.UploadMethod entries to "Custom".
4

Return the custom method

Confirm CustomGetUploadMethod is implemented in lb-tablet/client/custom/functions/functions.lua.

Verify uploads

Restart the affected LB resource after changing its configuration. Upload an image, video and audio clip, then check each public URL and the intended CDN folder. LB versions can change custom hook locations. Check your installed resource and the official LB-Phone installation guide or LB-Tablet installation guide before replacing a hook. Preserve other customizations when updating.

Troubleshooting

GetPresignedUrl prints the HTTP status to the server console when FiveMesh does not return an upload URL. If the upload URL is created but media does not appear, confirm each media type in Config.UploadMethod is set to "Custom" and that FiveMesh CDN setup has finished provisioning. Check the intended folder in the object browser.