forked from TurboWarp/mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch.py
21 lines (18 loc) · 773 Bytes
/
patch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import glob
import shutil
for path in glob.glob('scratch-gui/build/*.html'):
with open(path, 'r') as fr:
print(f"Patching HTML {path}")
contents = fr.read()
contents = contents.replace('</head>', '<meta name="robots" content="noindex"></head>')
contents = contents.replace('<link rel="manifest" href="manifest.webmanifest">', '')
with open(path, 'w') as fw:
fw.write(contents)
os.remove('scratch-gui/build/sw.js')
os.remove('scratch-gui/build/manifest.webmanifest')
os.remove('scratch-gui/build/fullscreen.html')
os.remove('scratch-gui/build/embed.html')
os.remove('scratch-gui/build/index.html')
shutil.copy('scratch-gui/build/editor.html', 'scratch-gui/build/index.html')
shutil.copy('robots.txt', 'scratch-gui/build/robots.txt')