From c88cc2a6205070aa8975fd490a3622b2e5f9fae4 Mon Sep 17 00:00:00 2001 From: Parkeymon <68636315+Parkeymon@users.noreply.github.com> Date: Thu, 22 Jul 2021 16:42:28 -0700 Subject: [PATCH] Github authentication --- README.md | 23 ++++++++++++++++++++--- SCP-SL-Exiled-Egg.json | 24 +++++++++++++++++++++--- script.sh | 15 +++++++++++++-- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3d29f6b..43a8b7b 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ Features: - Select pre-release or release of EXILED - Specific EXILED version support - Discord integration bot and plugin -- Localadmin +- Localadmin - Automiatically checks if the egg is up to date and notifys you when there is an update. -- Auto Admintools install +- Auto Admintools install - Auto Common Utilities install. -- Auto SCPStats install. +- Auto SCPStats install. - Automatically install and update any plugin you put in. - Exiled updater auto-removal - FFmpeg (for use with [CommsHack](https://github.com/VirtualBrightPlayz/CommsHack)) @@ -36,6 +36,23 @@ https://api.github.com/repos///releases/latest https://api.github.com/repos/iopietro/BetterScp939/releases/latest ``` +###⚠️**WARNING**⚠️ +If you need to make more thank 60 GitHub requests in an hour you NEED to use authentication or else the installation could possibly fail leaving you with a failed install state! +Each install/reinstall makes at least one request to check the egg version and one request per plugin that you add in so if you add 19 plugins and reinstall a few times within a short time frame it _will_ rate-limit you. + +![Failed Install State](https://media.discordapp.net/attachments/867104159907840031/867106088767062027/unknown.png) + +## How to use authentication + +You should authenticate because it allows you to make up to _5000_ GitHub requests per hour as well as letting you download from private repos. + +In order to use authentication all you need to do is fill out your GitHub username and Access Token in the startup configuration. +You can find a tutorial on how to get a token [here](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token). + +It is important to follow the [principle of least privilege](https://en.wikipedia.org/wiki/Principle_of_least_privilege) and only grant the permissions it needs. +In this case you don't need to add any scopes because we are just validating we are a user. + +This should also allow you to download from private repos (Although I haven't tested it you may need additional scopes). ## Custom Docker Images diff --git a/SCP-SL-Exiled-Egg.json b/SCP-SL-Exiled-Egg.json index 322bdf7..2408bb8 100644 --- a/SCP-SL-Exiled-Egg.json +++ b/SCP-SL-Exiled-Egg.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2021-07-20T11:37:52-07:00", + "exported_at": "2021-07-22T16:41:40-07:00", "name": "EXILED SCP:SL Egg", "author": "pwolfe@stealthturtle.com", "description": "Egg for SCP: Secret Laboratory Dedicated Linux Server", @@ -22,7 +22,7 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/bash\r\n# steamcmd Base Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\n\r\necho \"\r\n$(tput setaf 4) ____________________________ ______________ \r\n$(tput setaf 4) \/ _____\/\\_ ___ \\______ \\ \/\\ \/ _____\/| | \r\n$(tput setaf 4) \\_____ \\ \/ \\ \\\/| ___\/ \\\/ \\_____ \\ | | \r\n$(tput setaf 4) \/ || \\___| | \/\\ \/ \\| |___ \r\n$(tput setaf 4)\/_________\/ \\________\/____| \\\/ \/_________\/|________|\r\n$(tput setaf 1) ___ __ __ __ \r\n$(tput setaf 1)| | ____ _______\/ |______ | | | | ___________ \r\n$(tput setaf 1)| |\/ \\ \/ ___\/\\ __\\__ \\ | | | | _\/ __ \\_ __ |\r\n$(tput setaf 1)| | | |\\___ \\ | | \/ __ \\| |_| |_\\ ___\/| | \\\/\r\n$(tput setaf 1)|___|___|__\/______> |__| (______|____|____\/\\___ |__| \r\n$(tput setaf 0)\r\n\"\r\n\r\necho \"\r\n$(tput setaf 2)This installer was created by $(tput setaf 1)Parkeymon#0001\r\n\"\r\n\r\n# Egg version checking, do not touch!\r\ncurrentVersion=\"2.1.1\"\r\nlatestVersion=$(curl --silent \"https:\/\/api.github.com\/repos\/Parkeymon\/EXILED-SCP-SL-egg\/releases\/latest\" | jq -r .tag_name)\r\n\r\nif [ \"${currentVersion}\" == \"${latestVersion}\" ]; then\r\n echo \"$(tput setaf 2)Installer is up to date\"\r\nelse\r\n\r\n echo \"\r\n $(tput setaf 1)THE INSTALLER IS NOT UP TO DATE!\r\n\r\n Current Version: $(tput setaf 1)${currentVersion}\r\n Latest: $(tput setaf 2)${latestVersion}\r\n\r\n $(tput setaf 3)Please update to the latest version found here: https:\/\/github.com\/Parkeymon\/EXILED-SCP-SL-egg\/releases\/latest\r\n\r\n \"\r\n sleep 10\r\nfi\r\n\r\n# Download SteamCMD and Install\r\ncd \/tmp || {\r\n echo \"$(tput setaf 1) FAILED TO MOUNT TO \/TMP\"\r\n exit\r\n}\r\nmkdir -p \/mnt\/server\/steamcmd\r\ncurl -sSL -o steamcmd.tar.gz https:\/\/steamcdn-a.akamaihd.net\/client\/installer\/steamcmd_linux.tar.gz\r\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\r\ncd \/mnt\/server\/steamcmd || {\r\n echo \"$(tput setaf 1) FAILED TO MOUNT TO \/mnt\/server\/steamcmd\"\r\n exit\r\n}\r\n\r\n# SteamCMD fails otherwise for some reason, even running as root.\r\n# This is changed at the end of the install process anyways.\r\nchown -R root:root \/mnt\r\nexport HOME=\/mnt\/server\r\n\r\nif [ \"${BETA_TAG}\" == \"none\" ]; then\r\n .\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update \"${SRCDS_APPID}\" validate +quit\r\nelse\r\n .\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update \"${SRCDS_APPID}\" \"${BETA_TAG}\" validate +quit\r\nfi\r\n\r\n# Install SL with SteamCMD\r\ncd \/mnt\/server || {\r\n echo \"$(tput setaf 1) FAILED TO MOUNT TO \/mnt\/server\"\r\n exit\r\n}\r\n\r\necho \"$(tput setaf 4)Configuring start.sh$(tput setaf 0)\"\r\nrm start.sh\r\ntouch \"start.sh\"\r\nchmod +x .\/start.sh\r\n\r\nmkdir .egg\r\n\r\nif [ \"${INSTALL_BOT}\" == \"true\" ]; then\r\n echo \"#!\/bin\/bash\r\n node discordIntegration.js > \/dev\/null &\r\n .\/LocalAdmin \\${SERVER_PORT}\" >>start.sh\r\n echo \"$(tput setaf 4)Finished configuring start.sh for LocalAdmin and Discord Integration.$(tput setaf 0)\"\r\n\r\nelse\r\n echo \"#!\/bin\/bash\r\n .\/LocalAdmin \\${SERVER_PORT}\" >>start.sh\r\n echo \"$(tput setaf 4)Finished configuring start.sh for LocalAdmin.$(tput setaf 0)\"\r\n\r\nfi\r\n\r\nif [ \"${INSTALL_BOT}\" == \"true\" ]; then\r\n\r\n echo \"$(tput setaf 4)Installing latest Discord Integration bot version.$(tput setaf 0)\"\r\n wget https:\/\/github.com\/Exiled-Team\/DiscordIntegration\/releases\/latest\/download\/DiscordIntegration.Bot.tar.gz\r\n tar xzvf DiscordIntegration.Bot.tar.gz\r\n rm DiscordIntegration.Bot.tar.gz\r\n echo \"Deleting config\"\r\n rm config.yml\r\n echo \"Replacing Config\"\r\n mv .\/BotConfigTemp\/config.yml .\/\r\n echo \"Removing temporary directory\"\r\n rm -r BotConfigTemp\r\n echo \"$(tput setaf 4)Your configs have been saved!\"\r\n\r\n echo \"$(tput setaf 4)Updating Packages\"\r\n\r\n yarn install\r\n\r\n if [ \"${CONFIG_SAVER}\" == \"true\" ]; then\r\n echo \"$(tput setaf 4)Config Saver is $(tput setaf 2)ENABLED\"\r\n echo \"Making temporary directory\"\r\n mkdir BotConfigTemp\r\n echo \"Moving config.\"\r\n mv config.yml .\/BotConfigTemp\r\n\r\n fi\r\nelse\r\n echo \"$(tput setaf 4)Skipping bot install...$(tput setaf 0)\"\r\nfi\r\n\r\nif [ \"${INSTALL_EXILED}\" == \"true\" ]; then\r\n echo \"$(tput setaf 4)Downloading $(tput setaf 1)EXILED$(tput setaf 0)..\"\r\n mkdir .config\/\r\n echo \"$(tput setaf 4)Downloading latest $(tput setaf 1)EXILED$(tput setaf 4) Installer$(tput setaf 0)\"\r\n rm Exiled.Installer-Linux\r\n wget https:\/\/github.com\/galaxy119\/EXILED\/releases\/latest\/download\/Exiled.Installer-Linux\r\n chmod +x .\/Exiled.Installer-Linux\r\n\r\n if [ \"${EXILED_PRE}\" == \"true\" ]; then\r\n echo \"$(tput setaf 4)Installing $(tput setaf 1)EXILED (pre-release)$(tput setaf 0)..\"\r\n .\/Exiled.Installer-Linux --pre-releases\r\n\r\n elif [ \"${EXILED_PRE}\" == \"false\" ]; then\r\n echo \"$(tput setaf 4)Installing $(tput setaf 1)EXILED$(tput setaf 0)..\"\r\n .\/Exiled.Installer-Linux\r\n\r\n else\r\n echo \"$(tput setaf 4)Installing $(tput setaf 1)EXILED$(tput setaf 0) version: ${EXILED_PRE} ..\"\r\n .\/Exiled.Installer-Linux --target-version \"${EXILED_PRE}\"\r\n\r\n fi\r\nelse\r\n echo \"Skipping Exiled installation.\"\r\nfi\r\n\r\nif [ \"${REMOVE_UPDATER}\" == \"true\" ]; then\r\n echo \"Removing Exiled updater.\"\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/Exiled.Updater.dll\r\nelse\r\n echo \"Skipping EXILED updater removal.\"\r\nfi\r\n\r\nif [ \"${INSTALL_INTEGRATION}\" == \"true\" ]; then\r\n echo \"Installing Latest Discord Integration Plugin...\"\r\n\r\n echo \"Removing old Discord Integration (if it exists)\"\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/DiscordIntegration_Plugin.dll\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/DiscordIntegration.dll\r\n\r\n echo \"Grabbing plugin and dependencies.\"\r\n wget https:\/\/github.com\/Exiled-Team\/DiscordIntegration\/releases\/latest\/download\/Plugin.tar.gz -P \/mnt\/server\/.config\/EXILED\/Plugins\r\n\r\n echo \"Extracting...\"\r\n tar xzvf \/mnt\/server\/.config\/EXILED\/Plugins\/Plugin.tar.gz\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/Plugin.tar.gz\r\n\r\nelse\r\n echo \"Skipping Discord integration plugin install\"\r\nfi\r\n\r\nif [ \"${INSTALL_ADMINTOOLS}\" == \"true\" ]; then\r\n echo \"Removing existing Admin Tools version.\"\r\n rm .config\/EXILED\/Plugins\/AdminTools.dll\r\n echo \"Installing latest Admin Tools\"\r\n wget https:\/\/github.com\/Exiled-Team\/AdminTools\/releases\/latest\/download\/AdminTools.dll -P \/mnt\/server\/.config\/EXILED\/Plugins\r\n\r\nelse\r\n echo \"Skipping Admin Tools install.\"\r\nfi\r\n\r\nif [ \"${INSTALL_UTILITIES}\" == \"true\" ]; then\r\n echo \"Removing existing Common Utilities version.\"\r\n rm .config\/EXILED\/Plugins\/Common_Utilities.dll\r\n echo \"Installing Common Utilities.\"\r\n wget https:\/\/github.com\/Exiled-Team\/Common-Utils\/releases\/latest\/download\/Common_Utilities.dll -P \/mnt\/server\/.config\/EXILED\/Plugins\r\nelse\r\n echo \"Skipping Common Utilities Install\"\r\nfi\r\n\r\nif [ \"${INSTALL_SCPSTATS}\" == \"true\" ]; then\r\n echo \"Removing existing SCPStats version.\"\r\n rm .config\/EXILED\/Plugins\/SCPStats.dll\r\n echo \"Installing SCPStats\"\r\n wget https:\/\/github.com\/SCPStats\/Plugin\/releases\/latest\/download\/SCPStats.dll -P \/mnt\/server\/.config\/EXILED\/Plugins\r\nelse\r\n echo \"Skipping SCPStats Install.\"\r\nfi\r\n\r\nfunction pluginInstall() {\r\n # Caches the plugin to a json so only one request to Github is needed\r\n\r\n curl --silent \"$1\" | jq . > plugin.json\r\n\r\n echo \"Installing $(jq -r .assets[0].name plugin.json) $(jq -r .tag_name plugin.json) by $(jq -r .author.login plugin.json)\"\r\n\r\n # For the evil people that put the version in their plugin name the old version will need to be manually deleted\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/\"$(jq -r .assets[0].name plugin.json)\"\r\n\r\n jq -r .assets[0].browser_download_url plugin.json\r\n\r\n wget \"$(jq -r .assets[0].browser_download_url plugin.json)\" -P \/mnt\/server\/.config\/EXILED\/Plugins\r\n\r\n rm plugin.json\r\n}\r\n\r\nif [ \"${INSTALL_CUSTOM}\" == \"true\" ]; then\r\n touch \/mnt\/server\/.egg\/customplugins.txt\r\n\r\n grep -v '^ *#' <\/mnt\/server\/.egg\/customplugins.txt | while IFS= read -r I; do\r\n pluginInstall \"${I}\"\r\n done\r\n\r\nfi\r\n\r\nif [ \"${INSTALL_BOT}\" == \"true\" ]; then\r\n echo \"Dont forget to configure the discord bot in \/home\/container\/config.yml\"\r\nfi\r\n\r\necho \"$(tput setaf 2)Installation Complete!$(tput sgr 0)\"\r\n\r\n##TODO - using git to sync configs with github\r\n\r\n##TODO - Fix plugin install locations", + "script": "#!\/bin\/bash\r\n# steamcmd Base Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\n\r\necho \"\r\n$(tput setaf 4) ____________________________ ______________ \r\n$(tput setaf 4) \/ _____\/\\_ ___ \\______ \\ \/\\ \/ _____\/| | \r\n$(tput setaf 4) \\_____ \\ \/ \\ \\\/| ___\/ \\\/ \\_____ \\ | | \r\n$(tput setaf 4) \/ || \\___| | \/\\ \/ \\| |___ \r\n$(tput setaf 4)\/_________\/ \\________\/____| \\\/ \/_________\/|________|\r\n$(tput setaf 1) ___ __ __ __ \r\n$(tput setaf 1)| | ____ _______\/ |______ | | | | ___________ \r\n$(tput setaf 1)| |\/ \\ \/ ___\/\\ __\\__ \\ | | | | _\/ __ \\_ __ |\r\n$(tput setaf 1)| | | |\\___ \\ | | \/ __ \\| |_| |_\\ ___\/| | \\\/\r\n$(tput setaf 1)|___|___|__\/______> |__| (______|____|____\/\\___ |__| \r\n$(tput setaf 0)\r\n\"\r\n\r\necho \"\r\n$(tput setaf 2)This installer was created by $(tput setaf 1)Parkeymon#0001\r\n\"\r\n\r\n# Egg version checking, do not touch!\r\ncurrentVersion=\"2.1.3\"\r\nlatestVersion=$(curl --silent \"https:\/\/api.github.com\/repos\/Parkeymon\/EXILED-SCP-SL-egg\/releases\/latest\" | jq -r .tag_name)\r\n\r\nif [ \"${currentVersion}\" == \"${latestVersion}\" ]; then\r\n echo \"$(tput setaf 2)Installer is up to date\"\r\nelse\r\n\r\n echo \"\r\n $(tput setaf 1)THE INSTALLER IS NOT UP TO DATE!\r\n\r\n Current Version: $(tput setaf 1)${currentVersion}\r\n Latest: $(tput setaf 2)${latestVersion}\r\n\r\n $(tput setaf 3)Please update to the latest version found here: https:\/\/github.com\/Parkeymon\/EXILED-SCP-SL-egg\/releases\/latest\r\n\r\n \"\r\n sleep 10\r\nfi\r\n\r\n# Download SteamCMD and Install\r\ncd \/tmp || {\r\n echo \"$(tput setaf 1) FAILED TO MOUNT TO \/TMP\"\r\n exit\r\n}\r\nmkdir -p \/mnt\/server\/steamcmd\r\ncurl -sSL -o steamcmd.tar.gz https:\/\/steamcdn-a.akamaihd.net\/client\/installer\/steamcmd_linux.tar.gz\r\ntar -xzvf steamcmd.tar.gz -C \/mnt\/server\/steamcmd\r\ncd \/mnt\/server\/steamcmd || {\r\n echo \"$(tput setaf 1) FAILED TO MOUNT TO \/mnt\/server\/steamcmd\"\r\n exit\r\n}\r\n\r\n# SteamCMD fails otherwise for some reason, even running as root.\r\n# This is changed at the end of the install process anyways.\r\nchown -R root:root \/mnt\r\nexport HOME=\/mnt\/server\r\n\r\nif [ \"${BETA_TAG}\" == \"none\" ]; then\r\n .\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update \"${SRCDS_APPID}\" validate +quit\r\nelse\r\n .\/steamcmd.sh +login anonymous +force_install_dir \/mnt\/server +app_update \"${SRCDS_APPID}\" \"${BETA_TAG}\" validate +quit\r\nfi\r\n\r\n# Install SL with SteamCMD\r\ncd \/mnt\/server || {\r\n echo \"$(tput setaf 1) FAILED TO MOUNT TO \/mnt\/server\"\r\n exit\r\n}\r\n\r\necho \"$(tput setaf 4)Configuring start.sh$(tput setaf 0)\"\r\nrm start.sh\r\ntouch \"start.sh\"\r\nchmod +x .\/start.sh\r\n\r\nmkdir .egg\r\n\r\nif [ \"${INSTALL_BOT}\" == \"true\" ]; then\r\n echo \"#!\/bin\/bash\r\n node discordIntegration.js > \/dev\/null &\r\n .\/LocalAdmin \\${SERVER_PORT}\" >>start.sh\r\n echo \"$(tput setaf 4)Finished configuring start.sh for LocalAdmin and Discord Integration.$(tput setaf 0)\"\r\n\r\nelse\r\n echo \"#!\/bin\/bash\r\n .\/LocalAdmin \\${SERVER_PORT}\" >>start.sh\r\n echo \"$(tput setaf 4)Finished configuring start.sh for LocalAdmin.$(tput setaf 0)\"\r\n\r\nfi\r\n\r\nif [ \"${INSTALL_BOT}\" == \"true\" ]; then\r\n\r\n if [ \"${CONFIG_SAVER}\" == \"true\" ]; then\r\n echo \"$(tput setaf 4)Config Saver is $(tput setaf 2)ENABLED\"\r\n echo \"Making temporary directory\"\r\n mkdir BotConfigTemp\r\n echo \"Moving config.\"\r\n mv config.yml .\/BotConfigTemp\r\n fi\r\n\r\n echo \"$(tput setaf 4)Installing latest Discord Integration bot version.\"\r\n wget -q https:\/\/github.com\/Exiled-Team\/DiscordIntegration\/releases\/latest\/download\/DiscordIntegration.Bot.tar.gz\r\n tar xzvf DiscordIntegration.Bot.tar.gz\r\n rm DiscordIntegration.Bot.tar.gz\r\n\r\n if [ \"${CONFIG_SAVER}\" == \"true\" ]; then\r\n echo \"Deleting config\"\r\n rm config.yml\r\n echo \"Replacing Config\"\r\n mv .\/BotConfigTemp\/config.yml .\/\r\n echo \"Removing temporary directory\"\r\n rm -r BotConfigTemp\r\n echo \"$(tput setaf 4)Your configs have been saved!\"\r\n fi\r\n\r\n echo \"$(tput setaf 4)Updating Packages\"\r\n yarn install\r\n\r\nelse\r\n echo \"$(tput setaf 4)Skipping bot install...$(tput setaf 0)\"\r\nfi\r\n\r\nif [ \"${INSTALL_EXILED}\" == \"true\" ]; then\r\n echo \"$(tput setaf 4)Downloading $(tput setaf 1)EXILED$(tput setaf 0)..\"\r\n mkdir .config\/\r\n echo \"$(tput setaf 4)Downloading latest $(tput setaf 1)EXILED$(tput setaf 4) Installer\"\r\n rm Exiled.Installer-Linux\r\n wget -q https:\/\/github.com\/galaxy119\/EXILED\/releases\/latest\/download\/Exiled.Installer-Linux\r\n chmod +x .\/Exiled.Installer-Linux\r\n\r\n if [ \"${EXILED_PRE}\" == \"true\" ]; then\r\n echo \"$(tput setaf 4)Installing $(tput setaf 1)EXILED (pre-release)...\"\r\n .\/Exiled.Installer-Linux --pre-releases\r\n\r\n elif [ \"${EXILED_PRE}\" == \"false\" ]; then\r\n echo \"$(tput setaf 4)Installing $(tput setaf 1)EXILED$(tput setaf 0)...\"\r\n .\/Exiled.Installer-Linux\r\n\r\n else\r\n echo \"$(tput setaf 4)Installing $(tput setaf 1)EXILED$(tput setaf 0) version: ${EXILED_PRE} ..\"\r\n .\/Exiled.Installer-Linux --target-version \"${EXILED_PRE}\"\r\n\r\n fi\r\nelse\r\n echo \"Skipping Exiled installation.\"\r\nfi\r\n\r\nif [ \"${REMOVE_UPDATER}\" == \"true\" ]; then\r\n echo \"Removing Exiled updater.\"\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/Exiled.Updater.dll\r\nelse\r\n echo \"Skipping EXILED updater removal.\"\r\nfi\r\n\r\nif [ \"${INSTALL_INTEGRATION}\" == \"true\" ]; then\r\n echo \"Installing Latest Discord Integration Plugin...\"\r\n\r\n echo \"Removing old Discord Integration (if it exists)\"\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/DiscordIntegration_Plugin.dll\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/DiscordIntegration.dll\r\n\r\n echo \"$(tput setaf 5)Grabbing plugin and dependencies.\"\r\n wget -q https:\/\/github.com\/Exiled-Team\/DiscordIntegration\/releases\/latest\/download\/Plugin.tar.gz -P \/mnt\/server\/.config\/EXILED\/Plugins\r\n\r\n echo \"Extracting...\"\r\n tar xzvf \/mnt\/server\/.config\/EXILED\/Plugins\/Plugin.tar.gz\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/Plugin.tar.gz\r\n\r\nelse\r\n echo \"Skipping Discord integration plugin install\"\r\nfi\r\n\r\nif [ \"${INSTALL_ADMINTOOLS}\" == \"true\" ]; then\r\n echo \"Removing existing Admin Tools version.\"\r\n rm .config\/EXILED\/Plugins\/AdminTools.dll\r\n echo \"$(tput setaf 5)Installing latest Admin Tools\"\r\n wget -q https:\/\/github.com\/Exiled-Team\/AdminTools\/releases\/latest\/download\/AdminTools.dll -P \/mnt\/server\/.config\/EXILED\/Plugins\r\n\r\nelse\r\n echo \"Skipping Admin Tools install.\"\r\nfi\r\n\r\nif [ \"${INSTALL_UTILITIES}\" == \"true\" ]; then\r\n echo \"Removing existing Common Utilities version.\"\r\n rm .config\/EXILED\/Plugins\/Common_Utilities.dll\r\n echo \"$(tput setaf 5)Installing Common Utilities.\"\r\n wget -q https:\/\/github.com\/Exiled-Team\/Common-Utils\/releases\/latest\/download\/Common_Utilities.dll -P \/mnt\/server\/.config\/EXILED\/Plugins\r\nelse\r\n echo \"Skipping Common Utilities Install\"\r\nfi\r\n\r\nif [ \"${INSTALL_SCPSTATS}\" == \"true\" ]; then\r\n echo \"Removing existing SCPStats version.\"\r\n rm .config\/EXILED\/Plugins\/SCPStats.dll\r\n echo \"$(tput setaf 5)Installing SCPStats\"\r\n wget -q https:\/\/github.com\/SCPStats\/Plugin\/releases\/latest\/download\/SCPStats.dll -P \/mnt\/server\/.config\/EXILED\/Plugins\r\nelse\r\n echo \"Skipping SCPStats Install.\"\r\nfi\r\n\r\nfunction pluginInstall() {\r\n # Caches the plugin to a json so only one request to Github is needed\r\n\r\n curl --silent -u \"${GITHUB_USERNAME}:${GITHUB_TOKEN}\" \"$1\" | jq . > plugin.json\r\n\r\n if [ \"$(jq -r .assets[0].browser_download_url plugin.json)\" == null ]; then\r\n echo \"\r\n $(tput setaf 5)ERROR GETTING PLUGIN DOWNLOAD URL!\r\n\r\n Inputted URL: $1\r\n\r\n You likely inputted the incorrect URL or have been rate-limited ( https:\/\/takeb1nzyto.space\/ )\r\n \"\r\n\r\n fi\r\n\r\n echo \"$(tput setaf 5)Installing $(jq -r .assets[0].name plugin.json) $(jq -r .tag_name plugin.json) by $(jq -r .author.login plugin.json)\"\r\n\r\n # For the evil people that put the version in their plugin name the old version will need to be manually deleted\r\n rm \/mnt\/server\/.config\/EXILED\/Plugins\/\"$(jq -r .assets[0].name plugin.json)\"\r\n\r\n echo \"$(jq -r .assets[0].browser_download_url plugin.json)\r\n \"\r\n\r\n wget -q \"$(jq -r .assets[0].browser_download_url plugin.json)\" -P \/mnt\/server\/.config\/EXILED\/Plugins\r\n\r\n rm plugin.json\r\n}\r\n\r\nif [ \"${INSTALL_CUSTOM}\" == \"true\" ]; then\r\n touch \/mnt\/server\/.egg\/customplugins.txt\r\n\r\n grep -v '^ *#' <\/mnt\/server\/.egg\/customplugins.txt | while IFS= read -r I; do\r\n pluginInstall \"${I}\"\r\n done\r\n\r\nfi\r\n\r\nif [ \"${INSTALL_BOT}\" == \"true\" ]; then\r\n echo \"Dont forget to configure the discord bot in \/home\/container\/config.yml\"\r\nfi\r\n\r\necho \"$(tput setaf 2)Installation Complete!$(tput sgr 0)\"\r\n\r\n##TODO - using git to sync configs with github\r\n\r\n##TODO - Append plugin version to file name so they dont reinstall when they dont need to be?", "container": "quay.io\/parkeymon\/scpsl-install:latest", "entrypoint": "bash" } @@ -138,12 +138,30 @@ }, { "name": "Auto install custom plugins?", - "description": "Automatically install user inputted plugins located in .egg/customplugins.txt. More usage info here: https://github.com/Parkeymon/EXILED-SCP-SL-egg", + "description": "", "env_variable": "INSTALL_CUSTOM", "default_value": "true", "user_viewable": true, "user_editable": true, "rules": "required|string|max:5" + }, + { + "name": "GitHub Username", + "description": "This is used to authenticate GitHub requests so you aren't rate-limited.\r\nYou do not need to use this unless you are using custom plugin install and have enough plugins to where you could make more than 60 requests in an hour.\r\nSee here for more info: https:\/\/github.com\/Parkeymon\/EXILED-SCP-SL-egg", + "env_variable": "GITHUB_USERNAME", + "default_value": "none", + "user_viewable": true, + "user_editable": true, + "rules": "required|string|max:100" + }, + { + "name": "GitHub Access Token", + "description": "This is used to authenticate GitHub requests so you aren't rate-limited.\r\nYou do not need to use this unless you are using custom plugin install and have enough plugins to where you could make more than 60 requests in an hour.\r\nSee here for more info: https:\/\/github.com\/Parkeymon\/EXILED-SCP-SL-egg", + "env_variable": "GITHUB_TOKEN", + "default_value": "none", + "user_viewable": true, + "user_editable": true, + "rules": "required|string|max:100" } ] } \ No newline at end of file diff --git a/script.sh b/script.sh index adde7fa..cd5967c 100644 --- a/script.sh +++ b/script.sh @@ -22,7 +22,7 @@ $(tput setaf 2)This installer was created by $(tput setaf 1)Parkeymon#0001 " # Egg version checking, do not touch! -currentVersion="2.1.1" +currentVersion="2.1.3" latestVersion=$(curl --silent "https://api.github.com/repos/Parkeymon/EXILED-SCP-SL-egg/releases/latest" | jq -r .tag_name) if [ "${currentVersion}" == "${latestVersion}" ]; then @@ -204,7 +204,18 @@ fi function pluginInstall() { # Caches the plugin to a json so only one request to Github is needed - curl --silent "$1" | jq . > plugin.json + curl --silent -u "${GITHUB_USERNAME}:${GITHUB_TOKEN}" "$1" | jq . > plugin.json + + if [ "$(jq -r .assets[0].browser_download_url plugin.json)" == null ]; then + echo " + $(tput setaf 5)ERROR GETTING PLUGIN DOWNLOAD URL! + + Inputted URL: $1 + + You likely inputted the incorrect URL or have been rate-limited ( https://takeb1nzyto.space/ ) + " + + fi echo "$(tput setaf 5)Installing $(jq -r .assets[0].name plugin.json) $(jq -r .tag_name plugin.json) by $(jq -r .author.login plugin.json)"