-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhub_patcher.py
More file actions
57 lines (46 loc) · 1.7 KB
/
hub_patcher.py
File metadata and controls
57 lines (46 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import subprocess
import os
import sys
import fileinput
import shutil
css = """<style>
/* cloud services column header */
.pl-header__column.pl-header__column--cloudServices {display:none !important;}
/* version control column header */
.pl-header__columns-wrapper > :nth-child(2) {display: none !important;}
/* version control column value */
.pl-item__row [role='presentation'] {display: none !important;}
/* cloud services column value */
.pl-item__row :nth-child(4) {display: none !important;}
</style>
"""
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]
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 "<body>" in line:
line=line.replace(line,line + css)
print(line, end="")
print("Done! All patched!")