mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-08-29 01:08:59 +00:00
CLN - remove notification debug command
This commit is contained in:
@@ -19,11 +19,6 @@ Config.Phone = {
|
||||
DeviceName = "iFruit Phone",
|
||||
}
|
||||
|
||||
Config.NotificationTest = {
|
||||
Command = "phonenotifytest",
|
||||
AdminGroups = { "admin" },
|
||||
}
|
||||
|
||||
Config.Security = {
|
||||
PasscodePepperConvar = "sky_phone_passcode_pepper",
|
||||
MaximumAttempts = 5,
|
||||
|
||||
@@ -53,7 +53,6 @@ server_scripts {
|
||||
'source/bridge/server/inventory/*.lua',
|
||||
'source/server/db_migrate.lua',
|
||||
'source/server/phone.lua',
|
||||
'source/server/debug.lua',
|
||||
'source/server/sim.lua',
|
||||
'source/server/calls.lua',
|
||||
'source/server/media.lua',
|
||||
|
||||
@@ -617,10 +617,6 @@ RegisterNetEvent("sky_phone:billing:new", function(data)
|
||||
SendNUIMessage({ type = "billing:new", data = data })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("sky_phone:notification:test", function(data)
|
||||
SendNUIMessage({ type = "notification:show", data = data })
|
||||
end)
|
||||
|
||||
RegisterNetEvent("sky_phone:messages:changed", function(data)
|
||||
SendNUIMessage({ type = "messages:changed", data = data })
|
||||
end)
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
Bridge.Database.AfterMigration("sky_phone", function()
|
||||
RegisterCommand(Config.NotificationTest.Command, function(source)
|
||||
if source == 0 then
|
||||
print(("[sky_phone] /%s must be used by an in-game admin."):format(Config.NotificationTest.Command))
|
||||
return
|
||||
end
|
||||
|
||||
if not Bridge.Framework.HasAdminGroup(source, Config.NotificationTest.AdminGroups) then
|
||||
Bridge.Debug(
|
||||
"warn",
|
||||
"[sky_phone] Source %s attempted to use the notification test command without an admin group.",
|
||||
tostring(source)
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
local slots = Bridge.Inventory.GetSlotsWithItem(source, Config.Phone.Item)
|
||||
local slot = slots[1]
|
||||
if not slot then
|
||||
Bridge.Debug(
|
||||
"warn",
|
||||
"[sky_phone] Notification test failed because source %s has no phone item.",
|
||||
tostring(source)
|
||||
)
|
||||
TriggerClientEvent("sky_phone:device:error", source, "phone_slot_missing")
|
||||
return
|
||||
end
|
||||
|
||||
local imei, device_error = SkyPhone.EnsureDevice(source, slot)
|
||||
if not imei then
|
||||
Bridge.Debug(
|
||||
"warn",
|
||||
"[sky_phone] Notification test could not resolve a device for source %s: %s.",
|
||||
tostring(source),
|
||||
tostring(device_error)
|
||||
)
|
||||
TriggerClientEvent("sky_phone:device:error", source, device_error or "request_failed")
|
||||
return
|
||||
end
|
||||
|
||||
local device = SkyPhone.LoadDevice(imei)
|
||||
if not device then
|
||||
Bridge.Debug(
|
||||
"error",
|
||||
"[sky_phone] Notification test could not load device %s for source %s.",
|
||||
imei,
|
||||
tostring(source)
|
||||
)
|
||||
TriggerClientEvent("sky_phone:device:error", source, "request_failed")
|
||||
return
|
||||
end
|
||||
|
||||
local settings = Bridge.Database.Query([[
|
||||
SELECT `payload`
|
||||
FROM `sky_phone_device_data`
|
||||
WHERE `device_imei` = ? AND `namespace` = 'settings'
|
||||
LIMIT 1
|
||||
]], { imei })[1]
|
||||
|
||||
TriggerClientEvent("sky_phone:notification:test", source, {
|
||||
appId = "messages",
|
||||
title = "Notification Test",
|
||||
text = "This is a test notification.",
|
||||
device = {
|
||||
imei = imei,
|
||||
name = device.device_name,
|
||||
settings = settings and settings.payload or nil,
|
||||
},
|
||||
})
|
||||
|
||||
Bridge.Debug(
|
||||
"info",
|
||||
"[sky_phone] Sent a test notification to source %s on device %s.",
|
||||
tostring(source),
|
||||
imei
|
||||
)
|
||||
end, false)
|
||||
end)
|
||||
Reference in New Issue
Block a user