project specific static resources

This commit is contained in:
Andy Pack 2023-09-07 18:03:22 +01:00
parent d54b8317c9
commit 01d8715c2f
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
5 changed files with 22 additions and 20 deletions

View File

@ -5,7 +5,7 @@ from music.model.config import Config
from music.auth.jwt_keys import generate_key
from music.api.decorators import no_cache
from music.notif.notifier import notify_admin_new_user
from music.magic_strings import SPOT_CLIENT_URI, SPOT_SECRET_URI
from music.magic_strings import SPOT_CLIENT_URI, SPOT_SECRET_URI, STATIC_BUCKET
from urllib.parse import urlencode, urlunparse
import datetime
@ -135,7 +135,7 @@ def register():
return redirect(url_for('index'))
if request.method == 'GET':
return render_template('register.html')
return render_template('register.html', bucket=STATIC_BUCKET)
else:
api_user = False

View File

@ -7,3 +7,5 @@ LASTFM_CLIENT_URI = f"projects/{project_id}/secrets/lastfm-client/versions/lates
JWT_SECRET_URI = f"projects/{project_id}/secrets/jwt-secret/versions/latest"
COOKIE_SECRET_URI = f"projects/{project_id}/secrets/cookie-secret/versions/latest"
APNS_SIGN_URI = f"projects/{project_id}/secrets/apns-auth-sign-key/versions/1"
STATIC_BUCKET = f'{project_id}-static'

View File

@ -7,7 +7,7 @@ import os
from music.auth import auth_blueprint
from music.api import api_blueprint, player_blueprint, fm_blueprint, \
spotfm_blueprint, spotify_blueprint, admin_blueprint, tag_blueprint
from music.magic_strings import COOKIE_SECRET_URI
from music.magic_strings import COOKIE_SECRET_URI, STATIC_BUCKET
logger = logging.getLogger(__name__)
secret_client = secretmanager.SecretManagerServiceClient()
@ -42,11 +42,11 @@ def create_app():
else:
logged_in = False
return render_template('login.html', logged_in=logged_in)
return render_template('login.html', logged_in=logged_in, bucket=STATIC_BUCKET)
@app.route('/privacy')
def privacy():
return render_template('privacy.html')
return render_template('privacy.html', bucket=STATIC_BUCKET)
@app.route('/app', defaults={'path': ''})
@app.route('/app/<path:path>')
@ -56,7 +56,7 @@ def create_app():
flash('please log in')
return redirect(url_for('index'))
return render_template('app.html')
return render_template('app.html', bucket=STATIC_BUCKET)
return app

View File

@ -6,12 +6,12 @@
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<link href="https://fonts.googleapis.com/css?family=Pirata+One|Lato" rel="stylesheet">
<link rel="apple-touch-icon" sizes="180x180" href="https://storage.googleapis.com/sarsooxyzstatic/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://storage.googleapis.com/sarsooxyzstatic/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://storage.googleapis.com/sarsooxyzstatic/favicon-16x16.png">
<link rel="manifest" href="https://storage.googleapis.com/sarsooxyzstatic/site.webmanifest">
<link rel="mask-icon" href="https://storage.googleapis.com/sarsooxyzstatic/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://storage.googleapis.com/sarsooxyzstatic/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="https://storage.googleapis.com/{{ bucket }}/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://storage.googleapis.com/{{ bucket }}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://storage.googleapis.com/{{ bucket }}/favicon-16x16.png">
<link rel="manifest" href="https://storage.googleapis.com/{{ bucket }}/site.webmanifest">
<link rel="mask-icon" href="https://storage.googleapis.com/{{ bucket }}/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://storage.googleapis.com/{{ bucket }}/favicon.ico">
</head>
<body>
@ -37,7 +37,7 @@
<div style="text-align: center">
<a href="https://sarsoo.xyz/about/" style="display: inline-block">
<img src="https://storage.googleapis.com/sarsooxyzstatic/andy.png"
<img src="https://storage.googleapis.com/{{ bucket }}/andy.png"
alt="AP"
width="120px"
style="display: block;

View File

@ -7,12 +7,12 @@
<link href="https://fonts.googleapis.com/css?family=Pirata+One|Roboto" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<link rel="apple-touch-icon" sizes="180x180" href="https://storage.googleapis.com/sarsooxyzstatic/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://storage.googleapis.com/sarsooxyzstatic/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://storage.googleapis.com/sarsooxyzstatic/favicon-16x16.png">
<link rel="manifest" href="https://storage.googleapis.com/sarsooxyzstatic/site.webmanifest">
<link rel="mask-icon" href="https://storage.googleapis.com/sarsooxyzstatic/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://storage.googleapis.com/sarsooxyzstatic/favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="https://storage.googleapis.com/{{ bucket }}/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="https://storage.googleapis.com/{{ bucket }}/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="https://storage.googleapis.com/{{ bucket }}/favicon-16x16.png">
<link rel="manifest" href="https://storage.googleapis.com/{{ bucket }}/site.webmanifest">
<link rel="mask-icon" href="https://storage.googleapis.com/{{ bucket }}/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="https://storage.googleapis.com/{{ bucket }}/favicon.ico">
{% block scripts %}{% endblock %}
@ -33,7 +33,7 @@
{% block content %}{% endblock %}
<div style="text-align: center">
<a href="https://sarsoo.xyz/about/" style="display: inline-block">
<img src="https://storage.googleapis.com/sarsooxyzstatic/andy.png"
<img src="https://storage.googleapis.com/{{ bucket }}/andy.png"
alt="AP"
width="120px"
style="display: block;