webmanifest

This commit is contained in:
coulisse 2023-01-28 19:02:30 +01:00
parent 696f4c08ea
commit 57f3d4b095
12 changed files with 136 additions and 132 deletions

View File

@ -8,11 +8,11 @@ path_static='../static'
path_static_html=${path_static}'/html'
path_static_js=${path_static}'/js'
path_static_css=${path_static}'/css'
path_static_pwa=${path_static}'/pwa'
path_cfg='../cfg'
app_ini=${path_cfg}'/webapp_log_config.ini'
path_docs='../docs'
readme='../README.md'
manifest=${path_static}'/manifest.webmanifest'
changelog=${path_docs}'/'CHANGELOG.md
html_change_references(){
@ -31,7 +31,8 @@ html_change_references(){
if ! sed -i '/static\/css\/dev/s/\.css/\.min\.css/;s/static\/css\/dev/static\/css\/rel/g' ${i}; then
echo 'ERROR replacing .css to .min.css '
exit 6
fi
fi
elif [ "${1}" == "-d" ]; then
# concatenating 2 sed command with ";"
# 1) if found static/js/rel/ replace .min.js with .js
@ -44,7 +45,8 @@ html_change_references(){
if ! sed -i '/static\/css\/rel/s/\.min\.css/\.css/;s/static\/css\/rel/static\/css\/dev/g' ${i}; then
echo 'ERROR replacing .min.css to .css'
exit 6
fi
fi
fi
done
}
@ -84,6 +86,7 @@ if [ "$1" == "-r" ]; then
fi
done
#used to minify css
echo 'minify css...'
rm ${path_static_css}/rel/*.css
@ -127,7 +130,6 @@ if [ "$1" == "-r" ]; then
echo 'ERROR settimg loglevel=INFO '
exit 12
fi
fi
if [ "$1" == "-d" ]; then
@ -163,10 +165,10 @@ if [ ${ver} == "" ]; then
fi
echo 'version: '${ver}
echo 'writing version in '${manifest} '...'
if ! sed -i 's/v.*",/'$ver'",/g' ${manifest}
echo 'writing version in '${path_static_pwa}/manifest.webmanifest '...'
if ! sed -i 's/v.*",/'$ver'",/g' ${path_static_pwa}/manifest.webmanifest
then
echo 'ERROR writing version in '${manifest}
echo 'ERROR writing version in '${path_static_pwa}/manifest.webmanifest
exit 42
fi

View File

@ -114,5 +114,5 @@ span.search-callsign {
#silo-propagation-img {
width: 95%;
height: auto;
height: auto;
}

View File

@ -16,7 +16,7 @@
<link rel="icon" href="/static/images/icons/favicon.ico">
<link rel="icon" href="/static/images/icons/spider_ico_master.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/images/icons/icon-apple.png">
<link rel="manifest" href="/static/manifest.webmanifest">
<link rel="manifest" href="/static/pwa/manifest.webmanifest">
<link rel="stylesheet" href="/static/css/rel/style.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1 @@
{"name": "IU1BOW Spiderweb v2.4.1.2", "description": "DXCluser for ham radio by IU1BOW", "short_name": "Spiderweb", "theme_color": "#f3b221", "background_color": "#2196f3", "display": "standalone", "orientation": "portrait", "scope": "/", "start_url": "/index.html", "lang": "en-EN", "icons": [{"src": "images/icons/icon-72x72.png", "sizes": "72x72", "type": "image/png"}, {"src": "images/icons/icon-96x96.png", "sizes": "96x96", "type": "image/png"}, {"src": "images/icons/icon-128x128.png", "sizes": "128x128", "type": "image/png"}, {"src": "images/icons/icon-144x144.png", "sizes": "144x144", "type": "image/png"}, {"src": "images/icons/icon-152x152.png", "sizes": "152x152", "type": "image/png"}, {"src": "images/icons/icon-192x192.png", "sizes": "192x192", "type": "image/png"}, {"src": "images/icons/icon-384x384.png", "sizes": "384x384", "type": "image/png"}, {"src": "images/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "any"}, {"src": "images/icons/icon-512x512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable"}], "splash_pages": null}

View File

@ -1,56 +0,0 @@
{
"name": "IU1BOW DXCluster v2.4.1.2",
"description": "DXCluser for ham radio by IU1BOW",
"short_name": "IU1BOW DX",
"theme_color": "#2196f3",
"background_color": "#f3b221",
"display": "standalone",
"orientation": "portrait",
"scope": "/",
"start_url": "/index.html",
"lang": "en-EN",
"icons": [
{
"src": "images/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "any maskable"
},
{
"src": "images/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "images/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "images/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "images/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"splash_pages": null
}

View File

@ -0,0 +1,61 @@
{
"name": "IU1BOW Spiderweb v2.4.1.2",
"description": "DXCluser for ham radio by IU1BOW",
"short_name": "Spiderweb",
"theme_color": "#f3b221",
"background_color": "#2196f3",
"display": "standalone",
"orientation": "portrait",
"scope": "/",
"start_url": "/index.html",
"lang": "en-EN",
"icons": [
{
"src": "/static/images/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png" },
{
"src": "/static/images/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "/static/images/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/static/images/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/static/images/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "/static/images/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/static/images/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "/static/images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "any"
},
{
"src": "/static/images/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"splash_pages": null
}

View File

@ -0,0 +1,57 @@
// This is the "Offline page" service worker
const CACHE = 'pwabuilder-page';
const offlineFallbackPage = '/offline.html';
// Install stage sets up the offline page in the cache and opens a new cache
self.addEventListener('install', function (event) {
console.log('[PWA Builder] Install Event processing');
event.waitUntil(
caches.open(CACHE).then(function (cache) {
console.log('[PWA Builder] Cached offline page during install');
/*
if (offlineFallbackPage === "/html/offline.html") {
return cache.add(new Response("TODO: Update the value of the offlineFallbackPage constant in the serviceworker."));
}
*/
return cache.add(offlineFallbackPage);
})
);
});
// If any fetch fails, it will show the offline page.
self.addEventListener('fetch', function (event) {
if (event.request.method !== 'GET') return;
event.respondWith(
fetch(event.request).catch(function (error) {
// The following validates that the request was for a navigation to a new document
if (
event.request.destination !== 'document' ||
event.request.mode !== 'navigate'
) {
return;
}
console.error('[PWA Builder] Network request Failed. Serving offline page ' + error);
return caches.open(CACHE).then(function (cache) {
return cache.match(offlineFallbackPage);
});
})
);
});
// This is an event that can be fired from your page to tell the SW to update the offline page
self.addEventListener('refreshOffline', function () {
const offlinePageRequest = new Request(offlineFallbackPage);
return fetch(offlineFallbackPage).then(function (response) {
return caches.open(CACHE).then(function (cache) {
console.log('[PWA Builder] Offline page updated from refreshOffline event: ' + response.url);
return cache.put(offlinePageRequest, response);
});
});
});

View File

@ -1,57 +0,0 @@
// This is the "Offline page" service worker
const CACHE = "pwabuilder-page";
const offlineFallbackPage = "/offline.html";
// Install stage sets up the offline page in the cache and opens a new cache
self.addEventListener("install", function (event) {
console.log("[PWA Builder] Install Event processing");
event.waitUntil(
caches.open(CACHE).then(function (cache) {
console.log("[PWA Builder] Cached offline page during install");
/*
if (offlineFallbackPage === "/html/offline.html") {
return cache.add(new Response("TODO: Update the value of the offlineFallbackPage constant in the serviceworker."));
}
*/
return cache.add(offlineFallbackPage);
})
);
});
// If any fetch fails, it will show the offline page.
self.addEventListener("fetch", function (event) {
if (event.request.method !== "GET") return;
event.respondWith(
fetch(event.request).catch(function (error) {
// The following validates that the request was for a navigation to a new document
if (
event.request.destination !== "document" ||
event.request.mode !== "navigate"
) {
return;
}
console.error("[PWA Builder] Network request Failed. Serving offline page " + error);
return caches.open(CACHE).then(function (cache) {
return cache.match(offlineFallbackPage);
});
})
);
});
// This is an event that can be fired from your page to tell the SW to update the offline page
self.addEventListener("refreshOffline", function () {
const offlinePageRequest = new Request(offlineFallbackPage);
return fetch(offlineFallbackPage).then(function (response) {
return caches.open(CACHE).then(function (cache) {
console.log("[PWA Builder] Offline page updated from refreshOffline event: " + response.url);
return cache.put(offlinePageRequest, response);
});
});
});

View File

@ -13,7 +13,7 @@
<link rel="icon" href="/static/images/icons/favicon.ico">
<link rel="icon" href="/static/images/icons/spider_ico_master.svg" type="image/svg+xml">
<link rel="apple-touch-icon" href="/static/images/icons/icon-apple.png">
<link rel="manifest" href="/static/manifest.webmanifest">
<link rel="manifest" href="/static/pwa/manifest.webmanifest">
<link rel="stylesheet" href="/static/css/rel/style.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"

View File

@ -6,12 +6,6 @@
{% endblock %}
{% block head %}
{{ super() }}
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.1/echarts.min.js"
integrity="sha512-OTbGFYPLe3jhy4bUwbB8nls0TFgz10kn0TLkmyA+l3FyivDs31zsXCjOis7YGDtE2Jsy0+fzW+3/OVoPVujPmQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!--
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.1/echarts.js" integrity="sha512-ZYpFIosmEiTC+nL/30hJsFwTKXarRcUQeW1kV97gKOo6xzWhVzHwmEDLRMFceo9ALdXwyVLviVz6vm389kBexQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
-->
{% endblock %}
</head>
@ -92,5 +86,8 @@ var band_frequencies={{bands["bands"]|tojson|safe}};
{% block app_scripts %}
{{ super() }}
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.4.1/echarts.min.js"
integrity="sha512-OTbGFYPLe3jhy4bUwbB8nls0TFgz10kn0TLkmyA+l3FyivDs31zsXCjOis7YGDtE2Jsy0+fzW+3/OVoPVujPmQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="static/js/rel/plot.min.js"></script>
{% endblock app_scripts %}

View File

@ -307,8 +307,7 @@ def spots():
@app.route("/service-worker.js", methods=["GET"])
def sw():
return app.send_static_file("service-worker.js")
return app.send_static_file("pwa/service-worker.js")
@app.route("/offline.html")
def root():
@ -471,7 +470,7 @@ def add_security_headers(resp):
resp.headers["X-Frame-Options"] = "SAMEORIGIN"
resp.headers["X-Content-Type-Options"] = "nosniff"
resp.headers["Referrer-Policy"] = "strict-origin-when-cross-origin"
resp.headers["Cache-Control"] = "public, no-cache, no-store, must-revalidate"
resp.headers["Cache-Control"] = "public, no-cache, must-revalidate, max-age=604800"
resp.headers["Pragma"] = "no-cache"
resp.headers["Content-Security-Policy"] = "\