Skip to content

Commit

Permalink
Merge pull request #241 from penguin-statistics/feat-change-cdn
Browse files Browse the repository at this point in the history
Changed CDN; Added Crisp.chat
  • Loading branch information
AlvISsReimu authored Mar 26, 2020
2 parents 932354b + 077fdb1 commit ce03946
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://penguin-stats.s3.ap-southeast-1.amazonaws.com/logos/penguin_stats_logo.png"
<img src="https://penguin.upyun.galvincdn.com/logos/penguin_stats_logo.png"
alt="Penguin Statistics - Logo"
style="width: 64px" />

Expand Down
3 changes: 2 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<meta name="msapplication-TileColor" content="#905f6b">
<meta name="theme-color" content="#121212">
<title>企鹅物流数据统计</title>
<link rel="preconnect" href="https://penguin-stats.s3.ap-southeast-1.amazonaws.com">
<link rel="preconnect" href="https://penguin.upyun.galvincdn.com">
<style>#app, body, html {
height: 100vh;
margin: 0;
Expand Down Expand Up @@ -395,6 +395,7 @@
console.error(e);
}
</script>
<script type="text/javascript">window.$crisp=[];window.CRISP_WEBSITE_ID="2aa1bf4c-8c34-4028-9e1c-ca1f6c330779";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.chat/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();</script>
<script>"serviceWorker" in navigator && window.addEventListener("load", function () {
navigator.serviceWorker.register("/service-worker.js")
});</script>
Expand Down
22 changes: 20 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,29 @@ export default {
// report current version
this.$ga.event(
'runtime',
'appInited',
'version',
'current',
'unknown',
config.version
);
// push crisp session
window.$crisp.push(["set", "session:data", [[
["loggedIn", this.$store.getters["auth/loggedIn"]],
["username", this.$store.getters["auth/username"]],
["language", this.$store.getters["settings/language"]],
["dark", this.$store.getters["settings/dark"]],
]]])
window.$crisp.push(["on", "chat:initiated", function () {
// resolve safe-area
try {
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a").style.setProperty("bottom", "calc(max(env(safe-area-inset-bottom), 14px))", "important")
document.querySelector("div.crisp-client > div#crisp-chatbox > div > a > span:nth-child(2)").style.setProperty("box-shadow", "0 0 5px rgba(0, 0, 0, .4)", "important")
} catch (e) {
Console.error("failed to change crisp chat box bottom: ", e)
}
}])
},
methods: {
async refreshData () {
Expand Down
2 changes: 1 addition & 1 deletion src/components/global/ItemIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default {

<style scoped>
.item-icon--sprite {
background-image: url("https://penguin-stats.s3.ap-southeast-1.amazonaws.com/item_sprite.png");
background-image: url("https://penguin.upyun.galvincdn.com/item_sprite.png");
background-repeat: no-repeat;
height: 60px;
width: 60px;
Expand Down
12 changes: 7 additions & 5 deletions src/components/global/RandomBackground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
// [key] is a special "stageId" to display a special "background image"
// [value] represents a "background image url" on such route
specialImageMap: {
"main_06-14": "https://penguin-stats.s3.ap-southeast-1.amazonaws.com/backgrounds/fn_0_1.png", // 6-16
"main_06-15": "https://penguin-stats.s3.ap-southeast-1.amazonaws.com/backgrounds/fn_0_0.png", // 6-17
}
"main_06-14": "https://penguin.upyun.galvincdn.com/backgrounds/fn_0_1.png", // 6-16
"main_06-15": "https://penguin.upyun.galvincdn.com/backgrounds/fn_0_0.png", // 6-17
},
imageRange: 104 + 1 // if x images use ${x + 1}, because Math.random() generates float in [0, 1) range, so we
// need to +1 in order to get the last image also in range
}
},
watch: {
Expand All @@ -58,7 +60,7 @@
},
methods: {
getImageUrl (id) {
return `https://penguin-stats.s3.ap-southeast-1.amazonaws.com/backgrounds/${id}.${this.webpSupport ? 'webp' : 'optimized.png'}`
return `https://penguin.upyun.galvincdn.com/backgrounds/${id}.${this.webpSupport ? 'webp' : 'optimized.png'}`
},
setBlur (flag) {
Console.info("setting blur to", flag)
Expand All @@ -77,7 +79,7 @@
let current = this.last;
// avoid change to the same background than the last one
while (current === this.last) {
current = Math.floor(Math.random() * 70)
current = Math.floor(Math.random() * this.imageRange)
}
this.last = current;
// Console.log(current)
Expand Down
2 changes: 1 addition & 1 deletion src/components/toolbar/NetworkStateIndicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@
padding: 4px 8px;
border-radius: 4px 0 0 4px !important;
margin-bottom: calc(max(env(safe-area-inset-bottom), 8px)) !important;
z-index: 10
z-index: 1000001; /* to override crisp */
}
</style>
2 changes: 1 addition & 1 deletion src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ module.exports = {
submitParams: client
},
cdn: {
global: "https://penguin-stats.s3.ap-southeast-1.amazonaws.com"
global: "https://penguin.upyun.galvincdn.com"
}
}
2 changes: 1 addition & 1 deletion src/views/About/Members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
>
<v-list-item-avatar>
<v-img
:src="'https://penguin-stats.s3.ap-southeast-1.amazonaws.com/avatars/' + profile.avatar"
:src="'https://penguin.upyun.galvincdn.com/avatars/' + profile.avatar"
/>
</v-list-item-avatar>

Expand Down
22 changes: 7 additions & 15 deletions src/views/Planner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,6 @@
</v-card-actions>
</v-card>
</v-dialog>
<v-btn
fab
bottom
right
fixed
ripple
color="primary"
:loading="calculation.pending"
@click="calculate"
>
<v-icon>
mdi-calculator
</v-icon>
</v-btn>
<v-row
align="center"
justify="center"
Expand Down Expand Up @@ -530,6 +516,9 @@
large
v-on="on"
>
<v-icon left>
mdi-file-restore
</v-icon>
{{ $t('actions.importExport') }}
</v-btn>
</template>
Expand Down Expand Up @@ -641,6 +630,9 @@
large
@click="calculate"
>
<v-icon left>
mdi-calculator
</v-icon>
{{ $t('actions.calculate') }}
</v-btn>
</v-row>
Expand Down Expand Up @@ -1069,7 +1061,7 @@
border-radius: 50% !important;
height: 30px !important;
width: 30px !important;
transition: all .125s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: all .225s cubic-bezier(0.165, 0.84, 0.44, 1);
touch-action: manipulation;
}
::v-deep .number-input-theme .number-input__button:hover {
Expand Down

1 comment on commit ce03946

@vercel
Copy link

@vercel vercel bot commented on ce03946 Mar 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.