mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:08:59 +00:00
FIX - harden inventory contracts and resolve phone interaction issues (#20)
* FIX - repair inventory metadata and ESX contracts Use the stable core_inventory metadata setter and validate the complete inventory adapter contract after provider bridges load. Preserve the real ESX configuration error instead of cascading into a missing RegisterUsableItem failure. * FIX - clarify phone opening without SIM * FIX - harden inventory and device contracts Validate SIM number configuration before item handling, preserve QB metadata mutation contracts, and propagate phone-open failures to callers. Extend regression coverage for inventory bridges and device bootstrap errors. * FIX - resolve reported phone interaction issues Stop game-input passthrough while NUI text fields are focused and add an independent hold-to-look option. Propagate SIM number formatting to the frontend, migrate configured currency symbols to utf8mb4, and clarify SkyRide, VaultX, and DarkChat behavior with focused contract coverage. * FIX - detect missing packaged phone UI Validate the generated NUI entrypoint, its referenced assets, and required static media when the resource starts. Print an actionable server-console warning for incomplete source archives, package phone sounds through the manifest, and cover the detection contract with Lua regressions.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
local source_path = "sky_phone/source/server/nui_build_check.lua"
|
||||
local original_print = print
|
||||
|
||||
local function run_check(files)
|
||||
local output = {}
|
||||
|
||||
print = function(message)
|
||||
output[#output + 1] = tostring(message)
|
||||
end
|
||||
GetCurrentResourceName = function()
|
||||
return "sky_phone"
|
||||
end
|
||||
LoadResourceFile = function(resource_name, path)
|
||||
assert(resource_name == "sky_phone", "NUI build check must inspect its own resource")
|
||||
return files[path]
|
||||
end
|
||||
|
||||
dofile(source_path)
|
||||
return table.concat(output, "\n")
|
||||
end
|
||||
|
||||
local valid_files = {
|
||||
["source/html/index.html"] = [[
|
||||
<link rel="stylesheet" href="./assets/sky-index.css">
|
||||
<script type="module" src="./assets/sky-index.js"></script>
|
||||
]],
|
||||
["source/html/assets/sky-index.css"] = "body{}",
|
||||
["source/html/assets/sky-index.js"] = "console.log('ready')",
|
||||
["source/html/img/custom-app.svg"] = "<svg></svg>",
|
||||
["source/html/sounds/button.mp3"] = "audio",
|
||||
}
|
||||
|
||||
assert(run_check(valid_files) == "", "a complete NUI build must not print a warning")
|
||||
|
||||
local missing_build_output = run_check({})
|
||||
assert(missing_build_output:find("SKY PHONE UI BUILD IS MISSING OR INCOMPLETE", 1, true))
|
||||
assert(missing_build_output:find("source/html/index.html", 1, true))
|
||||
assert(missing_build_output:find("source/html/assets/*", 1, true))
|
||||
assert(missing_build_output:find("source/html/img/custom-app.svg", 1, true))
|
||||
assert(missing_build_output:find("source/html/sounds/button.mp3", 1, true))
|
||||
assert(missing_build_output:find("not GitHub's automatic source archive", 1, true))
|
||||
assert(missing_build_output:find("build_frontend.bat", 1, true))
|
||||
|
||||
local missing_asset_files = {}
|
||||
for path, content in pairs(valid_files) do
|
||||
missing_asset_files[path] = content
|
||||
end
|
||||
missing_asset_files["source/html/assets/sky-index.js"] = nil
|
||||
|
||||
local missing_asset_output = run_check(missing_asset_files)
|
||||
assert(missing_asset_output:find("source/html/assets/sky-index.js", 1, true))
|
||||
assert(not missing_asset_output:find("source/html/assets/sky-index.css", 1, true))
|
||||
|
||||
local query_asset_files = {}
|
||||
for path, content in pairs(valid_files) do
|
||||
query_asset_files[path] = content
|
||||
end
|
||||
query_asset_files["source/html/index.html"] = [[
|
||||
<script type="module" src="./assets/sky-index.js?v=1#entry"></script>
|
||||
]]
|
||||
assert(run_check(query_asset_files) == "", "asset query strings and fragments must be ignored")
|
||||
|
||||
print = original_print
|
||||
io.write("Sky Phone NUI build check tests passed\n")
|
||||
Reference in New Issue
Block a user