mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:08:59 +00:00
734f4651cb
Co-authored-by: DerEchteAlec <alec.schitzkat@luwan.io>
27 lines
908 B
Lua
27 lines
908 B
Lua
local resource_name = "sn_properties"
|
|
|
|
Bridge.Housing.RegisterClientProvider("sn", {
|
|
execute = function(action, data)
|
|
if action ~= "grant_key" and action ~= "revoke_key" then
|
|
return false, "capability_unavailable"
|
|
end
|
|
if GetResourceState(resource_name) ~= "started" then
|
|
return false, "provider_unavailable"
|
|
end
|
|
if type(data) ~= "table" then
|
|
return false, "invalid_request"
|
|
end
|
|
|
|
local result = Bridge.Callbacks.Trigger("sky_phone:housing:sn:execute", {
|
|
action = action,
|
|
propertyId = data.propertyId,
|
|
providerId = data.providerId,
|
|
identifier = data.identifier,
|
|
})
|
|
if type(result) == "table" and result.success then
|
|
return true
|
|
end
|
|
return false, type(result) == "table" and result.error or "provider_rejected"
|
|
end,
|
|
})
|