-
Notifications
You must be signed in to change notification settings - Fork 374
/
loader.lua
59 lines (54 loc) · 1.98 KB
/
loader.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local isfile = isfile or function(file)
local suc, res = pcall(function()
return readfile(file)
end)
return suc and res ~= nil and res ~= ''
end
local delfile = delfile or function(file)
writefile(file, '')
end
local function downloadFile(path, func)
if not isfile(path) then
local suc, res = pcall(function()
return game:HttpGet('https://raw.githubusercontent.com/7GrandDadPGN/VapeV4ForRoblox/'..readfile('newvape/profiles/commit.txt')..'/'..select(1, path:gsub('newvape/', '')), true)
end)
if not suc or res == '404: Not Found' then
error(res)
end
if path:find('.lua') then
res = '--This watermark is used to delete the file if its cached, remove it to make the file persist after vape updates.\n'..res
end
writefile(path, res)
end
return (func or readfile)(path)
end
local function wipeFolder(path)
if not isfolder(path) then return end
for _, file in listfiles(path) do
if file:find('loader') then continue end
if isfile(file) and select(1, readfile(file):find('--This watermark is used to delete the file if its cached, remove it to make the file persist after vape updates.')) == 1 then
delfile(file)
end
end
end
for _, folder in {'newvape', 'newvape/games', 'newvape/profiles', 'newvape/assets', 'newvape/libraries', 'newvape/guis'} do
if not isfolder(folder) then
makefolder(folder)
end
end
if not shared.VapeDeveloper then
local _, subbed = pcall(function()
return game:HttpGet('https://github.com/7GrandDadPGN/VapeV4ForRoblox')
end)
local commit = subbed:find('currentOid')
commit = commit and subbed:sub(commit + 13, commit + 52) or nil
commit = commit and #commit == 40 and commit or 'main'
if commit == 'main' or (isfile('newvape/profiles/commit.txt') and readfile('newvape/profiles/commit.txt') or '') ~= commit then
wipeFolder('newvape')
wipeFolder('newvape/games')
wipeFolder('newvape/guis')
wipeFolder('newvape/libraries')
end
writefile('newvape/profiles/commit.txt', commit)
end
return loadstring(downloadFile('newvape/main.lua'), 'main')()