Skip to content

Commit

Permalink
Merge pull request #424 from penguin-statistics/dev
Browse files Browse the repository at this point in the history
Release v3.4.2
  • Loading branch information
AlvISsReimu authored Jan 16, 2021
2 parents 61d2086 + e939118 commit e1c007f
Show file tree
Hide file tree
Showing 61 changed files with 8,312 additions and 46 deletions.
2 changes: 1 addition & 1 deletion ios/App/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
}
}


// MARK: save shortcut to process
if let shortcutItem = launchOptions?[UIApplication.LaunchOptionsKey.shortcutItem] as? UIApplicationShortcutItem {
shortcutItemToProcess = shortcutItem
Expand Down Expand Up @@ -113,7 +114,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let monitor = NWPathMonitor()

monitor.pathUpdateHandler = { path in
print("new network path:", path)
var isConstrained = false

if #available(iOS 13.0, *) {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "penguin-stats-frontend",
"version": "3.4.1",
"version": "3.4.2",
"private": true,
"author": "Penguin Statistics Contributors <contributors@penguin-stats.io> (https://github.com/orgs/penguin-statistics/people)",
"scripts": {
Expand Down Expand Up @@ -45,7 +45,7 @@
"katex": "^0.12.0",
"lodash": "^4.17.20",
"marked": "^1.0.0",
"minisearch": "^3.0.2",
"protobufjs": "^6.10.2",
"qs": "^6.9.4",
"regenerator-runtime": "^0.13.5",
"semver": "^7.3.2",
Expand Down Expand Up @@ -100,10 +100,10 @@
}
},
"browserslist": [
"> 0.1% in my stats",
"> 1% in CN",
"> 0.05% in my stats",
"> 0.5% in CN",
"last 5 versions",
"since 2010",
"since 2013",
"defaults"
],
"bugs": {
Expand Down
6 changes: 4 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
<meta name="robots" content="index,follow" />
<meta name="googlebot" content="index,follow" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:creator" content="@AlvISs_Reimu" />
<meta name="twitter:image" content="https://penguin-stats.s3.amazonaws.com/images/twitter-card.png">
<meta name="twitter:image:alt" content="Penguin Statistics">
<!-- <meta name="twitter:site" content="@AlvISs_Reimu" />-->
<meta property="og:url" content="https://penguin-stats.io" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Penguin Statistics" />
Expand All @@ -54,7 +56,7 @@
<meta property="og:image:height" content="600" />
</head>
<body>
<noscript><style type="text/css">body{background:#4d2222}.nojs h1{font-size:48px}.nojs h2{font-size:36px}.nojs hr{margin:48px 0;border:1px solid #000}.nojs{vertical-align:middle;margin:32px 13%;width:70%;font-weight:700;font-size:18px;font-family:-apple-system,Noto Sans SC,BlinkMacSystemFont,"Segoe UI",Microsoft YaHei UI,Microsoft Yahei,微软雅黑,Helvetica,Arial,sans-serif;padding:36px 48px;word-break:break-all;text-align:center;line-height:2;border-radius:8px;background:#cc696f;border:4px solid #ff878f;color:#261415}.nojs a{display:inline-block;border:2px solid #000;padding:16px 24px;margin:0 8px;text-decoration:none;background:#3375e0;color:#fff;font-family:sans-serif;font-size:14px;cursor:pointer;text-align:center;transition:background 50ms ease-out,transform 150ms ease;-webkit-appearance:none;-moz-appearance:none}.nojs a:focus,.nojs a:hover{background:#368dff;color:#000;transform:scale(1.05)}.nojs a:focus{outline:1px solid #fff;outline-offset:-4px}.nojs a:active{transform:scale(.99)}.nojs del{padding:4px 8px;background:#000;color:#fff}</style><div class="nojs"><h1>JavaScript 已被禁用</h1><p>很抱歉,但企鹅物流数据统计需要您启用 <del>等离子发动机(不是)</del> JavaScript 以提供服务。若您确信自己已开启相关技术,那么可能是您的浏览器版本太低了;请点击下方按钮升级浏览器。</p><hr><a href="https://www.google.cn/chrome/" title="得益于内置的 Google 智能工具,Chrome 现在更易用、更安全、更快速。" target="_blank">使用 Google Chrome (推荐)</a> <a href="https://www.mozilla.org/zh-CN/firefox/new/" title="使用我们一系列隐私优先产品,得回您应受到的重视。" target="_blank">使用 Mozilla Firefox</a><br><p>&copy; 企鹅物流</p></div></noscript>
<noscript><img src="<%= PENGUIN_PROBE_NOSCRIPT %>" width="1" height="1" style="overflow: hidden; opacity: 0.5" alt=":D" /><style type="text/css">body{background:#4d2222}.nojs h1{font-size:48px}.nojs h2{font-size:36px}.nojs hr{margin:48px 0;border:1px solid #000}.nojs{vertical-align:middle;margin:32px 13%;width:70%;font-weight:700;font-size:18px;font-family:-apple-system,Noto Sans SC,BlinkMacSystemFont,"Segoe UI",Microsoft YaHei UI,Microsoft Yahei,微软雅黑,Helvetica,Arial,sans-serif;padding:36px 48px;word-break:break-all;text-align:center;line-height:2;border-radius:8px;background:#cc696f;border:4px solid #ff878f;color:#261415}.nojs a{display:inline-block;border:2px solid #000;padding:16px 24px;margin:0 8px;text-decoration:none;background:#3375e0;color:#fff;font-family:sans-serif;font-size:14px;cursor:pointer;text-align:center;transition:background 50ms ease-out,transform 150ms ease;-webkit-appearance:none;-moz-appearance:none}.nojs a:focus,.nojs a:hover{background:#368dff;color:#000;transform:scale(1.05)}.nojs a:focus{outline:1px solid #fff;outline-offset:-4px}.nojs a:active{transform:scale(.99)}.nojs del{padding:4px 8px;background:#000;color:#fff}</style><div class="nojs"><h1>JavaScript 已被禁用</h1><p>很抱歉,但企鹅物流数据统计需要您启用 <del>等离子发动机(不是)</del> JavaScript 以提供服务。若您确信自己已开启相关技术,那么可能是您的浏览器版本太低了;请点击下方按钮升级浏览器。</p><hr><a href="https://www.google.cn/chrome/" title="得益于内置的 Google 智能工具,Chrome 现在更易用、更安全、更快速。" target="_blank">使用 Google Chrome (推荐)</a> <a href="https://www.mozilla.org/zh-CN/firefox/new/" title="使用我们一系列隐私优先产品,得回您应受到的重视。" target="_blank">使用 Mozilla Firefox</a><br><p>&copy; 企鹅物流</p></div></noscript>
<main id="app">
<div id="loader-wrapper">
<img id="loader-logo" alt="Logo"
Expand Down
6 changes: 4 additions & 2 deletions src/components/advancedQuery/QueryBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@
execute () {
const start = Date.now()
this.result.busy = true
const marshalled = marshaller.advancedQuery(this.value)
query.advancedQuery(
marshaller.advancedQuery(this.value)
marshalled
)
.then(({data}) => {
data = data["advanced_results"]
Expand All @@ -232,7 +233,7 @@
// if the user hasn't see the loading screen up to 3.5sec
setTimeout(() => {
// then we let them see that for just a little longer time
// to reduce the "flashy" feeling when netowrk condition is pretty ideal
// to reduce the "flashy" feeling when network condition is pretty ideal
this.$emit("result", data)
this.result.busy = false
}, Math.random() * 500 + 2000)
Expand All @@ -246,6 +247,7 @@
snackbar.networkError()
this.result.busy = false
})
this.$probe.reportExecutedAdvancedQuery(marshalled)
},
cancel () {
this.result.busy = false
Expand Down
3 changes: 2 additions & 1 deletion src/components/global/RandomBackground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import {mapGetters} from "vuex";
import randomUtils from "@/utils/randomUtils";
import {externalService} from "@/utils/service";
import environment from "@/utils/environment";
export default {
name: "RandomBackground",
Expand Down Expand Up @@ -103,7 +104,7 @@
this.webpSupport = await this.testWebp();
}
// P(🔪) = 0.2%
if (Math.random() < 0.002) {
if (environment.debug.frostnova || Math.random() < 0.002) {
return this.getImageUrl("frstar")
}
return this.getImageUrl(randomUtils.cachedRandom.get())
Expand Down
8 changes: 5 additions & 3 deletions src/components/search/GlobalSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@
class="search-results"
:class="{'search-results--dense': pure}"
>
<template #default="{item, active}">
<template #default="{item, index, active}">
<SearchResultNormal
:key="item.id"
:query="debouncedSearch"
:tabindex="active ? 2 : -1"
:result="item"
:index="index"
/>
</template>
</recycle-scroller>
Expand Down Expand Up @@ -105,14 +107,14 @@ export default {
}, 30)
},
results() {
Console.debug('Search', 'performing search with query', this.debouncedSearch)
if (this.debouncedSearch === '') return []
const results = this.engine.search(this.debouncedSearch)
.map(el => ({
...el,
...el.item,
id: `${el.type}_${el.item.stageId || el.item.itemId}`,
}))
Console.debug('Search', 'got result', results)
Console.debug('Search', 'query', this.debouncedSearch, 'got result', results)
return results
},
dependencies() {
Expand Down
22 changes: 22 additions & 0 deletions src/components/search/SearchResultNormal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
<SearchResultItems
v-if="result.type === 'items'"
:result="result"
:index="index"
@click.native="sendProbe"
/>
<SearchResultStages
v-else-if="result.type === 'stages'"
:result="result"
:index="index"
@click.native="sendProbe"
/>
<div v-else>
unknown type of result {{ result.type }}
Expand All @@ -22,6 +26,24 @@ export default {
result: {
type: Object,
required: true
},
index: {
type: Number,
required: true
},
query: {
type: String,
required: true
}
},
methods: {
sendProbe() {
this.$probe.reportEnteredSearchResult({
stageId: this.result.stageId,
itemId: this.result.itemId,
query: this.query,
position: this.index
})
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/search/SearchResultStages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default {
result: {
type: Object,
required: true
},
}
},
computed: {
name() {
Expand Down
17 changes: 15 additions & 2 deletions src/config/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const version = "v3.4.1";
const version = "v3.4.2";
const project = "frontend-v2";

module.exports = {
Expand Down Expand Up @@ -31,5 +31,18 @@ module.exports = {
pagination: 5
}
},
servers: ["CN", "US", "JP", "KR"]
servers: ["CN", "US", "JP", "KR"],
probe: {
endpoint: {
prod: {
ws: "wss://probe.penguin-stats.io/",
legacy: "https://probe.penguin-stats.io/"
},
dev: {
ws: "ws://localhost:8100/",
legacy: "http://localhost:8100/"
},
},
uidExpiration: 1000 * 60 * 24 * 180
}
}
30 changes: 22 additions & 8 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import 'vuetify/dist/vuetify.min.css'
import store from './store'
import router from './router'
import i18n from "@/i18n"

import {Plugins} from '@capacitor/core'
import '@/components/functional'
import environment from "@/utils/environment";
const { Device } = Plugins

import './injections'
import PenguinProbe from "@/utils/probe";

if (!window.Intl) require("intl-collator")

Expand All @@ -22,10 +24,22 @@ Vue.config.productionTip = false
Vue.config.performance = environment.debug.performance
Vue.config.devtools = environment.debug.devtools

new Vue({
vuetify,
router,
store,
i18n,
render: h => h(App),
}).$mount('#app');
async function bootstrap() {
window.$device = Vue.prototype.$device = {
batteryInfo: await Device.getBatteryInfo(),
info: await Device.getInfo(),
languageCode: await Device.getLanguageCode()
}

Vue.prototype.$probe = new PenguinProbe()

new Vue({
vuetify,
router,
store,
i18n,
render: h => h(App),
}).$mount('#app');
}

bootstrap()
2 changes: 2 additions & 0 deletions src/mixins/hooks/GlobalEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Localization from "@/mixins/hooks/Localization";
import RandomizedLogo from "@/mixins/hooks/RandomizedLogo";
import StoreUpgrader from "@/mixins/hooks/StoreUpgrader";
import Native from "@/mixins/hooks/Native";
import Probe from "@/mixins/hooks/Probe";

export default {
mixins: [
Expand All @@ -21,6 +22,7 @@ export default {
RandomizedLogo,
Telemetry,
Analytics,
Probe,

// last priority
CrispCustomizer
Expand Down
14 changes: 7 additions & 7 deletions src/mixins/hooks/Native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@ export default {
Console.info("Build", `Hello from Penguin Statistics! :D Running platform '${PENGUIN_PLATFORM}'`)

App.addListener('appUrlOpen', function( data ){
Console.info("NativeBridge:App", "App opened with URL", data)
Console.info("Capacitor:App", "App opened with URL", data)
const path = new URL(data.url).pathname.replace(/\/+/g, "/")

// We only push to the route if there is a slug present
if ( path ){
if (path){
router.push({ path });
}
});

App.addListener('appRestoredResult', function(data) {
Console.info("NativeBridge:App", 'App restored with state', data);
Console.info("Capacitor:App", 'App restored with state', data);
});

App.addListener("appStateChange", function(data) {
Console.info("NativeBridge:App", 'App state changed with new state', data);
Console.info("Capacitor:App", 'App state changed with new state', data);
})

if (Capacitor.isPluginAvailable('PenguinPlugin')) {
PenguinPlugin.addListener("networkPathChanged", function(data) {
Console.info("NativeBridge:PenguinPlugin", 'Network Path Changed', data);
Console.info("Capacitor:(penguin)", 'Network Path Changed', data);
})

PenguinPlugin.addListener("eventBus", function (event) {
Console.info("NativeBridge:PenguinPlugin:eventBus", "received event", event)
Console.info("Capacitor:(penguin):eventBus", "received event", event)
if (event.type === "navigate") router.push({ path: event.value })
})

PenguinPlugin.listenerReady()

PenguinPlugin.getLocalizationEnvironment()
.then(value => {
Console.info("NativeBridge:PenguinPlugin", "Localization Environment as", value)
Console.info("Capacitor:(penguin)", "Localization Environment as", value)
})
}

Expand Down
7 changes: 7 additions & 0 deletions src/mixins/hooks/Probe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
watch: {
$route (newValue) {
this.$probe.reportNavigated(newValue.path)
}
}
}
Loading

0 comments on commit e1c007f

Please sign in to comment.