Added offline service worker (serves a static webpage when no internet connection is present) (#285)

based
master
HappyDOGE 2022-05-27 22:23:01 +03:00 committed by GitHub
parent 07095e9737
commit d6b4c3b166
9 changed files with 12 additions and 8 deletions

View File

@ -555,6 +555,10 @@ def formatting(v):
def serviceworker():
with open("files/assets/js/service-worker.js", "r", encoding="utf-8") as f: return Response(f.read(), mimetype='application/javascript')
@app.get("/offline-service-worker.js")
def offlineserviceworker():
with open("files/assets/js/offline-service-worker.js", "r", encoding="utf-8") as f: return Response(f.read(), mimetype='application/javascript')
@app.get("/settings/security")
@auth_required
def settings_security(v):

View File

@ -106,7 +106,7 @@
</head>
<body>
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
{% include "header.html" %}

View File

@ -10,7 +10,7 @@
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
{% endif %}
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="{{asset('css/main.css')}}">

View File

@ -6,7 +6,7 @@
<meta name="description" content="{{config('DESCRIPTION')}}">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

View File

@ -5,7 +5,7 @@
<meta name="description" content="{{config('DESCRIPTION')}}">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

View File

@ -6,7 +6,7 @@
<meta name="description" content="{{config('DESCRIPTION')}}">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

View File

@ -5,7 +5,7 @@
<meta name="description" content="{{config('DESCRIPTION')}}">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

View File

@ -6,7 +6,7 @@
<meta name="description" content="{{config('DESCRIPTION')}}">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

View File

@ -5,7 +5,7 @@
<meta name="description" content="{{config('DESCRIPTION')}}">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'; connect-src 'self'; object-src 'none';">
<script src="/assets/js/bootstrap.js?v=252"></script>
<script src="/assets/js/bootstrap.js?v=253"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">