This commit is contained in:
lifestorm
2024-08-04 23:54:45 +03:00
parent 0e770b2b49
commit df294d03aa
7526 changed files with 4011945 additions and 15 deletions

View File

@@ -0,0 +1,154 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local domain = CreateConVar("xeon_dev", 0, bit.bor(FCVAR_REPLICATED, FCVAR_UNREGISTERED, FCVAR_UNLOGGED, FCVAR_DONTRECORD), nil, 0, 1):GetInt() == 1 and "http://gmod.local" or "https://xeon.network"
local XEON_AUTH
local XEON_IP
net.Receive("XEON.Auth", function(len)
if net.ReadBool() then
if not IsValid(XEON_AUTH) then return end
local path = net.ReadString()
XEON_AUTH:Remove()
XEON_AUTH = Derma_Query(
"You will now be prompted to open a URL in the Steam Overlay. Please click \"Yes\" when prompted.\n\nThe URL will redirect you to a Sign in through Steam page for https://xeon.network.\nYou won't need to enter a username or password, the Steam Overlay should already have you logged in.",
"XEON DRM",
"Continue", function()
gui.OpenURL(domain .. path)
end,
"Cancel"
)
end
net.Start("XEON.Auth")
net.SendToServer()
if IsValid(XEON_AUTH) then return end
if not LocalPlayer():IsSuperAdmin() then
XEON_AUTH = Derma_Message("Thanks for installing one of Billy's scripts!\nTo activate your license and use your new scripts, you need to be a superadmin. Please promote yourself to superadmin, then respawn or rejoin to try again.", "XEON DRM", "Dismiss")
return
end
XEON_AUTH = Derma_Query(
"Thanks for installing one of Billy's scripts!\nTo activate your license and use your new scripts, I'll need you to log in to Steam via the Steam Overlay to authenticate that this server belongs to you.\nWould you like to do this now?",
"XEON DRM",
"Link Server", function()
XEON_AUTH = Derma_Message("Connecting to XEON... please wait. If nothing happens, please check your server's console.", "XEON DRM", "Cancel")
if not IsValid(XEON_IP) then
XEON_IP = vgui.Create("DHTML")
if not IsValid(XEON_IP) or not XEON_IP.OpenURL then
XEON_IP = { GetIPAddress = function(_, callback) callback(nil) end }
else
XEON_IP:SetSize(0, 0)
XEON_IP:AddFunction("XEON", "IP", function(IP)
timer.Remove("XEON_IP")
XEON_IP.IP = IP
for _, c in ipairs(XEON_IP.IP_Callbacks) do c(IP) end
XEON_IP.IP_Callbacks = {}
end)
XEON_IP.IP_Callbacks = {}
function XEON_IP:GetIPAddress(callback)
if os.time() - self.StartedLoading > 5 then
callback(nil)
elseif self.IP then
callback(self.IP)
else
table.insert(self.IP_Callbacks, callback)
end
end
function XEON_IP:OnFinishLoadingDocument(IP)
self:QueueJavascript("XEON.IP(document.body.textContent.trim())")
end
XEON_IP.StartedLoading = os.time()
XEON_IP:OpenURL("https://icanhazip.com/")
timer.Create("XEON_IP", 1, 0, function()
if not IsValid(XEON_IP) then
timer.Remove("XEON_IP")
return
end
if os.time() - XEON_IP.StartedLoading <= 5 then return end
timer.Remove("XEON_IP")
for _, c in ipairs(XEON_IP.IP_Callbacks) do c(nil) end
XEON_IP.IP_Callbacks = {}
end)
end
end
XEON_IP:GetIPAddress(function(IP)
net.Start("XEON.Auth")
net.WriteBool(true)
net.WriteString(tostring(IP or ""))
net.SendToServer()
end)
end,
"Dismiss"
)
end)
local function openErrors(errors)
if IsValid(XEON_ERRORS) then
XEON_ERRORS:Update(errors)
return
end
XEON_ERRORS = vgui.Create("DFrame")
XEON_ERRORS:SetSize(ScrW() * .8, ScrH() * .8)
XEON_ERRORS:SetTitle("XEON DRM by Billy - Error!")
XEON_ERRORS:Center()
XEON_ERRORS:MakePopup()
local html = vgui.Create("DHTML", XEON_ERRORS)
html:Dock(FILL)
html:OpenURL(domain .. "/errors")
html:AddFunction("XEON", "ScriptSupport", function()
gui.OpenURL("https://support.billy.enterprises")
end)
function XEON_ERRORS:Update(errors)
print("XEON Errors: " .. #errors)
PrintTable(errors)
html:QueueJavascript("ShowNetworkedErrors(" .. util.TableToJSON(errors) .. ")")
end
function html:OnDocumentReady()
XEON_ERRORS:Update(errors)
self.OnDocumentReady = nil
end
XEON_ERRORS:Update(errors)
sound.PlayURL("https://xeon.network/static/media/oof.mp3", "", function() end)
end
net.Receive("XEON.Error", function()
local errors = {}
for i = 1, net.ReadUInt(16) do
errors[i] = net.ReadString()
end
openErrors(errors)
end)
hook.Add("InitPostEntity", "XEON.Error", function()
timer.Simple(2, function()
net.Start("XEON.Error")
net.SendToServer()
end)
end)

View File

@@ -0,0 +1,226 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local function JohnLua()
local quotes = {"In the beginning was the Statement, and the Statement was with Lua, and the Statement was Lua.","Greater love has no one than Lua, that the compiler lay down his life for our code.","Do not think that I will debug with the Stack Trace; For had ye believed the Compiler Errors, ye would have believed Me, for he wrote of Lua; But if ye believe not his Stack Traces, how shall ye believe My code?","Even though my types remain weak, I fear no error, for Lua is with me.","Lua is the chain that ties our health and bodies together.","Rip scripts, you must not. Let the Lua flow straight from your fingers.","Variables are changed by your example, not by your opinion.","The meaning of Lua is to give Lua a meaning.","Doubt has killed more scripts than errors will.","The hottest places in Hell are for those who never declare local variables.","Crashes and overflows may break my bones; But pcalls will never harm me.","Wise men code because they have something to make; Fools because they want to make something.","Lua is the joy of the good, the wonder of the wise, the amazement of the Gods.","You dump functions. You dump memory regions and crash reports that look like hell. You dump unused variables and collected garbage and tables. But people?","Whoever believes in the Trace is not condemned, but whoever does not believe stands condemned already because they have not believed in the name of John Lua's one and only Function.","It is written: \"Lua shall not live on interpreter alone, but on every instruction that comes from the mouth of Mike Pall.\"","Because of Mike Pall's great love we are not consumed, for his Traces never fail. They are new every loop; great is your Just-In-Time compilation.","I give them eternal life, and they shall never perish; no one will collect them out of my heap. My Allocator, who has given them to me, is greater than all; no one can Mark-and-Sweep them out of my Garbage-Collectors hand. I and the Collector are one."}
return "\"" .. quotes[math.random(1, #quotes)] .. "\" - John Lua\n"
end
do
local hookId = {}
for i = 1, math.random(10, 20) do
hookId[i] = string.char(math.random(0, 1) == 0 and math.random(97, 122) or math.random(65, 90))
end
hookId = table.concat(hookId)
local ipConVar = GetConVar("ip")
local function getIPAddress()
local ip = game.GetIPAddress()
if ip and #ip > 0 and not ip:StartWith("0.0.0.0") and not ip:StartWith("localhost") and not ip:StartWith("loopback") then
return true
end
ip = ipConVar:GetString()
if ip and #ip > 0 and not ip:StartWith("0.0.0.0") and not ip:StartWith("localhost") and not ip:StartWith("loopback") then
return true
end
return false
end
local function init()
if not getIPAddress() then return end
hook.Remove("GetGameDescription", hookId)
hook.Remove("PlayerConnect", hookId)
MsgC(Color(0,255,255), "\n[ Y88b d88P 8888888888 .d88888b. 888b 888 ]\n[ Y88b d88P 888 d88P\" \"Y88b 8888b 888 ]\n[ Y88o88P 888 888 888 88888b 888 ]\n[ Y888P 8888888 888 888 888Y88b 888 ]\n[ d888b 888 888 888 888 Y88b888 ]\n[ d88888b 888 888 888 888 Y88888 ]\n[ d88P Y88b 888 Y88b. .d88P 888 Y8888 ]\n[ d88P Y88b 8888888888 \"Y88888P\" 888 Y888 ]\n\n")
MsgC(Color(0,255,0), "DRM (digital rights management) for Billy's scripts\n\n")
MsgC(Color(255,255,255), JohnLua())
MsgC(Color(255,0,255), "\nSupport\n")
MsgC(Color(255,255,255), "https://support.billy.enterprises\n")
MsgC(Color(255,0,255), "\nServer Status\n")
MsgC(Color(255,255,255), "https://xeon.network\n")
MsgC(Color(255,0,255), "\nServer/Licenses Panel\n")
MsgC(Color(255,255,255), "https://xeon.network/servers\n")
if system.IsOSX() then
print()
for i = 1, 10 do
MsgC(Color(255,0,0), "XEON DRM is not compatible with your operating system. You are unable to use Billy's scripts on this computer.\n")
end
print()
hook.Run("XEON.Error", "XEON DRM is not compatible with your operating system. You are unable to use Billy's scripts on this computer.")
return
end
local platform = system.IsWindows() and (jit.arch == "x86" and "win32" or "win64") or (jit.arch == "x86" and "linux" or "linux64")
if not file.Exists("bin/gmsv_xeon_drm_" .. platform .. ".dll", "LUA") then
print()
for i = 1, 10 do
MsgC(Color(255,0,0), "Your server is running ", Color(255,255,255), (system.IsWindows() and "Windows" or "Linux"), Color(255,0,0), " on the ", Color(255,255,255), (jit.arch == "x86" and "main" or "x86-64"), Color(255,0,0), " branch\n")
MsgC(Color(255,0,0), "Couldn't find ", Color(255,255,255), "garrysmod/lua/bin/gmsv_xeon_drm_" .. platform .. ".dll", Color(255,0,0), " on your server!\n")
MsgC(Color(255,0,0), "You didn't install the XEON DRM binary module! This is required to use Billy's scripts.\n")
MsgC(Color(255,0,0), "Please download it here: ", Color(255,255,255), "https://xeon.network/download\n\n")
end
print()
hook.Run("XEON.Error", "Your server is running " .. (system.IsWindows() and "Windows" or "Linux") .. " on the " .. (jit.arch == "x86" and "main" or "x86-64") .. " branch")
hook.Run("XEON.Error", "Couldn't find garrysmod/lua/bin/gmsv_xeon_drm_" .. platform .. ".dll on your server!")
hook.Run("XEON.Error", "You didn't install the XEON DRM binary module! This is required to use Billy's scripts.")
hook.Run("XEON.Error", "Please download it here: https://xeon.network/download")
return
end
print()
require("xeon_drm")
if not XEON then
print()
for i = 1, 10 do
MsgC(Color(255,0,0), "XEON DRM failed to load! Please read your server's console for more information.\n")
end
print()
hook.Run("XEON.Error", "XEON DRM failed to load! Please read your server's console for more information.")
return
end
end
hook.Add("GetGameDescription", hookId, init)
hook.Add("PlayerConnect", hookId, init)
end
do
util.AddNetworkString("XEON.Error")
local cached, cachedTick
local function getSuperAdmins()
if cached and cachedTick == engine.TickCount() then
return cached
end
local filter = RecipientFilter()
for _, ply in ipairs(player.GetHumans()) do
if ply:IsSuperAdmin() then
filter:AddPlayer(ply)
end
end
cached, cachedTick = filter, engine.TickCount()
return filter
end
local errors = setmetatable({}, (function()
local meta = {}
meta.__index = meta
function meta:add(error)
table.insert(self, error)
end
function meta:transmit(ply)
if #self == 0 then return end
if player.GetCount() == 0 then return end
if ply ~= nil and (not IsValid(ply) or not ply:IsSuperAdmin()) then return end
net.Start("XEON.Error")
net.WriteUInt(#self, 16)
for _, error in ipairs(self) do
net.WriteString(error)
end
net.Send(ply == nil and getSuperAdmins() or ply)
end
return meta
end)())
hook.Add("XEON.Error", "XEON.Error", function(error)
errors:add(error)
errors:transmit()
end)
hook.Add("PlayerInitialSpawn", "XEON.Error", function(ply)
timer.Simple(5, function()
if not IsValid(ply) or not ply:IsSuperAdmin() then return end
errors:transmit(ply)
end)
end)
net.Receive("XEON.Error", function(_, ply)
if ply:IsSuperAdmin() then
errors:transmit(ply)
end
end)
end
do
local linksRequired = {}
local function startAuth(ply)
local timerName = "XEON.Auth:" .. ply:SteamID64()
timer.Create(timerName, 1, 0, function()
if IsValid(ply) then
net.Start("XEON.Auth")
net.WriteBool(false)
net.Send(ply)
else
timer.Remove(timerName)
end
end)
end
local function authSpawn(ply)
if not linksRequired[ply:SteamID64()] then return end
startAuth(ply)
end
net.Receive("XEON.Auth", function(len, ply)
if len == 0 then
timer.Remove("XEON.Auth:" .. ply:SteamID64())
else
if not ply:IsSuperAdmin() then return end
local steamid64 = ply:SteamID64()
if not linksRequired[steamid64] then return end
linksRequired[steamid64] = nil
if table.IsEmpty(linksRequired) then
hook.Remove("PlayerSpawn", "XEON.Auth")
end
net.ReadBool()
XEON:LinkServer(ply, net.ReadString())
end
end)
hook.Add("XEON.Auth", "XEON.Auth", function(steamid64)
local ply = player.GetBySteamID64(steamid64)
linksRequired[steamid64] = true
if IsValid(ply) then
startAuth(ply)
else
hook.Add("PlayerSpawn", "XEON.Auth", authSpawn)
end
end)
end
do
util.AddNetworkString("XEON.ReloadMap")
net.Receive("XEON.ReloadMap", function(_, ply)
if not ply:IsSuperAdmin() then return end
RunConsoleCommand("changelevel", game.GetMap())
end)
end
MsgC(Color(0,255,255), "XEON DRM is waiting for your server to get an IP address...\n")