From d5ac77f1caef08f7a6ae8d8f89da9f73cfd2c93a Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Wed, 8 Apr 2020 00:07:54 -0400 Subject: [PATCH 01/31] improvement(telemetry): add version in crisp --- build/serve.json | 2 +- src/mixins/hooks/Telemetry.js | 4 +++- src/registerServiceWorker.js | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/build/serve.json b/build/serve.json index d5c9d01a..5e787b19 100644 --- a/build/serve.json +++ b/build/serve.json @@ -15,7 +15,7 @@ "headers": [ { "key": "Content-Security-Policy", - "value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://client.crisp.chat https://settings.crisp.chat https://www.google-analytics.com/; script-src-attr 'none'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://client.crisp.chat; img-src 'self' data: blob: https://penguin.upyun.galvincdn.com https://www.google-analytics.com https://stats.g.doubleclick.net https://image.crisp.chat https://client.crisp.chat; font-src 'self' https://fonts.gstatic.com https://fonts.gstatic.cn https://client.crisp.chat; connect-src 'self' https://penguin-stats.io https://penguin.upyun.galvincdn.com https://sentry.io https://client.crisp.chat wss://client.relay.crisp.chat https://storage.crisp.chat; prefetch-src 'self' https://penguin.upyun.galvincdn.com; upgrade-insecure-requests; block-all-mixed-content" + "value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://client.crisp.chat https://settings.crisp.chat https://www.google-analytics.com/; script-src-attr 'none'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://client.crisp.chat; img-src 'self' data: blob: https://penguin.upyun.galvincdn.com https://www.google-analytics.com https://stats.g.doubleclick.net https://image.crisp.chat https://client.crisp.chat; font-src 'self' https://fonts.gstatic.com https://fonts.gstatic.cn https://client.crisp.chat; connect-src 'self' https://penguin-stats.io https://penguin.upyun.galvincdn.com https://sentry.io https://client.crisp.chat wss://client.relay.crisp.chat https://storage.crisp.chat; prefetch-src 'self' https://penguin.upyun.galvincdn.com" } ] } diff --git a/src/mixins/hooks/Telemetry.js b/src/mixins/hooks/Telemetry.js index 42d79e75..c909f759 100644 --- a/src/mixins/hooks/Telemetry.js +++ b/src/mixins/hooks/Telemetry.js @@ -1,6 +1,7 @@ import * as Sentry from "@sentry/browser"; import store from "@/store"; import i18n from "@/i18n"; +import config from "@/config" class SessionData { constructor () { @@ -19,7 +20,8 @@ class SessionData { get crisp () { return [[ - ...Object.entries(this.data) + ...Object.entries(this.data), + ["Version", config.version] ]]; } } diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js index 576ffb53..6cddb045 100644 --- a/src/registerServiceWorker.js +++ b/src/registerServiceWorker.js @@ -11,6 +11,13 @@ if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { window.location.reload(); }); + workbox.addEventListener("waiting", event => { + console.log(event) + if (event.wasWaitingBeforeRegister) { + workbox.messageSW({ type: "SKIP_WAITING" }); + } + }); + workbox.register(); } else { workbox = null; From 09b4cf8108b0d8ab8a59aa09fbcf01bafb74225c Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Wed, 8 Apr 2020 00:08:16 -0400 Subject: [PATCH 02/31] improvement(telemetry): add version on crisp --- src/registerServiceWorker.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js index 6cddb045..576ffb53 100644 --- a/src/registerServiceWorker.js +++ b/src/registerServiceWorker.js @@ -11,13 +11,6 @@ if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { window.location.reload(); }); - workbox.addEventListener("waiting", event => { - console.log(event) - if (event.wasWaitingBeforeRegister) { - workbox.messageSW({ type: "SKIP_WAITING" }); - } - }); - workbox.register(); } else { workbox = null; From 08a72f67ba5b81468050a17dc58c3704fb180c6d Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Fri, 10 Apr 2020 01:17:07 -0400 Subject: [PATCH 03/31] improvement(drawer): open about dropdown as default --- .tx/config | 10 ++++++++++ src/router.js | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .tx/config diff --git a/.tx/config b/.tx/config new file mode 100644 index 00000000..b3c29a25 --- /dev/null +++ b/.tx/config @@ -0,0 +1,10 @@ +[main] +host = https://www.transifex.com + +[penguin-statistics-website.main] +file_filter = src/locales/.json +minimum_perc = 0 +source_file = src/locales/zh.json +source_lang = zh +type = KEYVALUEJSON + diff --git a/src/router.js b/src/router.js index f24482f1..2e40b902 100644 --- a/src/router.js +++ b/src/router.js @@ -132,7 +132,8 @@ const router = new Router({ component: AboutLayout, meta: { icon: 'mdi-account-group', - i18n: 'menu.about._name' + i18n: 'menu.about._name', + active: true }, children: [{ path: 'members', From a84dfb34df9663676c004f702794d86a04a55c42 Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Fri, 10 Apr 2020 15:19:55 -0400 Subject: [PATCH 04/31] fix(i18n): fix i18n translation detection error fix #268 --- src/main.js | 5 +++-- src/utils/strings.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index aa0c05bb..fdf67c7b 100644 --- a/src/main.js +++ b/src/main.js @@ -62,8 +62,9 @@ if (production) { "QuotaExceededError", "vivoNewsDetailPage", "Request aborted", - "TypeError: Cannot read property 'style' of null", - "removeAD" + "Cannot read property 'style' of null", + "removeAD", + "querySelectorAll" ], ignoreUrls: [ // Facebook flakiness diff --git a/src/utils/strings.js b/src/utils/strings.js index 1f60ecf6..32965702 100644 --- a/src/utils/strings.js +++ b/src/utils/strings.js @@ -15,7 +15,7 @@ function translate (object, key) { return getLocaleMessage(object, localeKey, key, locale) } else { let languages = locale.split("-"); - if (languages.length <= 2 && languages[0] !== "") { + if (languages[0] !== "") { return getLocaleMessage(object, localeKey, key, languages[0]) } else { Console.warn("StringI18n", `translation error: ${key}: Specific country code detected but it's invalid`, locale, languages) From 91eb978eaee5ec6e85c962f2dc454ce14425bf51 Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Sun, 12 Apr 2020 11:02:14 -0400 Subject: [PATCH 05/31] improvement(donate): improved donate qr codes --- build/serve.json | 12 -- now.json | 9 -- package.json | 12 ++ public/index.html | 2 +- src/assets/qrcodes/alipay-logo.svg | 1 + src/assets/qrcodes/alipay-qrcode.svg | 2 +- src/assets/qrcodes/logos.svg | 12 ++ src/assets/qrcodes/wechatpay-logo.svg | 1 + src/assets/qrcodes/wechatpay-qrcode.svg | 2 +- src/components/global/BackdropCard.vue | 63 ++++++++++ src/components/global/Footer.vue | 2 +- src/main.js | 2 +- src/views/About/Donate.vue | 72 +++++++++++- src/views/About/GettingStarted.vue | 103 ++-------------- .../register.js} | 4 +- src/workers/service-worker.js | 110 ++++++++++++++++++ vue.config.js | 32 +---- 17 files changed, 286 insertions(+), 155 deletions(-) create mode 100644 src/assets/qrcodes/alipay-logo.svg create mode 100644 src/assets/qrcodes/logos.svg create mode 100644 src/assets/qrcodes/wechatpay-logo.svg create mode 100644 src/components/global/BackdropCard.vue rename src/{registerServiceWorker.js => workers/register.js} (65%) create mode 100644 src/workers/service-worker.js diff --git a/build/serve.json b/build/serve.json index 5e787b19..36f36892 100644 --- a/build/serve.json +++ b/build/serve.json @@ -9,18 +9,6 @@ "value": "public, max-age=0, must-revalidate" } ] - }, - { - "source": "**", - "headers": [ - { - "key": "Content-Security-Policy", - "value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://client.crisp.chat https://settings.crisp.chat https://www.google-analytics.com/; script-src-attr 'none'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://client.crisp.chat; img-src 'self' data: blob: https://penguin.upyun.galvincdn.com https://www.google-analytics.com https://stats.g.doubleclick.net https://image.crisp.chat https://client.crisp.chat; font-src 'self' https://fonts.gstatic.com https://fonts.gstatic.cn https://client.crisp.chat; connect-src 'self' https://penguin-stats.io https://penguin.upyun.galvincdn.com https://sentry.io https://client.crisp.chat wss://client.relay.crisp.chat https://storage.crisp.chat; prefetch-src 'self' https://penguin.upyun.galvincdn.com" - } - ] } - ], - "rewrites": [ - { "source": "**", "destination": "/index.html" } ] } \ No newline at end of file diff --git a/now.json b/now.json index 6bec3d0e..e46ad3b9 100644 --- a/now.json +++ b/now.json @@ -10,15 +10,6 @@ "value": "public, max-age=0, must-revalidate" } ] - }, - { - "source": "(.*)", - "headers": [ - { - "key": "Content-Security-Policy", - "value": "default-src 'self'; script-src 'self' 'unsafe-inline' https://client.crisp.chat https://settings.crisp.chat https://www.google-analytics.com/; script-src-attr 'none'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://client.crisp.chat; img-src 'self' data: blob: https://penguin.upyun.galvincdn.com https://www.google-analytics.com https://stats.g.doubleclick.net https://image.crisp.chat https://client.crisp.chat; font-src 'self' https://fonts.gstatic.com https://fonts.gstatic.cn https://client.crisp.chat; connect-src 'self' https://penguin-stats.io https://penguin.upyun.galvincdn.com https://sentry.io https://client.crisp.chat wss://client.relay.crisp.chat https://storage.crisp.chat; prefetch-src 'self' https://penguin.upyun.galvincdn.com; upgrade-insecure-requests; block-all-mixed-content" - } - ] } ] } \ No newline at end of file diff --git a/package.json b/package.json index 496c9ed8..ee84f1e2 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,18 @@ "name": "penguin-stats-frontend", "version": "1.1.7", "private": true, + "homepage": "https://github.com/penguin-statistics/frontend-v2#readme", + "bugs": { + "url": "https://github.com/penguin-statistics/frontend-v2/issues" + }, + "license" : "MIT", + "author": "Galvin Gao (https://github.com/GalvinGao)", + "contributors": [ + "AlvISs_Reimu (https://github.com/AlvISsReimu)", + "Galvin Gao (https://github.com/GalvinGao)", + "Asahi (https://github.com/AsahiLuna)", + "Blealtan (https://github.com/Blealtan)" + ], "scripts": { "serve": "vue-cli-service serve", "build": "npx --max_old_space_size=4096 vue-cli-service build --modern", diff --git a/public/index.html b/public/index.html index 4660766d..773e36da 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - + 企鹅物流数据统计 diff --git a/src/assets/qrcodes/alipay-logo.svg b/src/assets/qrcodes/alipay-logo.svg new file mode 100644 index 00000000..95d3eb47 --- /dev/null +++ b/src/assets/qrcodes/alipay-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/qrcodes/alipay-qrcode.svg b/src/assets/qrcodes/alipay-qrcode.svg index 200ff90d..0c42a755 100644 --- a/src/assets/qrcodes/alipay-qrcode.svg +++ b/src/assets/qrcodes/alipay-qrcode.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/assets/qrcodes/logos.svg b/src/assets/qrcodes/logos.svg new file mode 100644 index 00000000..5066c4d7 --- /dev/null +++ b/src/assets/qrcodes/logos.svg @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/src/assets/qrcodes/wechatpay-logo.svg b/src/assets/qrcodes/wechatpay-logo.svg new file mode 100644 index 00000000..deccceb7 --- /dev/null +++ b/src/assets/qrcodes/wechatpay-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/qrcodes/wechatpay-qrcode.svg b/src/assets/qrcodes/wechatpay-qrcode.svg index 613e9d95..57d92995 100644 --- a/src/assets/qrcodes/wechatpay-qrcode.svg +++ b/src/assets/qrcodes/wechatpay-qrcode.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/global/BackdropCard.vue b/src/components/global/BackdropCard.vue new file mode 100644 index 00000000..d6089700 --- /dev/null +++ b/src/components/global/BackdropCard.vue @@ -0,0 +1,63 @@ + + + + + \ No newline at end of file diff --git a/src/components/global/Footer.vue b/src/components/global/Footer.vue index 3587f7e1..ed971eaf 100644 --- a/src/components/global/Footer.vue +++ b/src/components/global/Footer.vue @@ -9,7 +9,7 @@ tile width="100%" :color="primaryColor" - class="text-center footer--safe-area my-1" + class="text-center footer--safe-area mt-1 mb-2" > Penguin Statistics diff --git a/src/main.js b/src/main.js index fdf67c7b..c3598ce8 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,4 @@ -import workbox from "./registerServiceWorker" +import workbox from "./workers/register" import Vue from 'vue' import vuetify from './plugins/vuetify'; diff --git a/src/views/About/Donate.vue b/src/views/About/Donate.vue index fff0b81d..ec3e8b5f 100644 --- a/src/views/About/Donate.vue +++ b/src/views/About/Donate.vue @@ -91,6 +91,32 @@ + + + + + + + + + + + - + + + {{ $t('donate.methods.alipay') }} @@ -134,14 +172,26 @@ {{ $t('donate.redirectToApp', {app: $t('donate.methods.alipay')}) }} - + - + + + {{ $t('donate.methods.wechatPay') }} - + + + diff --git a/src/views/About/GettingStarted.vue b/src/views/About/GettingStarted.vue index 5aa10071..73e4e627 100644 --- a/src/views/About/GettingStarted.vue +++ b/src/views/About/GettingStarted.vue @@ -80,18 +80,15 @@ cols="12" sm="4" > - -
- + {{ $t('meta.quotation.start') }}{{ renderTranslation(link.subtitle) }}{{ $t('meta.quotation.end') }} - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/registerServiceWorker.js b/src/workers/register.js similarity index 65% rename from src/registerServiceWorker.js rename to src/workers/register.js index 576ffb53..1ba57e12 100644 --- a/src/registerServiceWorker.js +++ b/src/workers/register.js @@ -1,13 +1,15 @@ /* eslint-disable no-console */ import { Workbox } from "workbox-window"; +import Console from "@/utils/Console"; let workbox; if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { workbox = new Workbox(`${process.env.BASE_URL}service-worker.js`); - workbox.addEventListener("controlling", () => { + workbox.addEventListener("controlling", (event) => { + Console.log("SWRegister", "a service worker has taken control (controlling): ", event); window.location.reload(); }); diff --git a/src/workers/service-worker.js b/src/workers/service-worker.js new file mode 100644 index 00000000..f8ab44c2 --- /dev/null +++ b/src/workers/service-worker.js @@ -0,0 +1,110 @@ +/* eslint-env serviceworker */ + +import { registerRoute } from 'workbox-routing'; +import { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching'; +import { NetworkFirst, CacheFirst, StaleWhileRevalidate } from 'workbox-strategies' +import { ExpirationPlugin } from 'workbox-expiration' +import { CacheableResponsePlugin } from 'workbox-cacheable-response' + +self.addEventListener('activate', () => self.clients.claim()); + +self.addEventListener('message', (event) => { + if (event.data && event.data.type === 'SKIP_WAITING') { + skipWaiting(); + } +}); + +cleanupOutdatedCaches(); + +// === Google Fonts === + +registerRoute( + /^https:\/\/fonts\.googleapis\.com/, + new StaleWhileRevalidate({ + cacheName: 'google-fonts-stylesheets', + }) +); + +// Cache the underlying font files with a cache-first strategy for 1 year. +registerRoute( + /^https:\/\/fonts\.gstatic\.com/, + new CacheFirst({ + cacheName: 'google-fonts-webfonts', + plugins: [ + new CacheableResponsePlugin({ + statuses: [0, 200], + }), + new ExpirationPlugin({ + maxAgeSeconds: 60 * 60 * 24 * 365, + maxEntries: 30, + }), + ], + }) +); + +// === CDN Resources === + +// fancy backgrounds +registerRoute( + /^https:\/\/penguin\.upyun\.galvincdn\.com\/backgrounds\//, + new CacheFirst({ + cacheName: "penguin-backgrounds", + plugins: [ + new ExpirationPlugin({ + // maxEntries: 30, + purgeOnQuotaError: true + }) + ] + }) +) + +// other images +registerRoute( + /^https:\/\/penguin\.upyun\.galvincdn\.com\/(logos|avatars)\//, + new CacheFirst({ + cacheName: "penguin-images" + }) +) + +// === Site Resources === + +// // files that are versioned. safe to cache. +// registerRoute( +// /.[a-f0-9]{8}.(css|js|woff2|ttf|woff|eof|svg|png)/, +// new CacheFirst({ +// cacheName: "penguin-site-resources" +// }) +// ) + +// if the network failed, use the cache instead; otherwise use the +// fresh data coming from the api +registerRoute( + /^https:\/\/penguin-stats\.io\/PenguinStats\//, + new NetworkFirst({ + cacheName: "penguin-api-responses", + plugins: [ + new ExpirationPlugin({ + maxAgeSeconds: 60 * 60 * 24, + maxEntries: 10 + }), + ] + }) +) + +// precache the item sprite file +// registerRoute( +// "https://penguin.upyun.galvincdn.com/item_sprite.png", +// new StaleWhileRevalidate({ +// cacheName: "penguin-sprite", +// plugins: [ +// new ExpirationPlugin({ +// maxAgeSeconds: 60 * 60 * 24, +// maxEntries: 3 +// }), +// ] +// }) +// ) + +// eslint-disable-next-line no-unused-vars +const manifest = self.__WB_MANIFEST; +precacheAndRoute(manifest) diff --git a/vue.config.js b/vue.config.js index 2618e200..ca34b2c8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,5 +1,5 @@ const webpack = require("webpack"); -const { GenerateSW } = require("workbox-webpack-plugin"); +const { InjectManifest } = require("workbox-webpack-plugin"); let commitHash; @@ -29,31 +29,6 @@ module.exports = { }, integrity: true, runtimeCompiler: true, - // pwa: { - // name: "企鹅物流数据统计", - // themeColor: "#2d66ba", - // msTileColor: "#1d499b", - // appleMobileWebAppCapable: "yes", - // appleMobileWebAppStatusBarStyle: "black-translucent", - // - // workboxPluginMode: "InjectManifest", - // workboxOptions: { - // swSrc: "src/serviceWorker/service-worker.js", - // exclude: [ - // /\.map$/, - // /favicon\.ico$/, - // /manifest\.json$/, - // /precache-manifest.\.json$/, - // ] - // }, - // iconPaths: { - // favicon32: 'favicon/favicon-32x32.png', - // favicon16: 'favicon/favicon-16x16.png', - // appleTouchIcon: 'favicon/apple-touch-icon.png', - // maskIcon: 'favicon/safari-pinned-tab.svg', - // msTileImage: 'favicon/mstile-150x150.png' - // } - // }, transpileDependencies: [ "vuetify" ], @@ -62,7 +37,10 @@ module.exports = { new webpack.DefinePlugin({ GIT_COMMIT: JSON.stringify(commitHash).trim() }), - new GenerateSW() + new InjectManifest ({ + swSrc: "./src/workers/service-worker.js", + dontCacheBustURLsMatching: /.[a-f0-9]{8}./ + }) ], }, chainWebpack: config => { From 3fd52519fec6ca7c8327e6f5fa6340f10ce11c66 Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Mon, 13 Apr 2020 16:45:44 -0400 Subject: [PATCH 06/31] improvement(discord): use link to the #welcome channel --- src/views/About/Contribute.vue | 2 +- src/workers/service-worker.js | 40 ++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/views/About/Contribute.vue b/src/views/About/Contribute.vue index 08111420..6e593fdc 100644 --- a/src/views/About/Contribute.vue +++ b/src/views/About/Contribute.vue @@ -109,7 +109,7 @@ self.clients.claim()); self.addEventListener('message', (event) => { @@ -18,12 +20,12 @@ cleanupOutdatedCaches(); // === Google Fonts === -registerRoute( - /^https:\/\/fonts\.googleapis\.com/, - new StaleWhileRevalidate({ - cacheName: 'google-fonts-stylesheets', - }) -); +// registerRoute( +// /^https:\/\/fonts\.googleapis\.com/, +// new StaleWhileRevalidate({ +// cacheName: 'google-fonts-stylesheets', +// }) +// ); // Cache the underlying font files with a cache-first strategy for 1 year. registerRoute( @@ -49,12 +51,12 @@ registerRoute( /^https:\/\/penguin\.upyun\.galvincdn\.com\/backgrounds\//, new CacheFirst({ cacheName: "penguin-backgrounds", - plugins: [ - new ExpirationPlugin({ - // maxEntries: 30, - purgeOnQuotaError: true - }) - ] + // plugins: [ + // new ExpirationPlugin({ + // // maxEntries: 30, + // purgeOnQuotaError: true + // }) + // ] }) ) @@ -82,12 +84,12 @@ registerRoute( /^https:\/\/penguin-stats\.io\/PenguinStats\//, new NetworkFirst({ cacheName: "penguin-api-responses", - plugins: [ - new ExpirationPlugin({ - maxAgeSeconds: 60 * 60 * 24, - maxEntries: 10 - }), - ] + // plugins: [ + // new ExpirationPlugin({ + // maxAgeSeconds: 60 * 60 * 24, + // maxEntries: 10 + // }), + // ] }) ) From cfa7e564e028e5f8f5ffb0ece21299e432e8b3fa Mon Sep 17 00:00:00 2001 From: GalvinGao Date: Tue, 21 Apr 2020 02:56:42 -0400 Subject: [PATCH 07/31] feat(settings): new settings dialog in drawer --- build/serve.json | 3 ++ package.json | 2 +- public/index.html | 16 ++++++ src/App.vue | 18 +++---- src/components/drawer/SettingsDialog.vue | 58 +++++++++++++++++++++ src/components/drawer/ThemeSwitcher.vue | 59 +++++++++++++++++----- src/components/global/Footer.vue | 2 +- src/components/global/RandomBackground.vue | 19 +++---- src/config/index.js | 5 +- src/locales/en.json | 12 ++++- src/locales/ja.json | 12 ++++- src/locales/ko.json | 12 ++++- src/locales/zh.json | 12 ++++- src/mixins/CDN.js | 8 ++- src/mixins/Theme.js | 39 ++++++++++++-- src/mixins/hooks/CrispCustomizer.js | 2 +- src/mixins/hooks/GlobalEntry.js | 4 ++ src/mixins/hooks/StoreUpgrader.js | 9 ++++ src/mixins/hooks/Theme.js | 19 ++----- src/styles/global.css | 2 + src/utils/Console.js | 16 ++++-- src/views/About/Changelog.vue | 6 +-- src/workers/register.js | 2 +- src/workers/service-worker.js | 2 - 24 files changed, 265 insertions(+), 74 deletions(-) create mode 100644 src/components/drawer/SettingsDialog.vue create mode 100644 src/mixins/hooks/StoreUpgrader.js diff --git a/build/serve.json b/build/serve.json index 36f36892..29375c3c 100644 --- a/build/serve.json +++ b/build/serve.json @@ -10,5 +10,8 @@ } ] } + ], + "rewrites": [ + { "source": "**", "destination": "/index.html" } ] } \ No newline at end of file diff --git a/package.json b/package.json index ee84f1e2..25222086 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "penguin-stats-frontend", - "version": "1.1.7", + "version": "1.1.8", "private": true, "homepage": "https://github.com/penguin-statistics/frontend-v2#readme", "bugs": { diff --git a/public/index.html b/public/index.html index 773e36da..2441d747 100644 --- a/public/index.html +++ b/public/index.html @@ -8,6 +8,7 @@ 企鹅物流数据统计 + @@ -20,6 +21,21 @@ + + + + + + + + + + + + + + + diff --git a/src/App.vue b/src/App.vue index 37f4dd5d..824f3444 100644 --- a/src/App.vue +++ b/src/App.vue @@ -55,6 +55,7 @@ {{ $t('app.name_line1') }} {{ $t('app.name_line2') }} @@ -72,15 +73,16 @@ :route="route" /> - + @@ -89,9 +91,7 @@ {{ $t('menu.refreshData') }} - - - + @@ -157,8 +157,6 @@ import NetworkStateIndicator from "@/components/toolbar/NetworkStateIndicator"; import Navigation from "@/components/drawer/Navigation"; - import LocaleSwitcher from "@/components/drawer/LocaleSwitcher"; - import ThemeSwitcher from "@/components/drawer/ThemeSwitcher"; import GlobalEntry from "@/mixins/hooks/GlobalEntry"; @@ -169,14 +167,14 @@ import CDN from "@/mixins/CDN"; import Mirror from "@/mixins/Mirror"; import SpecialUI from "@/mixins/SpecialUI"; + import SettingsDialog from "@/components/drawer/SettingsDialog"; export default { name: 'App', components: { + SettingsDialog, Footer, PWAPopups, - LocaleSwitcher, - ThemeSwitcher, Navigation, GlobalSnackbar, NetworkStateIndicator, @@ -202,6 +200,6 @@ export default { async refreshData () { await this.$store.dispatch("data/fetch", true); }, - } + }, } diff --git a/src/components/drawer/SettingsDialog.vue b/src/components/drawer/SettingsDialog.vue new file mode 100644 index 00000000..4cd47b1c --- /dev/null +++ b/src/components/drawer/SettingsDialog.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/src/components/drawer/ThemeSwitcher.vue b/src/components/drawer/ThemeSwitcher.vue index a1d63dec..3ce643bc 100644 --- a/src/components/drawer/ThemeSwitcher.vue +++ b/src/components/drawer/ThemeSwitcher.vue @@ -1,17 +1,34 @@