Add extra message to +error.svelte to handle, and clarify 'OFFLINE' error.
This commit is contained in:
@@ -251,7 +251,7 @@
|
|||||||
@media (min-width: 620px) {
|
@media (min-width: 620px) {
|
||||||
.cancel-row td,
|
.cancel-row td,
|
||||||
.delay-row td {
|
.delay-row td {
|
||||||
font-size: 1.20rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,12 +261,12 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
color: rgb(187, 187, 255);
|
color: rgb(187, 187, 255);
|
||||||
}
|
}
|
||||||
@media(min-width: 400px) {
|
@media (min-width: 400px) {
|
||||||
.toc-coach-row td {
|
.toc-coach-row td {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media(min-width: 550px) {
|
@media (min-width: 550px) {
|
||||||
.toc-coach-row td {
|
.toc-coach-row td {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export interface Preferences {
|
|||||||
const STORAGE_KEY = 'ob_pref';
|
const STORAGE_KEY = 'ob_pref';
|
||||||
|
|
||||||
const DEFAULT_PREFS: Preferences = {
|
const DEFAULT_PREFS: Preferences = {
|
||||||
locationEnabled: false,
|
locationEnabled: false
|
||||||
};
|
};
|
||||||
|
|
||||||
function loadPrefs(): Preferences {
|
function loadPrefs(): Preferences {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const MAX_ENTRIES: number = RETURNED_LENGTH * 4;
|
|||||||
class QuickLinksService {
|
class QuickLinksService {
|
||||||
#links = $state<QuickLink[]>([]);
|
#links = $state<QuickLink[]>([]);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
const saved = localStorage.getItem('ql');
|
const saved = localStorage.getItem('ql');
|
||||||
if (saved) {
|
if (saved) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<img class="err-img" src={noResult} alt="" role="presentation" width="200" height="200" />
|
<img class="err-img" src={noResult} alt="" role="presentation" width="200" height="200" />
|
||||||
{:else if page.status == 499}
|
{:else if page.status == 499}
|
||||||
<!-- Change to a GSM-R X Sign?? -->
|
<!-- Change to a GSM-R X Sign?? -->
|
||||||
|
<span>OFFLINE!</span>
|
||||||
<img class="err-img" src={stopErr} alt="" role="presentation" width="150" height="210" />
|
<img class="err-img" src={stopErr} alt="" role="presentation" width="150" height="210" />
|
||||||
{:else}
|
{:else}
|
||||||
<!-- STOP Error image -->
|
<!-- STOP Error image -->
|
||||||
|
|||||||
@@ -22,11 +22,11 @@
|
|||||||
if (browser && 'serviceWorker' in navigator) {
|
if (browser && 'serviceWorker' in navigator) {
|
||||||
try {
|
try {
|
||||||
const registration = await navigator.serviceWorker.register('/service-worker.js', {
|
const registration = await navigator.serviceWorker.register('/service-worker.js', {
|
||||||
type: 'module',
|
type: 'module'
|
||||||
});
|
});
|
||||||
console.info('OwlBoard Service Worker registered', registration.scope);
|
console.info('OwlBoard Service Worker registered', registration.scope);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Service Worker installation failed: ', error)
|
console.error('Service Worker installation failed: ', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,18 +8,13 @@ const sw = self as unknown as ServiceWorkerGlobalScope;
|
|||||||
const CACHE_NAME = `owlboard-cache-${version}`;
|
const CACHE_NAME = `owlboard-cache-${version}`;
|
||||||
const ASSETS = [
|
const ASSETS = [
|
||||||
...build,
|
...build,
|
||||||
...files.filter(file =>
|
...files.filter((file) => !file.endsWith('manifest.json') && !file.startsWith('/icons/')),
|
||||||
!file.endsWith('manifest.json') &&
|
'/'
|
||||||
!file.startsWith('/icons/')
|
|
||||||
),
|
|
||||||
'/',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
sw.addEventListener('install', (event) => {
|
sw.addEventListener('install', (event) => {
|
||||||
sw.skipWaiting();
|
sw.skipWaiting();
|
||||||
event.waitUntil(
|
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS)));
|
||||||
caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS))
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sw.addEventListener('activate', (event) => {
|
sw.addEventListener('activate', (event) => {
|
||||||
@@ -49,9 +44,7 @@ sw.addEventListener('fetch', (event) => {
|
|||||||
|
|
||||||
// 1. Static Assets (Cache-First)
|
// 1. Static Assets (Cache-First)
|
||||||
if (ASSETS.includes(url.pathname) || url.pathname.startsWith('/_app/')) {
|
if (ASSETS.includes(url.pathname) || url.pathname.startsWith('/_app/')) {
|
||||||
event.respondWith(
|
event.respondWith(caches.match(request).then((res) => res || fetch(request)));
|
||||||
caches.match(request).then((res) => res || fetch(request))
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,18 +54,15 @@ sw.addEventListener('fetch', (event) => {
|
|||||||
fetch(request).catch(() => {
|
fetch(request).catch(() => {
|
||||||
const errorObject: ApiEnvelope.Envelope = {
|
const errorObject: ApiEnvelope.Envelope = {
|
||||||
e: {
|
e: {
|
||||||
code: "NETWORK_DISCONNECTED",
|
code: 'NETWORK_DISCONNECTED',
|
||||||
msg: "Cannot connect to the OwlBoard server"
|
msg: 'Cannot connect to the OwlBoard server'
|
||||||
},
|
},
|
||||||
t: Math.floor(Date.now() / 1000)
|
t: Math.floor(Date.now() / 1000)
|
||||||
};
|
};
|
||||||
return new Response(
|
return new Response(JSON.stringify(errorObject), {
|
||||||
JSON.stringify(errorObject),
|
|
||||||
{
|
|
||||||
status: 503,
|
status: 503,
|
||||||
headers: { 'Content-Type': 'application/json' }
|
headers: { 'Content-Type': 'application/json' }
|
||||||
}
|
});
|
||||||
);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user