✨ cache bootstrap components
This commit is contained in:
parent
d769f9f31f
commit
040fd333e2
2 changed files with 28 additions and 5 deletions
30
src/index.py
30
src/index.py
|
@ -9,19 +9,39 @@ import gnupg
|
||||||
|
|
||||||
main_pages = Blueprint("main", __name__)
|
main_pages = Blueprint("main", __name__)
|
||||||
|
|
||||||
|
|
||||||
|
def download_file(url, file):
|
||||||
|
os.makedirs("/app/static/", exist_ok=True)
|
||||||
|
r = requests.get(url, allow_redirects=True)
|
||||||
|
open(file, "wb").write(r.content)
|
||||||
|
|
||||||
|
|
||||||
|
def cache_bootstrap():
|
||||||
|
download_file(
|
||||||
|
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css",
|
||||||
|
"/app/static/bootstrap.min.css",
|
||||||
|
)
|
||||||
|
download_file(
|
||||||
|
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css",
|
||||||
|
"/app/static/bootstrap-icons.css",
|
||||||
|
)
|
||||||
|
download_file(
|
||||||
|
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js",
|
||||||
|
"/app/static/bootstrap.bundle.min.js",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# Bootstrap CSS
|
# Bootstrap CSS
|
||||||
BOOTSTRAP = [
|
BOOTSTRAP = [
|
||||||
Reference(
|
Reference(
|
||||||
"https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css",
|
"/static/bootstrap.min.css",
|
||||||
"stylesheet",
|
"stylesheet",
|
||||||
),
|
),
|
||||||
Reference(
|
Reference(
|
||||||
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css",
|
"/static/bootstrap-icons.css",
|
||||||
"stylesheet",
|
"stylesheet",
|
||||||
),
|
),
|
||||||
Script(
|
Script(src="/static/bootstrap.bundle.min.js"),
|
||||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/js/bootstrap.bundle.min.js"
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Encrypt msg with GPG
|
# Encrypt msg with GPG
|
||||||
|
|
|
@ -12,4 +12,7 @@ app.register_blueprint(asset_pages, url_prefix="/assets")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
from index import cache_bootstrap
|
||||||
|
|
||||||
|
cache_bootstrap()
|
||||||
app.run(host="0.0.0.0", port=1030, debug=True, threaded=True)
|
app.run(host="0.0.0.0", port=1030, debug=True, threaded=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue