diff --git a/hub_patcher.py b/hub_patcher.py index 1060ff5..1777ace 100644 --- a/hub_patcher.py +++ b/hub_patcher.py @@ -2,238 +2,56 @@ import os import sys import fileinput +import shutil css = """ """ -if len(sys.argv) == 2: +print(":::::[ HubPatcher ]:::::") +print("must run as an Administrator!") + +if len(sys.argv) == 1: + path = "C:/Program Files/Unity Hub/" +elif len(sys.argv) == 2: path = sys.argv[1] - os.chdir(os.path.join(path, "resources")) - print("Extracting app...") - subprocess.run("npx asar extract app.asar app", shell=True) - print("Backing up...") - os.rename("app.asar", "app.asar.bak") - os.chdir("app\client\dist") - - print("Patching...") - for line in fileinput.FileInput("index.html", inplace=1): - if "" in line: - line=line.replace(line,css + line) - print(line, end="") - - print("Done! It's dark now. :D") +else: + print("Usage: python script.py [path]") + sys.exit(1) + +if not os.path.exists(path): + print(f"The specified path '{path}' does not exist.") + sys.exit(1) + +app_asar_path = os.path.join(path, "resources", "app.asar") +if not os.path.isfile(app_asar_path): + print(f"The 'app.asar' file does not exist in the specified path '{app_asar_path}'.") + print("This is because you have already patched the hub! You can find unpacked resources inside Unity Hub/resources/app/ folder, and you can modify them there") + sys.exit(1) + +print(path) +os.chdir(os.path.join(path, "resources")) +print("Extracting app..") +subprocess.run("npx asar extract app.asar app", shell=True) +print("Backing up...") +shutil.move("app.asar", "app.asar.bak") +os.chdir(os.path.join("app", "build", "renderer")) + +print("Patching...") +for line in fileinput.FileInput("index.html", inplace=1): + if "" in line: + line=line.replace(line,line + css) + print(line, end="") + +print("Done! All patched!") diff --git a/icon.png b/icon.png deleted file mode 100644 index 98af767..0000000 Binary files a/icon.png and /dev/null differ diff --git a/readme.md b/readme.md index 2d84236..71163c5 100644 --- a/readme.md +++ b/readme.md @@ -1,26 +1,31 @@ -# Hub Patcher +### Info +Patch Hub 3.6.0 to hide unwanted columns: +https://unitycoder.com/blog/2023/10/29/unityhub-3-6-0-remove-version-control-cloud-dashboard-columns/ -Patches Unity Hub with a custom dark theme. +See also other Unity Hub modifications here: +https://github.com/unitycoder/UnityHubModding -## Getting Started +### Usage +- start commandprompt as admin +- type: python hub_patcher.py +- optionally you can give hub root folder: python hub_patcher.py c:\Program Files\Unity Hub\ -Simply run hub_patcher.py with the path to your Unity Hub installation as the first arguement. You may have to run as administrator depending on where it is installed. +### How it works +- it unpacks app.asar file into C:\Program Files\Unity Hub\resources\app\ +- app.asar is renamed as app.asar.bak +- next time hub runs, it uses the unpacked "app\" folder, instead of "app.asar" +- so you can modify anything inside app\ folder, this script modifies app\build\renderer\index.html template to add custom CSS styles (for hiding those columns) -Ex: `python hub_patcher.py "D:/Program Files/Unity Hub"` +### Cloned from other site and modified here +https://gitlab.com/GuitarBro/hub-patcher -Note that Hub Patcher has only been tested on Windows 10. OS X and Linux may or may not work. +### Warning +- For educational use only! +- if you mess up the templates, reinstall hub (better if you take backup of original app.asar, so you can always deleted modified or unpacked files) -### Prerequisites +### Images +before
+![image](https://github.com/unitycoder/UnityHubPatcher/assets/5438317/9461925c-6513-4faa-b8f8-e61eeefa01f8) -* Node Package Manager (NPM) -* Python 3.5+ -* Unity Hub 2.3.x - -## License - -This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details - -## Acknowledgments - -* Unity for creating Unity Hub -* Electron team for making packaged Electron apps easy to reverse engineer +after
+![hub2023-10-29 13-07-52](https://github.com/unitycoder/UnityHubPatcher/assets/5438317/03d08762-1e20-4b63-a5ba-a5aa4a8816a3)