refactor: move media settings into dedicated config

This commit is contained in:
Leon.Schmidt
2026-08-17 02:13:07 +02:00
parent 3e35a12efd
commit 7d770b838a
5 changed files with 89 additions and 77 deletions
+7 -6
View File
@@ -67,7 +67,7 @@ Start the selected voice resource before Sky Phone.
1. Copy the resource into your FiveM resources directory.
2. Keep the resource folder name `sky_phone`.
3. Start `oxmysql`, your framework, inventory, and voice resource before Sky Phone.
4. Open `sky_phone/config/config.lua` and review the configuration.
4. Review `sky_phone/config/config.lua` and `sky_phone/config/media.lua`.
5. Add the required inventory items.
6. Add `ensure sky_phone` to `server.cfg`.
7. Restart the server and watch the console for warnings.
@@ -88,13 +88,14 @@ Sky Phone creates and upgrades its database tables automatically. A manual SQL i
## Configuration
All customer settings are organized in:
Customer settings are organized in:
```text
sky_phone/config/config.lua
sky_phone/config/media.lua
```
The file contains clearly separated sections for:
The files contain clearly separated sections for:
| Section | Purpose |
| --- | --- |
@@ -107,7 +108,7 @@ The file contains clearly separated sections for:
| App sections | Limits and behavior for every built-in app |
| `Config.Server` | Stable password and passcode peppers |
| `Config.Companies` | Company directory, jobs, services, and permissions |
| `Config.Media` | FiveManage, GIPHY, uploads, and Gallery imports |
| `Config.Media` (`config/media.lua`) | FiveManage, GIPHY, uploads, and Gallery imports |
| `Config.Music` | Server music library and playlist limits |
| `Config.Migrations` | Manual LB Phone migration domains |
| `Config.WeazelNews` | Editorial jobs, categories, and article limits |
@@ -257,7 +258,7 @@ A Sky Cloud account is optional. Devices without an account retain local setting
## Media and uploads
Configure FiveManage in the server-only media section:
Configure FiveManage in the server-only `sky_phone/config/media.lua` file:
```lua
Config.Media.FiveManage.ApiKey = "your-fivemanage-v3-media-token"
@@ -454,7 +455,7 @@ See [Custom App Integration](docs/custom-apps.md) for setup details and compatib
Before updating:
1. Back up the database.
2. Back up `config/config.lua` and any custom media.
2. Back up `config/config.lua`, `config/media.lua`, and any custom media.
3. Keep the three pepper values unchanged.
4. Replace the resource files.
5. Reapply customer-specific configuration carefully.
+2 -70
View File
@@ -1,7 +1,8 @@
--[[
Sky Phone configuration
All settings live in this file. Translations remain in config/locales/*.lua.
General settings live in this file. Media providers and upload limits live
in config/media.lua, while translations remain in config/locales/*.lua.
Sections marked "SERVER ONLY" are guarded with IsDuplicityVersion(), so
passwords, API keys, migration settings, and server-owned locations are not
applied by game clients.
@@ -1165,75 +1166,6 @@ if IsDuplicityVersion() then
},
}
-- -------------------------------------------------------------------------
-- Media providers and uploads
-- -------------------------------------------------------------------------
Config.Media = {
GiphyApiKey = "", -- Server-only: paste the GIPHY API key here.
GifPageSize = 24,
GifRating = "pg-13",
UrlMaxLength = 2048,
AllowedGifHosts = { "giphy.com" },
FiveManage = {
ApiKey = "", -- Server-only: paste a newly generated FiveManage V3 Media API token here.
BaseUrl = "https://api.fivemanage.com/api/v3/file",
RequestTimeoutMs = 10000,
UploadTimeoutMs = 25000,
},
Import = {
Enabled = true,
PageSize = 30,
MaxSelection = 10,
MaxPhotoBytes = 15 * 1024 * 1024,
MaxVideoBytes = 150 * 1024 * 1024,
RevalidateAfterSeconds = 3600,
ListActionsPerMinute = 60,
ImportActionsPerMinute = 20,
CandidateTtlSeconds = 300,
ManifestCacheSeconds = 30,
ManifestMaxBytes = 2 * 1024 * 1024,
ManifestMaxItems = 5000,
Websites = {
{
Id = "fivemanage",
Label = "FiveManage",
Enabled = true,
Adapter = "fivemanage",
Path = "sky_phone/imports",
MediaTypes = { "photo", "video" },
-- Direct links entered in Gallery must use one of these hosts or a subdomain.
AllowedMediaHosts = { "fivemanage.com" },
},
--[[
{
Id = "city_media",
Label = "City Media",
Enabled = true,
Adapter = "manifest",
ManifestUrl = "https://media.example.com/sky-phone/media.json",
MediaTypes = { "photo", "video" },
AllowedMediaHosts = { "media.example.com", "cdn.example.com" },
Auth = {
Type = "bearer",
TokenConvar = "sky_phone_city_media_token",
},
RequiredAce = "sky_phone.import.city_media",
},
]]
},
},
Photo = {
Encoding = "jpg",
Quality = 0.95,
},
Video = {
BitrateKbps = 1500,
},
UploadSessionTimeoutMs = 60000,
PageSize = 30,
}
-- -------------------------------------------------------------------------
-- Music library
-- -------------------------------------------------------------------------
+78
View File
@@ -0,0 +1,78 @@
--[[
Sky Phone media configuration
This file is loaded on the server only. Keep API keys private and restart
sky_phone after changing providers, upload limits, or import sources.
]]
Config.Media = {
GiphyApiKey = "", -- Paste the GIPHY API key here.
GifPageSize = 24,
GifRating = "pg-13",
UrlMaxLength = 2048,
AllowedGifHosts = { "giphy.com" },
FiveManage = {
ApiKey = "", -- Paste a newly generated FiveManage V3 Media API token here.
BaseUrl = "https://api.fivemanage.com/api/v3/file",
RequestTimeoutMs = 10000,
UploadTimeoutMs = 25000,
},
Import = {
Enabled = true,
PageSize = 30,
MaxSelection = 10,
MaxPhotoBytes = 15 * 1024 * 1024,
MaxVideoBytes = 150 * 1024 * 1024,
RevalidateAfterSeconds = 3600,
ListActionsPerMinute = 60,
ImportActionsPerMinute = 20,
CandidateTtlSeconds = 300,
ManifestCacheSeconds = 30,
ManifestMaxBytes = 2 * 1024 * 1024,
ManifestMaxItems = 5000,
Websites = {
{
Id = "fivemanage",
Label = "FiveManage",
Enabled = true,
Adapter = "fivemanage",
Path = "sky_phone/imports",
MediaTypes = { "photo", "video" },
-- Direct Gallery links must use one of these hosts or a subdomain.
AllowedMediaHosts = { "fivemanage.com" },
},
--[[
{
Id = "city_media",
Label = "City Media",
Enabled = true,
Adapter = "manifest",
ManifestUrl = "https://media.example.com/sky-phone/media.json",
MediaTypes = { "photo", "video" },
AllowedMediaHosts = { "media.example.com", "cdn.example.com" },
Auth = {
Type = "bearer",
TokenConvar = "sky_phone_city_media_token",
},
RequiredAce = "sky_phone.import.city_media",
},
]]
},
},
Photo = {
Encoding = "jpg",
Quality = 0.95,
},
Video = {
BitrateKbps = 1500,
},
UploadSessionTimeoutMs = 60000,
PageSize = 30,
}
+1
View File
@@ -50,6 +50,7 @@ client_scripts {
server_scripts {
'@oxmysql/lib/MySQL.lua',
'config/config.lua',
'config/media.lua',
'config/locales/en.lua',
'config/locales/de.lua',
'source/bridge/server/database.lua',
+1 -1
View File
@@ -972,7 +972,7 @@ end)
if not api_configured() then
Bridge.Debug(
"warn",
"[sky_phone] Camera uploads and FiveManage imports are disabled until Config.Media.FiveManage.ApiKey is set in config/config.lua."
"[sky_phone] Camera uploads and FiveManage imports are disabled until Config.Media.FiveManage.ApiKey is set in config/media.lua."
)
end
end)