mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 14:38:50 +00:00
fix(wrapper): check if oxmysql.js exists via io function
This commit is contained in:
1 parent
9fc06c2132
commit
2c90290c84
1 file changed
+20
-13
+20
-13
@@ -1,27 +1,34 @@
|
|||||||
local resource = GetCurrentResourceName()
|
local resource = GetCurrentResourceName()
|
||||||
local oxmysql = exports[resource]
|
local oxmysql = exports[resource]
|
||||||
|
|
||||||
do
|
|
||||||
|
CreateThread(function()
|
||||||
|
Wait(1000)
|
||||||
local url = GetResourceMetadata(resource, 'url', 0)
|
local url = GetResourceMetadata(resource, 'url', 0)
|
||||||
local version = GetResourceMetadata(resource, 'version', 0)
|
local version = GetResourceMetadata(resource, 'version', 0)
|
||||||
local link = ('%s/releases/download/v%s/oxmysql-v%s.zip'):format(url, version, version)
|
local link = ('%s/releases/download/v%s/oxmysql-v%s.zip'):format(url, version, version)
|
||||||
|
|
||||||
if not rawget(oxmysql, 'execute') then
|
local path = GetResourcePath(resource):gsub('//', '/')
|
||||||
|
path = ('%s/oxmysql.js'):format(path)
|
||||||
|
local system = os.getenv('OS')
|
||||||
|
if system and system:match('Windows') then
|
||||||
|
path = path:gsub('/', '\\')
|
||||||
|
end
|
||||||
|
local file = io.open(path, 'r')
|
||||||
|
|
||||||
|
if file ~= nil then file:close() else
|
||||||
error(('Unable to locate built "oxmysql.js" - please download the release!\n ^3- %s^0\n'):format(link))
|
error(('Unable to locate built "oxmysql.js" - please download the release!\n ^3- %s^0\n'):format(link))
|
||||||
end
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
PerformHttpRequest(('%s/main/fxmanifest.lua'):format(url:gsub('github.com', 'raw.githubusercontent.com')), function(error, response)
|
||||||
Wait(1000)
|
if error == 200 then
|
||||||
PerformHttpRequest(('%s/main/fxmanifest.lua'):format(url:gsub('github.com', 'raw.githubusercontent.com')), function(error, response)
|
local latest = response:match('%d%.%d+%.%d+')
|
||||||
if error == 200 then
|
if version ~= latest then
|
||||||
local latest = response:match('%d%.%d+%.%d+')
|
print(('^3Your version of oxmysql is outdated (%s) - please update to the latest version (%s)!\n ^3- %s^0'):format(version, latest, link))
|
||||||
if version ~= latest then
|
|
||||||
print(('^3Your version of oxmysql is outdated (%s) - please update to the latest version (%s)!\n ^3- %s^0'):format(version, latest, link))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end, "GET")
|
end
|
||||||
end)
|
end, 'GET')
|
||||||
end
|
end)
|
||||||
|
|
||||||
---@param query string
|
---@param query string
|
||||||
---@param parameters? table
|
---@param parameters? table
|
||||||
|
|||||||
Reference in new issue
Block a user