autoregister sw
This commit is contained in:
parent
cba59e66c7
commit
8f83a27885
|
@ -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}");
|
||||||
|
|
|
@ -7,7 +7,6 @@ class UrlBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function download(string $url, string $username, string $id, bool $watermark): string {
|
static public function download(string $url, string $username, string $id, bool $watermark): string {
|
||||||
// {path('/download?url=' . urlencode($playAddr) . '&id=' . $id . '&user=' . $uniqueId) . '&watermark=1'}
|
|
||||||
$down_url = Misc::url('/download?url=' . urlencode($url) . '&id=' . $id . '&user=' . $username);
|
$down_url = Misc::url('/download?url=' . urlencode($url) . '&id=' . $id . '&user=' . $username);
|
||||||
if ($watermark) $down_url .= '&watermark=1';
|
if ($watermark) $down_url .= '&watermark=1';
|
||||||
return $down_url;
|
return $down_url;
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
<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 /*}
|
{*/ Handles Service Worker /*}
|
||||||
{if \App\Helpers\Cookies::check('misc-sw', 'yes')}
|
|
||||||
<script src="{path('/scripts/setup_sw.js')}"></script>
|
<script src="{path('/scripts/setup_sw.js')}"></script>
|
||||||
{/if}
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
{embed '../form.latte', path: '/settings/misc', method: 'POST', submit: true}
|
|
||||||
{block fields}
|
|
||||||
<div class="field">
|
|
||||||
<label class="label">Enable service worker</label>
|
|
||||||
<div class="control">
|
|
||||||
<label class="radio">
|
|
||||||
<input type="radio" name="misc-sw" value="yes" n:attr="checked => $isServiceWorker" />
|
|
||||||
<span>Yes</span>
|
|
||||||
</label>
|
|
||||||
<label class="radio">
|
|
||||||
<input type="radio" name="misc-sw" value="no" n:attr="checked => !$isServiceWorker" />
|
|
||||||
<span>No</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<p class="help">This can be used to install the PWA version of ProxiTok</p>
|
|
||||||
</div>
|
|
||||||
{/block}
|
|
||||||
{/embed}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{if \App\Helpers\Cookies::check('misc-sw', 'yes')}
|
|
||||||
<script src="{path('/scripts/setup_sw.js')}"></script>
|
|
||||||
{/if}
|
|
|
@ -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}
|
||||||
|
|
Loading…
Reference in a new issue