structura foldere

mutat kq- folders in un singur folder [kq]
This commit is contained in:
2026-03-30 01:55:03 +03:00
parent af1286d583
commit c291b81f26
2319 changed files with 0 additions and 14 deletions

View File

@@ -0,0 +1,35 @@
local securedFileTypes = {
'image',
'audio',
'video'
}
---@param source number
---@param fileType string
---@return string
lib.callback.register('phone:getPresignedUrl', function(source, fileType)
if Config.Webhook == '' then
Error('Webhook is empty, please set a webhook in the server/custom/webhooks/webhooks.lua file. Or you are not be able to use the voice recorder, camera, and video recorder.')
return ''
end
if not table.includes(securedFileTypes, fileType) then
Error('Invalid file type', fileType, 'source', source)
return ''
end
local url = ('https://fmapi.net/api/v2/presigned-url?fileType=%s'):format(fileType)
local promise = promise.new()
PerformHttpRequest(url, function(err, text, headers)
local data = json.decode(text)
if not data then
return promise:resolve('')
end
if data.status ~= 'ok' then
Error('Failed to get presigned url', data)
return promise:resolve('')
end
promise:resolve(data.data.presignedUrl)
end, 'GET', nil, {
Authorization = Config.Webhook
})
return Citizen.Await(promise)
end)