From 20a5689d5854527576aff15b6c055f689130bf9d Mon Sep 17 00:00:00 2001 From: mickoissicko Date: Thu, 25 Jan 2024 15:23:12 +0100 Subject: [PATCH] fixed script new instructions new launcher arch-linux launcher script start script token.txt file does nothing atm does nothing atm --- archlinux/install.sh | 5 +--- instructions.txt | 3 +++ launcher.py | 37 +++++++++++++++++++++++++++ setup/arch.py | 59 ++++++++++++++++++++++++++++++++++++++++++++ setup/start.sh | 7 ++++++ setup/token.txt | 0 setup/win.py | 1 + windows/run.bat | 0 8 files changed, 108 insertions(+), 4 deletions(-) mode change 100644 => 100755 archlinux/install.sh create mode 100644 instructions.txt create mode 100644 launcher.py create mode 100644 setup/arch.py create mode 100644 setup/start.sh create mode 100644 setup/token.txt create mode 100644 setup/win.py create mode 100644 windows/run.bat diff --git a/archlinux/install.sh b/archlinux/install.sh old mode 100644 new mode 100755 index 9a72217..51a0a71 --- a/archlinux/install.sh +++ b/archlinux/install.sh @@ -11,7 +11,4 @@ makepkg -si cd script/ git clone https://aur.archlinux.org/mcrcon.git cd mcrcon -makepkg -si - -cd .. -sudo python ussr-ssl.py \ No newline at end of file +makepkg -si \ No newline at end of file diff --git a/instructions.txt b/instructions.txt new file mode 100644 index 0000000..1e078c9 --- /dev/null +++ b/instructions.txt @@ -0,0 +1,3 @@ +|| Installing it is super simple now! +|| Just read the docs @ mick.gdn/wiki/ussr.html +|| Only change the paths, and when you are done, run the launcher.py file! >:) diff --git a/launcher.py b/launcher.py new file mode 100644 index 0000000..a76063d --- /dev/null +++ b/launcher.py @@ -0,0 +1,37 @@ +# !launcher.py + +import os + +def setup_dependencies(): + choice = input("Do you have the dependencies set up already? [y/n] ") + if choice.lower() == 'n': + os.chdir('archlinux/') + os.system('chmod +x install.sh') + os.system('./install.sh') + os.chdir('..') + +def ussr_for_arch(): + os.system('python setup/arch.py') + +def ussr_for_win(): + os.system('python setup/win.py') + +def main_menu(): + print("[1] Dependency setup") + print("[2] USSR for Arch") + print("[3] USSR for Windows") + print("\nChoice: ") + +if __name__ == "__main__": + while True: + main_menu() + choice = input() + + if choice == '1': + setup_dependencies() + elif choice == '2': + ussr_for_arch() + elif choice == '3': + ussr_for_win() + else: + print("Invalid choice. Please choose again.") diff --git a/setup/arch.py b/setup/arch.py new file mode 100644 index 0000000..a9555f9 --- /dev/null +++ b/setup/arch.py @@ -0,0 +1,59 @@ +# setup/arch.py + +import os +import webbrowser + +def main_menu(): + print("[1] Launch USSR") + print("[2] Use Ngrok") + +def launch_ussr(): + os.chdir('setup/') + + if os.path.exists("token.txt"): + with open("token.txt", "r") as file: + autk = file.read().strip() + print("Did you place the wrong copy-paste of the authentication token? [y/n]") + wrong_token = input("Your answer: ").lower() + + if wrong_token == "y": + os.remove("token.txt") + print("Token deleted. Please enter your Ngrok authentication token again.") + webbrowser.open("https://dashboard.ngrok.com/get-started/your-authtoken") + autk = input("Your NGROK token: ") + + with open("token.txt", "w") as file: + file.write(autk) + elif wrong_token == "n": + pass + else: + print("Invalid input. Assuming 'n'. Proceeding...") + else: + print("Enter your Ngrok authentication token:") + webbrowser.open("https://dashboard.ngrok.com/get-started/your-authtoken") + autk = input("Your NGROK token: ") + + with open("token.txt", "w") as file: + file.write(autk) + + os.system(f"ngrok config add-authtoken {autk}") + + print("Starting the .sh script...") + os.system("bash start.sh") + + +if __name__ == "__main__": + + while True: + main_menu() + choice = input("Enter your choice: ") + + if choice == "1": + launch_ussr() + break + elif choice == "2": + print("Ngrok functionality not implemented yet.") + break + else: + print("Invalid choice. Please enter 1 or 2.") + diff --git a/setup/start.sh b/setup/start.sh new file mode 100644 index 0000000..c6a75bd --- /dev/null +++ b/setup/start.sh @@ -0,0 +1,7 @@ +# !/bin/bash + +cd .. +cd archlinux +cd server-arch + +sudo python ussr-ssl.py diff --git a/setup/token.txt b/setup/token.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup/win.py b/setup/win.py new file mode 100644 index 0000000..5d4cf03 --- /dev/null +++ b/setup/win.py @@ -0,0 +1 @@ +# setup/win.py diff --git a/windows/run.bat b/windows/run.bat new file mode 100644 index 0000000..e69de29