forked from 7GrandDadPGN/VapeV4ForRoblox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewMainScript.lua
99 lines (95 loc) · 3.85 KB
/
NewMainScript.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
if getgenv and not getgenv().shared then getgenv().shared = {} end
local errorPopupShown = false
local setidentity = syn and syn.set_thread_identity or set_thread_identity or setidentity or setthreadidentity or function() end
local getidentity = syn and syn.get_thread_identity or get_thread_identity or getidentity or getthreadidentity or function() return 8 end
local isfile = isfile or function(file)
local suc, res = pcall(function() return readfile(file) end)
return suc and res ~= nil
end
local delfile = delfile or function(file) writefile(file, "") end
local function displayErrorPopup(text, func)
local oldidentity = getidentity()
setidentity(8)
local ErrorPrompt = getrenv().require(game:GetService("CoreGui").RobloxGui.Modules.ErrorPrompt)
local prompt = ErrorPrompt.new("Default")
prompt._hideErrorCode = true
local gui = Instance.new("ScreenGui", game:GetService("CoreGui"))
prompt:setErrorTitle("Vape")
prompt:updateButtons({{
Text = "OK",
Callback = function()
prompt:_close()
if func then func() end
end,
Primary = true
}}, 'Default')
prompt:setParent(gui)
prompt:_open(text)
setidentity(oldidentity)
end
local function vapeGithubRequest(scripturl)
if not isfile("vape/"..scripturl) then
local suc, res
task.delay(15, function()
if not res and not errorPopupShown then
errorPopupShown = true
displayErrorPopup("The connection to github is taking a while, Please be patient.")
end
end)
suc, res = pcall(function() return game:HttpGet("https://raw.githubusercontent.com/7GrandDadPGN/VapeV4ForRoblox/"..readfile("vape/commithash.txt").."/"..scripturl, true) end)
if not suc or res == "404: Not Found" then
if identifyexecutor and ({identifyexecutor()})[1] == 'Wave' then
displayErrorPopup('Stop using detected garbage, Vape will not work on such garabge until they fix BOTH HttpGet & file functions.')
error(res)
end
displayErrorPopup("Failed to connect to github : vape/"..scripturl.." : "..res)
error(res)
end
if scripturl:find(".lua") then res = "--This watermark is used to delete the file if its cached, remove it to make the file persist after commits.\n"..res end
writefile("vape/"..scripturl, res)
end
return readfile("vape/"..scripturl)
end
if not shared.VapeDeveloper then
local commit = "main"
for i,v in pairs(game:HttpGet("https://github.com/7GrandDadPGN/VapeV4ForRoblox"):split("\n")) do
if v:find("commit") and v:find("fragment") then
local str = v:split("/")[5]
commit = str:sub(0, str:find('"') - 1)
break
end
end
if commit then
if isfolder("vape") then
if ((not isfile("vape/commithash.txt")) or (readfile("vape/commithash.txt") ~= commit or commit == "main")) then
for i,v in pairs({"vape/Universal.lua", "vape/MainScript.lua", "vape/GuiLibrary.lua"}) do
if isfile(v) and readfile(v):find("--This watermark is used to delete the file if its cached, remove it to make the file persist after commits.") then
delfile(v)
end
end
if isfolder("vape/CustomModules") then
for i,v in pairs(listfiles("vape/CustomModules")) do
if isfile(v) and readfile(v):find("--This watermark is used to delete the file if its cached, remove it to make the file persist after commits.") then
delfile(v)
end
end
end
if isfolder("vape/Libraries") then
for i,v in pairs(listfiles("vape/Libraries")) do
if isfile(v) and readfile(v):find("--This watermark is used to delete the file if its cached, remove it to make the file persist after commits.") then
delfile(v)
end
end
end
writefile("vape/commithash.txt", commit)
end
else
makefolder("vape")
writefile("vape/commithash.txt", commit)
end
else
displayErrorPopup("Failed to connect to github, please try using a VPN.")
error("Failed to connect to github, please try using a VPN.")
end
end
return loadstring(vapeGithubRequest("MainScript.lua"))()