revert SW

This commit is contained in:
Pablo Ferreiro 2022-11-04 17:41:22 +01:00
parent de85ba3e44
commit 4bfc4c9434
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
6 changed files with 0 additions and 46 deletions

View file

@ -34,14 +34,6 @@ class SettingsController {
self::redirect(); self::redirect();
} }
static public function misc() {
if (isset($_POST['misc-sw'])) {
$sw = $_POST['misc-sw'];
Cookies::set("misc-sw", $sw);
}
self::redirect();
}
static private function redirect() { static private function redirect() {
$url = Misc::url('/settings'); $url = Misc::url('/settings');
header("Location: {$url}"); header("Location: {$url}");

View file

@ -16,8 +16,4 @@
<link rel="stylesheet" href="{path('/styles/vendor/cssgg.min.css')}"> <link rel="stylesheet" href="{path('/styles/vendor/cssgg.min.css')}">
<link rel="stylesheet" href="{path('/styles/vendor/bulma.min.css')}"> <link rel="stylesheet" href="{path('/styles/vendor/bulma.min.css')}">
<title>{$title} - ProxiTok</title> <title>{$title} - ProxiTok</title>
{*/ Handles optional Service Worker /*}
{if \App\Helpers\Cookies::check('misc-sw', 'yes')}
<script src="{path('/scripts/setup_sw.js')}"></script>
{/if}
</head> </head>

View file

@ -1,3 +0,0 @@
{if \App\Helpers\Cookies::check('misc-sw', 'yes')}
<script src="{path('/scripts/setup_sw.js')}"></script>
{/if}

View file

@ -1,9 +0,0 @@
window.addEventListener("load", () => {
if (navigator.serviceWorker) {
navigator.serviceWorker.register('/sw.js').then(function (reg) {
console.log('Service worker registration was successful, scope: ', reg.scope);
}).catch(function (error) {
console.log('Service worker failed:', error);
});
}
})

17
sw.js
View file

@ -1,17 +0,0 @@
const PWA_PRELOAD = {
pages: ['/', '/about', '/settings'],
scripts: ['/scripts/navbar.js', '/scripts/themes/card.js'],
styles: ['/styles/vendor/bulma.min.css', '/styles/vendor/cssgg.min.css', '/styles/themes/card.css']
}
self.addEventListener("install", function(e) {
e.waitUntil(
caches.open("pwa").then(function(cache) {
return cache.addAll([
...PWA_PRELOAD.pages,
...PWA_PRELOAD.scripts,
...PWA_PRELOAD.styles
]);
})
);
});

View file

@ -14,9 +14,4 @@
<p class="title">Api</p> <p class="title">Api</p>
{include '../components/settings/api.latte'} {include '../components/settings/api.latte'}
</div> </div>
<hr />
<div class="content">
<p class="title">Misc</p>
{include '../components/settings/misc.latte'}
</div>
{/block} {/block}