mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 08:13:23 +00:00
feat: add LB migration and reorganize configuration
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user