mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 16:23:22 +00:00
ADD - add in-game phone administration and configuration (#21)
* ADD - build in-game admin command center * ADD - open admin panel by command * ENH - rebuild admin panel as standalone editor * ENH - compact admin workspace navigation * ENH - expand admin device controls * ENH - refine admin panel navigation style * ADD - add SQL phone configurator * FIX - expose complete phone configuration * FIX - make company jobs freely configurable * FIX - align configurator tables to left * ENH - organize configurator collection controls * ENH - organize nested configurator sections * ENH - add configurator field descriptions * FIX - hide fixed configurator add controls * ENH - refine configurator editing experience * ENH - refine admin configurator controls * FIX - apply configurator settings instantly * FIX - close live activity command registration
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
Bridge.Database.AfterMigration("sky_phone", function()
|
||||
local STORAGE_JSON_MAX_DEPTH = 8
|
||||
local STORAGE_JSON_MAX_NODES = 512
|
||||
local STORAGE_KEY_MAX_LENGTH = math.min(Config.CustomApps.MaximumStorageKeyLength, 64)
|
||||
local STORAGE_VALUE_MAX_BYTES = math.min(Config.CustomApps.MaximumStorageValueBytes, 65536)
|
||||
local storage_write_locks = {}
|
||||
|
||||
local function affected_rows(result)
|
||||
@@ -27,7 +25,7 @@ local function validate_storage_json(value, depth, state)
|
||||
return value == value and value ~= math.huge and value ~= -math.huge
|
||||
end
|
||||
if value_type == "string" then
|
||||
return #value <= STORAGE_VALUE_MAX_BYTES
|
||||
return #value <= math.min(Config.CustomApps.MaximumStorageValueBytes, 65536)
|
||||
end
|
||||
if value_type ~= "table" or state.seen[value] then
|
||||
return false
|
||||
@@ -120,7 +118,7 @@ local function validate_request(source, data, operation)
|
||||
end
|
||||
if type(data.key) ~= "string"
|
||||
or #data.key == 0
|
||||
or #data.key > STORAGE_KEY_MAX_LENGTH
|
||||
or #data.key > math.min(Config.CustomApps.MaximumStorageKeyLength, 64)
|
||||
or not data.key:match("^[%w._-]+$")
|
||||
then
|
||||
return nil, nil, { success = false, error = "invalid_storage_key" }
|
||||
@@ -205,7 +203,7 @@ Bridge.Callbacks.Register("sky_phone:custom-app:storage:set", function(source, d
|
||||
local encoded, payload = pcall(json.encode, request.value)
|
||||
if not encoded
|
||||
or type(payload) ~= "string"
|
||||
or #payload > STORAGE_VALUE_MAX_BYTES
|
||||
or #payload > math.min(Config.CustomApps.MaximumStorageValueBytes, 65536)
|
||||
then
|
||||
return { success = false, error = "storage_value_too_large" }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user