@@ -16,7 +16,7 @@ local COMPILE_URL = "https://luac.mtasa.com/?compile=1&debug=0&obfuscate=3"
1616addEvent (thisResName .. " :requestDecryptFile" , true )
1717addEvent (thisResName .. " :requestEncryptFile" , true )
1818
19- function compileCallback (responseData , responseError , fn , player )
19+ function compileCallback (responseData , responseInfo , fn , player )
2020
2121 local errorCodes = {
2222 [" ERROR Nothing to do - Please select compile and/or obfuscate" ] = true ,
@@ -26,7 +26,7 @@ function compileCallback(responseData, responseError, fn, player)
2626 [" ERROR Already encrypted" ] = true ,
2727 }
2828
29- if responseError == 0 then
29+ if responseInfo . success then
3030
3131 if errorCodes [responseData ] == true then
3232 return outputChatBox (" #ffffffLuac: #ff0000'" .. fn .. " ' failed to compile: " .. responseData , player , 255 ,255 ,255 , true )
@@ -80,7 +80,7 @@ function encryptFile(fpath, secretKey, player)
8080 end
8181 local encodedContentHash = md5 (encoded )
8282
83- local ivList
83+ local ivList = {}
8484 local kfn = FN_DECRYPTER_KEYS
8585 local kf
8686 local opened = false
@@ -101,12 +101,10 @@ function encryptFile(fpath, secretKey, player)
101101 end
102102 if kfJson ~= " " then
103103 ivList = fromJSON (kfJson )
104- end
105-
106- if not ivList then
107- iprint (kfJson )
108- outputChatBox (" Failed to read IV keys from: " .. kfn , player , 255 ,25 ,25 )
109- return false
104+ if not ivList then
105+ outputChatBox (" Failed to read IV keys from: " .. kfn , player , 255 ,25 ,25 )
106+ return false
107+ end
110108 end
111109 fileDelete (kfn )
112110 end
@@ -239,9 +237,12 @@ local function getFilesInFolderRecursively(parentPath, folderName)
239237 parentFolder = folderName
240238 end
241239 for _ , fileOrFolder in pairs (pathListDir (parentFolder ) or {}) do
242- if pathIsFile (fileOrFolder ) then
243- files [# files + 1 ] = parentFolder .. " /" .. fileOrFolder
244- elseif pathIsDirectory (fileOrFolder ) then
240+ local thisPath = parentFolder .. " /" .. fileOrFolder
241+ if pathIsFile (thisPath ) then
242+ if not (fileOrFolder == ' .keep' ) then
243+ files [# files + 1 ] = thisPath
244+ end
245+ elseif pathIsDirectory (thisPath ) then
245246 local subFiles = getFilesInFolderRecursively (parentFolder , fileOrFolder )
246247 for _ , subFile in pairs (subFiles ) do
247248 files [# files + 1 ] = subFile
@@ -258,11 +259,13 @@ local function requestMenu(thePlayer, cmd, option)
258259 if option == ' menu' then
259260 triggerClientEvent (thePlayer , thisResName .. " :openMenu" , thePlayer , scriptVersion )
260261 elseif option == ' loadfiles' then
261- local files = getFilesInFolderRecursively (false , " files" )
262+ local files = getFilesInFolderRecursively (nil , " files" )
262263 local files2 = {}
263264 for _ , file in pairs (files ) do
264265 files2 [file ] = true
266+ outputChatBox (" - " .. file , thePlayer , 187 ,187 ,187 )
265267 end
268+ outputChatBox (" Found " ..# files .. " files inside the files folder" , thePlayer , 25 ,255 ,25 )
266269 triggerClientEvent (thePlayer , thisResName .. " :loadFileListFromServer" , thePlayer , files2 )
267270 end
268271end
@@ -310,7 +313,11 @@ function requestEncryptFile(filePaths, secretKey)
310313 return outputChatBox (" File is empty: " .. fn , client , 255 ,25 ,25 )
311314 end
312315 outputChatBox (" Compiling '" .. fn .. " '.." , client , 75 ,255 ,75 )
313- fetchRemote (COMPILE_URL , compileCallback , {content , true , fn , client })
316+ fetchRemote (COMPILE_URL , {
317+ queueName = ' nandocrypt_comp' ,
318+ method = " POST" ,
319+ postData = content ,
320+ }, compileCallback , {fn , client })
314321 end
315322end
316323addEventHandler (thisResName .. " :requestEncryptFile" , resourceRoot , requestEncryptFile , false )
0 commit comments