Compare commits

...

3 Commits

Author SHA1 Message Date
Spythere 57e88b9abc Merge do wersji 1.15.1
Wersja 1.15.1
2023-06-02 20:09:43 +02:00
Spythere 44ebf53798 poprawki pwa 2023-06-02 20:06:25 +02:00
Spythere 145dc72b6b pwa: zmiana na autoUpdate 2023-06-02 19:41:33 +02:00
4 changed files with 62 additions and 68 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "stacjownik", "name": "stacjownik",
"version": "1.15.0", "version": "1.15.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
-10
View File
@@ -7,7 +7,6 @@ import plLang from './locales/pl.json';
import { createI18n } from 'vue-i18n'; import { createI18n } from 'vue-i18n';
import { createPinia } from 'pinia'; import { createPinia } from 'pinia';
import { registerSW } from 'virtual:pwa-register';
const i18n = createI18n({ const i18n = createI18n({
locale: 'pl', locale: 'pl',
@@ -21,15 +20,6 @@ const i18n = createI18n({
enableLegacy: false, enableLegacy: false,
}); });
registerSW({
onRegistered(r) {
r &&
setInterval(() => {
r.update();
}, 60 * 60 * 1000);
},
});
const clickOutsideDirective: Directive = { const clickOutsideDirective: Directive = {
mounted(el, binding) { mounted(el, binding) {
el.clickOutsideEvent = (event: Event) => { el.clickOutsideEvent = (event: Event) => {
+6 -2
View File
@@ -65,12 +65,16 @@
&.twr { &.twr {
background-color: var(--clr-twr); background-color: var(--clr-twr);
box-shadow: 0 0 5px 1px var(--clr-twr); box-shadow: 0 0 5px 1px var(--clr-twr);
color: black; color: black;
} }
&.skr { &.skr {
background-color: var(--clr-skr); background-color: var(--clr-skr);
box-shadow: 0 0 5px 1px var(--clr-skr); box-shadow: 0 0 5px 1px var(--clr-skr);
}
&.offline {
background-color: #be3728;
} }
} }
+55 -55
View File
@@ -1,55 +1,55 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
import { VitePWA } from 'vite-plugin-pwa'; import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({ export default defineConfig({
server: { server: {
port: 5001, port: 5001,
}, },
plugins: [ plugins: [
vue(), vue(),
VitePWA({ VitePWA({
registerType: 'prompt', registerType: 'autoUpdate',
workbox: { workbox: {
globPatterns: ['**/*.{js,css,html,png,svg,jpg}'], globPatterns: ['**/*.{js,css,html,png,svg,jpg}'],
runtimeCaching: [ runtimeCaching: [
{ {
urlPattern: new RegExp('^https://spythere.pl/api/getSceneries', 'i'), urlPattern: new RegExp('^https://spythere.pl/api/getSceneries', 'i'),
handler: 'NetworkFirst', handler: 'NetworkFirst',
options: { options: {
cacheName: 'sceneries-cache', cacheName: 'sceneries-cache',
expiration: { expiration: {
maxEntries: 1, maxEntries: 1,
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
}, },
cacheableResponse: { cacheableResponse: {
statuses: [0, 200], statuses: [0, 200],
}, },
}, },
}, },
{ {
urlPattern: /^https:\/\/rj.td2.info.pl\/dist\/img\/thumbnails\/.*/i, urlPattern: /^https:\/\/rj.td2.info.pl\/dist\/img\/thumbnails\/.*/i,
handler: 'CacheFirst', handler: 'CacheFirst',
options: { options: {
cacheName: 'images-cache', cacheName: 'images-cache',
expiration: { expiration: {
maxEntries: 100, maxEntries: 100,
maxAgeSeconds: 60 * 60 * 24 * 60, maxAgeSeconds: 60 * 60 * 24 * 60,
}, },
cacheableResponse: { cacheableResponse: {
statuses: [0, 200, 404], statuses: [0, 200, 404],
}, },
}, },
}, },
], ],
}, },
devOptions: { devOptions: {
enabled: true, enabled: true,
}, },
}), }),
], ],
}); });