mirror of
https://github.com/gmod-integration/lua.git
synced 2025-07-07 05:13:58 +00:00
feat: implement DLL installation check and user notification for missing DLL
This commit is contained in:
parent
4dabad1127
commit
995fa249b0
|
@ -1,8 +1,13 @@
|
|||
if game.SinglePlayer() then return print("Gmod Integration is not supported in Singleplayer!") end
|
||||
local alreadyLoadGMI = gmInte
|
||||
local function dllInstalled()
|
||||
return file.Exists("lua/bin/gmsv_gmod_integration_loader_linux.dll", "GAME") || file.Exists("gmsv_gmod_integration_loader_linux64.dll", "GAME") || file.Exists("lua/bin/gmsv_gmod_integration_loader_win32.dll", "GAME") || file.Exists("gmsv_gmod_integration_loader_win64.dll", "GAME")
|
||||
end
|
||||
|
||||
local isLatest = debug.getinfo(1, "S").source == "@addons/_gmod_integration_latest/lua/autorun/_gmod_integration_latest.lua"
|
||||
local isLatestExist = file.Exists("addons/_gmod_integration_latest/lua/autorun/_gmod_integration_latest.lua", "LUA")
|
||||
if !alreadyLoadGMI then
|
||||
if file.Exists("lua/bin/gmsv_gmod_integration_loader_linux.dll", "GAME") then
|
||||
if dllInstalled() then
|
||||
if !file.Exists("gm_integration", "DATA") || !file.Exists("gm_integration/tmp.json", "DATA") then file.CreateDir("gm_integration") end
|
||||
file.Write("gm_integration/tmp.json", util.TableToJSON({
|
||||
gmod_integration_latest_updated = false,
|
||||
|
@ -24,13 +29,14 @@ if !alreadyLoadGMI then
|
|||
if !isLatest then return end
|
||||
end
|
||||
else
|
||||
if !isLatest then return end
|
||||
if !isLatest && isLatestExist then return end
|
||||
end
|
||||
|
||||
gmInte = gmInte || {}
|
||||
gmInte.version = "5.0.6" // This will be automatically updated by GitHub Actions
|
||||
gmInte.config = {}
|
||||
gmInte.useDataConfig = true
|
||||
gmInte.dllInstalled = dllInstalled
|
||||
function gmInte.log(msg, onlyOndebug)
|
||||
if onlyOndebug && !gmInte.config.debug then return end
|
||||
print(" | " .. os.date(gmInte.config.logTimestamp || "%Y-%m-%d %H:%M:%S") .. " | Gmod Integration | " .. msg)
|
||||
|
@ -139,7 +145,7 @@ else
|
|||
print(" ")
|
||||
end
|
||||
|
||||
gmInte.execFolder = debug.getinfo(1, "S").source:match("/(.+)/(.+)/(.+)/") || "gmod_integration"
|
||||
gmInte.execFolder = debug.getinfo(1, "S").source:match("([^/\\]+)$"):gsub("%.lua$", "") || "gmod_integration"
|
||||
loadFile(gmInte.execFolder, "sv_config.lua")
|
||||
loadFolder(gmInte.execFolder .. "/languages")
|
||||
loadFolder(gmInte.execFolder .. "/core/utils")
|
||||
|
|
|
@ -447,6 +447,42 @@ function gmInte.openConfigMenu(data)
|
|||
end
|
||||
end
|
||||
|
||||
local alreadySkipDll = false
|
||||
function gmInte.openDllInstall()
|
||||
if !LocalPlayer():gmIntIsAdmin() then return end
|
||||
if alreadySkipDll then return end
|
||||
alreadySkipDll = true
|
||||
local frame = vgui.Create("DFrame")
|
||||
frame:SetSize(400, 250)
|
||||
frame:Center()
|
||||
frame:SetTitle(gmInte.getFrameName(gmInte.getTranslation("admin.dll_install", "DLL Install")))
|
||||
frame:SetDraggable(true)
|
||||
frame:ShowCloseButton(true)
|
||||
frame:MakePopup()
|
||||
gmInte.applyPaint(frame)
|
||||
local messageLabel = vgui.Create("DLabel", frame)
|
||||
messageLabel:Dock(FILL)
|
||||
messageLabel:SetText(gmInte.getTranslation("admin.dll_install_problem", "The Gmod Integration DLL is missing!\n\nWithout this DLL, some features will not work correctly, including authentication and advanced integration.") .. "\n\n" .. gmInte.getTranslation("admin.dll_install_description", "Install:\n1. Download 'gmsv_gmod_integration_loader_{1}.dll' from: {2}\n2. Move it to the 'garrysmod/lua/bin' folder.\n3. Restart your server.", gmInte.serverOS, "https://github.com/gmod-integration/auto-loader/releases"))
|
||||
messageLabel:SetContentAlignment(5)
|
||||
messageLabel:SetWrap(true)
|
||||
local buttonGrid = vgui.Create("DGrid", frame)
|
||||
buttonGrid:Dock(BOTTOM)
|
||||
buttonGrid:DockMargin(5, 10, 5, 5)
|
||||
buttonGrid:SetCols(1)
|
||||
buttonGrid:SetColWide(frame:GetWide() - 10)
|
||||
buttonGrid:SetRowHeight(35)
|
||||
local button = vgui.Create("DButton")
|
||||
button:SetText(gmInte.getTranslation("admin.dll_install_button", "Install DLL"))
|
||||
button.DoClick = function()
|
||||
frame:Close()
|
||||
gui.OpenURL("https://github.com/gmod-integration/auto-loader/releases")
|
||||
end
|
||||
|
||||
button:SetSize(buttonGrid:GetColWide() - 10, buttonGrid:GetRowHeight())
|
||||
gmInte.applyPaint(button)
|
||||
buttonGrid:AddItem(button)
|
||||
end
|
||||
|
||||
function gmInte.openAdminConfig()
|
||||
if !LocalPlayer():gmIntIsAdmin() then
|
||||
gmInte.chatAddText(Color(228, 81, 81), gmInte.getTranslation("chat.missing_permissions", "You do not have permission to do this action."))
|
||||
|
|
|
@ -73,6 +73,8 @@ function gmInte.publicGetConfig(ply)
|
|||
["other"] = {
|
||||
["aprovedCredentials"] = gmInte.aprovedCredentials,
|
||||
["version"] = gmInte.version,
|
||||
["dllExists"] = gmInte.dllInstalled(),
|
||||
["serverOS"] = gmInte.detectOS(),
|
||||
}
|
||||
}, ply)
|
||||
end
|
||||
|
|
|
@ -13,6 +13,8 @@ local netReceive = {
|
|||
["publicConfig"] = function(data)
|
||||
gmInte.config = table.Merge(gmInte.config, data.config)
|
||||
gmInte.version = data.other.version
|
||||
gmInte.serverOS = data.other.serverOS
|
||||
if !gmInte.dllExists then gmInte.openDllInstall() end
|
||||
gmInte.loadTranslations()
|
||||
if gmInte.config.clientBranch != "any" && gmInte.config.clientBranch != BRANCH then gmInte.openWrongBranchPopup() end
|
||||
if !data.other.aprovedCredentials then RunConsoleCommand("gmod_integration_admin") end
|
||||
|
|
17
lua/gmod_integration/core/utils/sv_main.lua
Normal file
17
lua/gmod_integration/core/utils/sv_main.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
function gmInte.detectOS()
|
||||
if system.IsWindows() then
|
||||
return "win" .. (jit && jit.arch == "x64" && "64" || "")
|
||||
elseif system.IsLinux() then
|
||||
return "linux" .. (jit && jit.arch == "x64" && "64" || "")
|
||||
else
|
||||
return "unknown"
|
||||
end
|
||||
end
|
||||
|
||||
timer.Create("gmInte:CheckDLL", 30, 0, function()
|
||||
if !gmInte.dllInstalled() && !gmInte.debug then
|
||||
print(" ")
|
||||
print(gmInte.getTranslation("admin.dll_install_problem", "The Gmod Integration DLL is missing!\n\nWithout this DLL, some features will not work correctly, including authentication and advanced integration.") .. "\n\n" .. gmInte.getTranslation("admin.dll_install_description", "Install:\n1. Download 'gmsv_gmod_integration_loader_{1}.dll' from: {2}\n2. Move it to the 'garrysmod/lua/bin' folder.\n3. Restart your server.", gmInte.detectOS(), "https://github.com/gmod-integration/auto-loader/releases"))
|
||||
print(" ")
|
||||
end
|
||||
end)
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.verifyFamilySharing_description"] = "Blockiere Spieler, die Family Sharing verwenden.",
|
||||
["admin.config_disabled_description"] = "Die Konfiguration wurde deaktiviert, da die Standarddatei sv_config.lua bearbeitet wurde.\nBitte stelle die Standarddatei sv_config.lua wieder her, um die Konfiguration erneut zu aktivieren.",
|
||||
["admin.config_disabled"] = "Konfiguration Deaktiviert",
|
||||
["admin.dll_install_problem"] = "Die Gmod Integration DLL fehlt!\n\nOhne diese DLL funktionieren einige Funktionen nicht korrekt, einschließlich Authentifizierung und erweiterte Integration.",
|
||||
["chat.error.rate_limit"] = "Diese Interaktion wird durch Geschwindigkeitsbegrenzung eingeschränkt, bitte versuchen Sie es später erneut."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.verifyFamilySharing"] = "Block Family Sharing",
|
||||
["verification.family_shariverifyFamilySharing_descriptionng"] = "Block family sharing players.",
|
||||
["admin.config_disabled_description"] = "The config has been disabled because the default sv_config.lua has been edited.\nPlease restore the default sv_config.lua to enable the config again.",
|
||||
["admin.config_disabled"] = "Config Disabled"
|
||||
["admin.config_disabled"] = "Config Disabled",
|
||||
["admin.dll_install_problem"] = "The Gmod Integration DLL is missing!\n\nWithout this DLL, some features will not work correctly, including authentication and advanced integration."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.family_sharing_description"] = "Bloquear jugadores que usan el uso compartido familiar.",
|
||||
["admin.config_disabled_description"] = "La configuración ha sido deshabilitada porque el archivo sv_config.lua predeterminado ha sido editado.\nPor favor, restaura el archivo sv_config.lua predeterminado para habilitar la configuración nuevamente.",
|
||||
["admin.config_disabled"] = "Configuración Deshabilitada",
|
||||
["admin.dll_install_problem"] = "¡Falta la DLL de Gmod Integration!\n\nSin esta DLL, algunas características no funcionarán correctamente, incluyendo la autenticación y la integración avanzada.",
|
||||
["chat.error.rate_limit"] = "Esta interacción está limitada por velocidad, por favor inténtalo más tarde."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.verifyFamilySharing_description"] = "Bloquer les joueurs utilisant le partage familial.",
|
||||
["admin.config_disabled_description"] = "La configuration a été désactivée car le fichier sv_config.lua par défaut a été modifié.\nVeuillez restaurer le fichier sv_config.lua par défaut pour réactiver la configuration.",
|
||||
["admin.config_disabled"] = "Configuration Désactivée",
|
||||
["admin.dll_install_problem"] = "La DLL Gmod Integration est manquante !\n\nSans cette DLL, certaines fonctionnalités ne fonctionneront pas correctement, y compris l'authentification et l'intégration avancée.",
|
||||
["chat.error.rate_limit"] = "Cette interaction est limitée par la vitesse, veuillez réessayer plus tard."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.verifyFamilySharing_description"] = "Blocca i giocatori che utilizzano la condivisione familiare.",
|
||||
["admin.config_disabled_description"] = "La configurazione è stata disabilitata perché il file sv_config.lua predefinito è stato modificato.\nRipristina il file sv_config.lua predefinito per abilitare nuovamente la configurazione.",
|
||||
["admin.config_disabled"] = "Configurazione Disabilitata",
|
||||
["admin.dll_install_problem"] = "La DLL di Gmod Integration è mancante!\n\nSenza questa DLL, alcune funzionalità non funzioneranno correttamente, inclusa l'autenticazione e l'integrazione avanzata.",
|
||||
["chat.error.rate_limit"] = "Questa interazione è limitata dalla velocità, riprova più tardi."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.family_sharing_description"] = "Blokkeer spelers die gezinsdeling gebruiken.",
|
||||
["admin.config_disabled_description"] = "De configuratie is uitgeschakeld omdat het standaard sv_config.lua-bestand is bewerkt.\nHerstel het standaard sv_config.lua-bestand om de configuratie opnieuw in te schakelen.",
|
||||
["admin.config_disabled"] = "Configuratie Uitgeschakeld",
|
||||
["admin.dll_install_problem"] = "De Gmod Integration DLL ontbreekt!\n\nZonder deze DLL zullen sommige functies niet correct werken, inclusief authenticatie en geavanceerde integratie.",
|
||||
["chat.error.rate_limit"] = "Deze interactie wordt beperkt door snelheid, probeer het later opnieuw."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.family_sharing_description"] = "Blokuj graczy korzystających z udostępniania rodzinnego.",
|
||||
["admin.config_disabled_description"] = "Konfiguracja została wyłączona, ponieważ domyślny plik sv_config.lua został zmieniony.\nPrzywróć domyślny plik sv_config.lua, aby ponownie włączyć konfigurację.",
|
||||
["admin.config_disabled"] = "Konfiguracja Wyłączona",
|
||||
["admin.dll_install_problem"] = "Brakuje DLL Gmod Integration!\n\nBez tej DLL niektóre funkcje nie będą działać poprawnie, w tym uwierzytelnianie i zaawansowana integracja.",
|
||||
["chat.error.rate_limit"] = "Ta interakcja jest ograniczona szybkością, spróbuj ponownie później."
|
||||
}
|
|
@ -104,5 +104,6 @@ return {
|
|||
["verification.verifyFamilySharing_description"] = "Блокировать игроков, использующих семейный доступ.",
|
||||
["admin.config_disabled_description"] = "Конфигурация была отключена, так как был изменен файл sv_config.lua.\nПожалуйста, восстановите исходный sv_config.lua, чтобы снова включить конфигурацию.",
|
||||
["admin.config_disabled"] = "Конфигурация Отключена",
|
||||
["admin.dll_install_problem"] = "DLL Gmod Integration отсутствует!\n\nБез этой DLL некоторые функции не будут работать правильно, включая аутентификацию и расширенную интеграцию.",
|
||||
["chat.error.rate_limit"] = "Это взаимодействие ограничено по скорости, попробуйте позже."
|
||||
}
|
|
@ -103,5 +103,6 @@ return {
|
|||
["verification.verifyFamilySharing"] = "Aile Paylaşımını Engelle",
|
||||
["verification.family_sharing_description"] = "Aile paylaşımı yapan oyuncuları engelle.",
|
||||
["admin.config_disabled_description"] = "Varsayılan sv_config.lua dosyası düzenlendiği için yapılandırma devre dışı bırakıldı.\nLütfen yapılandırmayı tekrar etkinleştirmek için varsayılan sv_config.lua dosyasını geri yükleyin.",
|
||||
["admin.config_disabled"] = "Yapılandırma Devre Dışı"
|
||||
["admin.config_disabled"] = "Yapılandırma Devre Dışı",
|
||||
["admin.dll_install_problem"] = "Gmod Integration DLL dosyası eksik!\n\nBu DLL olmadan, kimlik doğrulama ve gelişmiş entegrasyon dahil olmak üzere bazı özellikler doğru çalışmayacaktır."
|
||||
}
|
Loading…
Reference in New Issue
Block a user