feat: add LB migration and reorganize configuration

This commit is contained in:
Leon.Schmidt
2026-08-17 02:08:31 +02:00
parent d9ada55ebc
commit 3e35a12efd
24 changed files with 5603 additions and 956 deletions
+22 -22
View File
@@ -11,10 +11,10 @@ local function get_calling_resource(export_name)
return owner_resource
end
print(("[%s] %s rejected: the export must be called by another resource."):format(
Bridge.Debug("warn", "[%s] %s rejected: the export must be called by another resource.",
RESOURCE_NAME,
export_name
))
)
return nil, "invalid_owner"
end
@@ -96,12 +96,12 @@ function SkyPhoneApps.RegisterCompatibilityExport(owner_resource, app_data)
end
if not definition then
print(("[%s] %s registration rejected for %s: %s."):format(
Bridge.Debug("warn", "[%s] %s registration rejected for %s: %s.",
RESOURCE_NAME,
provider,
owner_resource,
definition_error
))
)
return false, definition_error
end
return register_provider_app(provider, owner_resource, definition, copy_record_data(app_data))
@@ -122,11 +122,11 @@ local function add_17mov_application(app_data)
local definition, definition_error = SkyPhoneCompatibility.Build17MovDefinition(app_data)
if not definition then
print(("[%s] 17mov registration rejected for %s: %s."):format(
Bridge.Debug("warn", "[%s] 17mov registration rejected for %s: %s.",
RESOURCE_NAME,
owner_resource,
definition_error
))
)
return false, definition_error
end
return register_provider_app(
@@ -178,11 +178,11 @@ local function add_high_application(app_name, data, locales)
locales
)
if not definition then
print(("[%s] High Phone registration rejected for %s: %s."):format(
Bridge.Debug("warn", "[%s] High Phone registration rejected for %s: %s.",
RESOURCE_NAME,
owner_resource,
definition_error
))
)
return false, definition_error
end
@@ -227,11 +227,11 @@ end
local function add_quasar_app_for_owner(owner_resource, app_data)
local definition, definition_error = SkyPhoneCompatibility.BuildQuasarDefinition(app_data)
if not definition then
print(("[%s] Quasar registration rejected for %s: %s."):format(
Bridge.Debug("warn", "[%s] Quasar registration rejected for %s: %s.",
RESOURCE_NAME,
owner_resource,
definition_error
))
)
return false, definition_error
end
@@ -465,7 +465,7 @@ local function register_high_server_app(owner_resource, definition, revision)
or revision ~= math.floor(revision)
or revision < 1
then
print(("[%s] Rejected invalid High Phone server application snapshot."):format(RESOURCE_NAME))
Bridge.Debug("warn", "[%s] Rejected invalid High Phone server application snapshot.", RESOURCE_NAME)
return nil
end
@@ -476,10 +476,10 @@ local function register_high_server_app(owner_resource, definition, revision)
return app_id
end
if existing.owner_resource ~= owner_resource then
print(("[%s] Rejected conflicting High Phone owner for %s."):format(
Bridge.Debug("warn", "[%s] Rejected conflicting High Phone owner for %s.",
RESOURCE_NAME,
app_id
))
)
return app_id
end
end
@@ -512,12 +512,12 @@ local function register_high_server_app(owner_resource, definition, revision)
provider = providers.high,
}
elseif not existing or existing.revision ~= revision or existing.last_error ~= error_message then
print(("[%s] Could not register High Phone server application %s revision %s: %s."):format(
Bridge.Debug("error", "[%s] Could not register High Phone server application %s revision %s: %s.",
RESOURCE_NAME,
app_id,
revision,
error_message or "unknown_error"
))
)
end
return app_id
end
@@ -542,18 +542,18 @@ local function remove_high_server_app(owner_resource, app_id)
nil
)
if not success then
print(("[%s] Could not restore High Phone client application %s: %s."):format(
Bridge.Debug("error", "[%s] Could not restore High Phone client application %s: %s.",
RESOURCE_NAME,
app_id,
error_message or "unknown_error"
))
)
end
end
end
RegisterNetEvent("sky_phone:compat:high:client:syncApplication", function(owner_resource, definition, revision)
if source ~= 65535 then
print(("[%s] Rejected locally invoked High Phone application sync."):format(RESOURCE_NAME))
Bridge.Debug("warn", "[%s] Rejected locally invoked High Phone application sync.", RESOURCE_NAME)
return
end
register_high_server_app(owner_resource, definition, revision)
@@ -561,11 +561,11 @@ end)
RegisterNetEvent("sky_phone:compat:high:client:removeApplication", function(owner_resource, app_id)
if source ~= 65535 then
print(("[%s] Rejected locally invoked High Phone application removal."):format(RESOURCE_NAME))
Bridge.Debug("warn", "[%s] Rejected locally invoked High Phone application removal.", RESOURCE_NAME)
return
end
if type(owner_resource) ~= "string" or type(app_id) ~= "string" then
print(("[%s] Rejected invalid High Phone application removal."):format(RESOURCE_NAME))
Bridge.Debug("warn", "[%s] Rejected invalid High Phone application removal.", RESOURCE_NAME)
return
end
remove_high_server_app(owner_resource, app_id)
@@ -573,11 +573,11 @@ end)
RegisterNetEvent("sky_phone:compat:high:client:replaceSnapshot", function(snapshot)
if source ~= 65535 then
print(("[%s] Rejected locally invoked High Phone application snapshot."):format(RESOURCE_NAME))
Bridge.Debug("warn", "[%s] Rejected locally invoked High Phone application snapshot.", RESOURCE_NAME)
return
end
if type(snapshot) ~= "table" then
print(("[%s] Rejected invalid High Phone application snapshot."):format(RESOURCE_NAME))
Bridge.Debug("warn", "[%s] Rejected invalid High Phone application snapshot.", RESOURCE_NAME)
return
end
+16 -8
View File
@@ -382,9 +382,13 @@ local function normalize_external_definition(owner_resource, adapter_resource, d
if definition.compatibility == nil then
return nil, icon_error
end
print((
"[sky_phone] Custom app '%s' from '%s' uses an unavailable icon (%s); using the default icon."
):format(definition.id, owner_resource, icon_error))
Bridge.Debug(
"warn",
"[sky_phone] Custom app '%s' from '%s' uses an unavailable icon (%s); using the default icon.",
definition.id,
owner_resource,
icon_error
)
end
local permissions, permissions_error = SkyPhoneApps.ValidatePermissions(definition.permissions)
@@ -574,9 +578,13 @@ local function register_app(app)
local app_id = app.catalog.id
local existing = apps_by_id[app_id]
if existing then
print((
"[sky_phone] Rejected duplicate custom app '%s' from '%s'; it is already owned by '%s'."
):format(app_id, app.ownerResource, existing.ownerResource))
Bridge.Debug(
"warn",
"[sky_phone] Rejected duplicate custom app '%s' from '%s'; it is already owned by '%s'.",
app_id,
app.ownerResource,
existing.ownerResource
)
return false, "duplicate_app_id"
end
@@ -602,11 +610,11 @@ local function invoke_hook(app, hook_name, payload)
return true
end
print(("[sky_phone] Custom app '%s' hook '%s' failed: %s"):format(
Bridge.Debug("error", "[sky_phone] Custom app '%s' hook '%s' failed: %s",
app.catalog.id,
hook_name,
tostring(hook_error)
))
)
return false
end