mirror of
https://git.notfire.cc/notfire/akkoma-fe.git
synced 2026-01-11 13:33:24 -08:00
add script to download ruffle for flash support
This commit is contained in:
parent
295f3907e6
commit
a90430f72f
3 changed files with 47 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -10,3 +10,5 @@ config/local.json
|
||||||
config/local.*.json
|
config/local.*.json
|
||||||
docs/site/
|
docs/site/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
tools/.venv/
|
||||||
|
static/ruffle/
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
- script to get new emojis is included for future unicode versions
|
- script to get new emojis is included for future unicode versions
|
||||||
- add toggle for showing post edit notifications
|
- add toggle for showing post edit notifications
|
||||||
- add support for accepted follow request notifications
|
- add support for accepted follow request notifications
|
||||||
|
- add a script to download ruffle for flash support (requires python3 and requests library)
|
||||||
|
- download by entering `tools/` and running `python3 download_ruffle.py`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
42
tools/download_ruffle.py
Normal file
42
tools/download_ruffle.py
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
import requests, json, zipfile, os, glob
|
||||||
|
|
||||||
|
if os.path.isdir("../static/ruffle/"):
|
||||||
|
print("Flash is already downloaded, clearing old directory and updating...")
|
||||||
|
rm = glob.glob("../static/ruffle/*")
|
||||||
|
for x in rm:
|
||||||
|
os.remove(x)
|
||||||
|
else:
|
||||||
|
print("Flash is not downloaded yet, creating directory...")
|
||||||
|
os.mkdir("../static/ruffle/")
|
||||||
|
|
||||||
|
releases = requests.get("https://api.github.com/repos/ruffle-rs/ruffle/releases?per_page=1")
|
||||||
|
releasesJsonified = json.loads(releases.text)
|
||||||
|
|
||||||
|
for asset in releasesJsonified[0]["assets"]:
|
||||||
|
if "web-selfhosted" in asset["browser_download_url"]:
|
||||||
|
newFlashFiles = requests.get(asset["browser_download_url"])
|
||||||
|
flashDumped = open("flash.zip", "wb+")
|
||||||
|
flashDumped.write(newFlashFiles.content)
|
||||||
|
|
||||||
|
flashZip = zipfile.ZipFile("flash.zip", "r")
|
||||||
|
flashZip.extractall("../static/ruffle/")
|
||||||
|
|
||||||
|
rmglob = glob.glob("../static/ruffle/*.map")
|
||||||
|
rm = ["../static/ruffle/README.md",
|
||||||
|
"../static/ruffle/LICENSE_MIT",
|
||||||
|
"../static/ruffle/LICENSE_APACHE",
|
||||||
|
"../static/ruffle/package.json"]
|
||||||
|
for item in rmglob:
|
||||||
|
rm.append(item)
|
||||||
|
|
||||||
|
for item in rm:
|
||||||
|
os.remove(item)
|
||||||
|
|
||||||
|
flashZip.close()
|
||||||
|
|
||||||
|
os.remove("flash.zip")
|
||||||
|
|
||||||
|
print("Flash was successfully downloaded and extracted")
|
||||||
|
exit()
|
||||||
|
|
||||||
|
print("Flash not found, download it manually at https://github.com/ruffle-rs/ruffle/releases")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue