extend customisation of app
This commit is contained in:
parent
8ac541f597
commit
7f54aba4af
24
app.py
24
app.py
@ -21,17 +21,17 @@ import auth
|
|||||||
import analytics as a
|
import analytics as a
|
||||||
|
|
||||||
with open("app_config.json", 'r') as file:
|
with open("app_config.json", 'r') as file:
|
||||||
config = json.load(file)
|
app_config = json.load(file)
|
||||||
|
|
||||||
cache_audio = diskcache.Cache('./filecache_audio', size_limit= config['filecache_size_limit_audio'] * 1024**3)
|
cache_audio = diskcache.Cache('./filecache_audio', size_limit= app_config['filecache_size_limit_audio'] * 1024**3)
|
||||||
cache_image = diskcache.Cache('./filecache_image', size_limit= config['filecache_size_limit_image'] * 1024**3)
|
cache_image = diskcache.Cache('./filecache_image', size_limit= app_config['filecache_size_limit_image'] * 1024**3)
|
||||||
cache_video = diskcache.Cache('./filecache_video', size_limit= config['filecache_size_limit_video'] * 1024**3)
|
cache_video = diskcache.Cache('./filecache_video', size_limit= app_config['filecache_size_limit_video'] * 1024**3)
|
||||||
cache_other = diskcache.Cache('./filecache_other', size_limit= config['filecache_size_limit_other'] * 1024**3)
|
cache_other = diskcache.Cache('./filecache_other', size_limit= app_config['filecache_size_limit_other'] * 1024**3)
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1)
|
app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1)
|
||||||
|
|
||||||
app.config['SECRET_KEY'] = config['SECRET_KEY']
|
app.config['SECRET_KEY'] = app_config['SECRET_KEY']
|
||||||
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=90)
|
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=90)
|
||||||
if os.environ.get('FLASK_ENV') == 'production':
|
if os.environ.get('FLASK_ENV') == 'production':
|
||||||
app.config['SESSION_COOKIE_SAMESITE'] = 'None'
|
app.config['SESSION_COOKIE_SAMESITE'] = 'None'
|
||||||
@ -464,12 +464,12 @@ def handle_request_initial_data():
|
|||||||
@app.route('/<path:path>')
|
@app.route('/<path:path>')
|
||||||
@auth.require_secret
|
@auth.require_secret
|
||||||
def index(path):
|
def index(path):
|
||||||
title_short = config.get('TITLE_SHORT', 'Default Title')
|
title_short = app_config.get('TITLE_SHORT', 'Default Title')
|
||||||
title_long = config.get('TITLE_LONG' , 'Default Title')
|
title_long = app_config.get('TITLE_LONG' , 'Default Title')
|
||||||
header_color = config.get('header_color' , '#000')
|
header_color = app_config.get('header_color' , '#000')
|
||||||
header_text_color = config.get('header_text_color', '#fff')
|
header_text_color = app_config.get('header_text_color', '#fff')
|
||||||
background_color = config.get('background_color', '#fff')
|
background_color = app_config.get('background_color', '#fff')
|
||||||
main_text_color = config.get('main_text_color', '#000')
|
main_text_color = app_config.get('main_text_color', '#000')
|
||||||
return render_template("app.html",
|
return render_template("app.html",
|
||||||
title_short=title_short,
|
title_short=title_short,
|
||||||
title_long=title_long,
|
title_long=title_long,
|
||||||
|
|||||||
19
auth.py
19
auth.py
@ -9,6 +9,9 @@ import base64
|
|||||||
|
|
||||||
folder_config = {}
|
folder_config = {}
|
||||||
|
|
||||||
|
with open("app_config.json", 'r') as file:
|
||||||
|
app_config = json.load(file)
|
||||||
|
|
||||||
def require_secret(f):
|
def require_secret(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def decorated_function(*args, **kwargs):
|
def decorated_function(*args, **kwargs):
|
||||||
@ -79,8 +82,20 @@ def require_secret(f):
|
|||||||
session['device_id'] = os.urandom(32).hex()
|
session['device_id'] = os.urandom(32).hex()
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return render_template('index.html')
|
title_short = app_config.get('TITLE_SHORT', 'Default Title')
|
||||||
|
title_long = app_config.get('TITLE_LONG' , 'Default Title')
|
||||||
|
header_color = app_config.get('header_color' , '#000')
|
||||||
|
header_text_color = app_config.get('header_text_color', '#fff')
|
||||||
|
background_color = app_config.get('background_color', '#fff')
|
||||||
|
main_text_color = app_config.get('main_text_color', '#000')
|
||||||
|
return render_template('index.html',
|
||||||
|
title_short=title_short,
|
||||||
|
title_long=title_long,
|
||||||
|
header_color=header_color,
|
||||||
|
header_text_color=header_text_color,
|
||||||
|
main_text_color=main_text_color,
|
||||||
|
background_color=background_color,
|
||||||
|
)
|
||||||
return decorated_function
|
return decorated_function
|
||||||
|
|
||||||
@require_secret
|
@require_secret
|
||||||
|
|||||||
@ -3,15 +3,14 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<meta property="og:title" content="Gottesdienste Speyer und Schwegenheim" />
|
<meta property="og:title" content="{{ title_long }}" />
|
||||||
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
||||||
<meta property="og:image" content="https://app.bethaus-speyer.de/icon/logo-200x200.png" />
|
<meta property="og:image" content="/icon/logo-200x200.png" />
|
||||||
<meta property="og:url" content="https://app.bethaus-speyer.de" />
|
|
||||||
|
|
||||||
<title>{{ title_short }}</title>
|
<title>{{ title_short }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<meta name="description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft.">
|
<meta name="description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft.">
|
||||||
<meta name="author" content="Bethaus Speyer">
|
<meta name="author" content="{{ title_short }}">
|
||||||
<link rel="icon" href="/icon/logo-192x192.png" type="image/png" sizes="192x192">
|
<link rel="icon" href="/icon/logo-192x192.png" type="image/png" sizes="192x192">
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,25 +3,33 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<meta property="og:title" content="Gottesdienste Speyer und Schwegenheim" />
|
<meta property="og:title" content="{{ title_long }}" />
|
||||||
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
||||||
<meta property="og:image" content="https://app.bethaus-speyer.de/icon/logo-300x300.png" />
|
<meta property="og:image" content="/icon/logo-300x300.png" />
|
||||||
<meta property="og:url" content="https://app.bethaus-speyer.de" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
|
|
||||||
<title>Gottesdienste Speyer und Schwegenheim</title>
|
<title>{{ title_long }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='app.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='app.css') }}">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: {{ background_color }};
|
||||||
|
color: {{ main_text_color }};
|
||||||
|
}
|
||||||
|
.site-header {
|
||||||
|
background-color: {{ header_color }};
|
||||||
|
color: {{ header_text_color }};
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<img src="https://app.bethaus-speyer.de/icon/logo-300x300.png" alt="Logo" class="logo">
|
<img src="/icon/logo-300x300.png" alt="Logo" class="logo">
|
||||||
<h1>Gottesdienste Speyer und Schwegenheim</h1>
|
<h1>{{ title_long }}</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="content">Etwas ist schief gelaufen. Entweder ein Link ist veraltet oder die App ist gerade gestört.<br>Versuche den Link aus der Telegram-Gruppe erneut anklicken um dies zu beheben.</div>
|
<div id="content">Etwas ist schief gelaufen. Entweder ein Link ist veraltet oder die App ist gerade gestört.<br>Versuche den Freigabelink erneut anzuklicken.</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -3,25 +3,33 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<meta property="og:title" content="Gottesdienste Speyer und Schwegenheim" />
|
<meta property="og:title" content="{{ title_long }}" />
|
||||||
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
<meta property="og:description" content="... uns aber, die wir gerettet werden, ist es eine Gotteskraft." />
|
||||||
<meta property="og:image" content="https://app.bethaus-speyer.de/icon/logo-300x300.png" />
|
<meta property="og:image" content="/icon/logo-300x300.png" />
|
||||||
<meta property="og:url" content="https://app.bethaus-speyer.de" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
|
|
||||||
<title>Gottesdienste Speyer und Schwegenheim</title>
|
<title>{{ title_long }}</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='app.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='app.css') }}">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: {{ background_color }};
|
||||||
|
color: {{ main_text_color }};
|
||||||
|
}
|
||||||
|
.site-header {
|
||||||
|
background-color: {{ header_color }};
|
||||||
|
color: {{ header_text_color }};
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="site-header">
|
<header class="site-header">
|
||||||
<img src="https://app.bethaus-speyer.de/icon/logo-300x300.png" alt="Logo" class="logo">
|
<img src="/icon/logo-300x300.png" alt="Logo" class="logo">
|
||||||
<h1>Gottesdienste Speyer und Schwegenheim</h1>
|
<h1>{{ title_long }}</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="content">Du hast keine gültigen Links im Speicher.<br>Bitte den Link aus der Telegram-Gruppe erneut anklicken.</div>
|
<div id="content">Du hast keine Links die noch gültig sind.<br>Bitte den Freigabelink erneut anklicken.</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user