From f3dc0ffe7507915710ce2c5d36ba9125394a262e Mon Sep 17 00:00:00 2001 From: Pitu Date: Thu, 7 Jan 2021 19:03:47 +0900 Subject: chore: update sharex snippet to use apiKey instead of jwt --- src/api/routes/verifyGET.js | 3 ++- src/site/components/footer/Footer.vue | 15 ++++++++------- src/site/components/home/links/Links.vue | 12 +++++++----- 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/api/routes/verifyGET.js b/src/api/routes/verifyGET.js index 2f370e8..c94c155 100644 --- a/src/api/routes/verifyGET.js +++ b/src/api/routes/verifyGET.js @@ -11,7 +11,8 @@ class verifyGET extends Route { user: { id: user.id, username: user.username, - isAdmin: user.isAdmin + isAdmin: user.isAdmin, + apiKey: user.apiKey } }); } diff --git a/src/site/components/footer/Footer.vue b/src/site/components/footer/Footer.vue index 38e3f07..96774e7 100644 --- a/src/site/components/footer/Footer.vue +++ b/src/site/components/footer/Footer.vue @@ -35,11 +35,12 @@ import { saveAs } from 'file-saver'; export default { computed: { - ...mapGetters({ loggedIn: 'auth/isLoggedIn' }), + ...mapGetters({ + loggedIn: 'auth/isLoggedIn', + apiKey: 'auth/getApiKey' + }), ...mapState({ - version: state => state.config.version, - serviceName: state => state.config.serviceName, - token: state => state.auth.token + version: state => state.config.version }), getYear() { return new Date().getFullYear(); @@ -48,18 +49,18 @@ export default { methods: { createShareXThing() { const sharexFile = `{ - "Name": "${this.serviceName}", + "Name": "${this.$store.state.config.serviceName}", "DestinationType": "ImageUploader, FileUploader", "RequestType": "POST", "RequestURL": "${location.origin}/api/upload", "FileFormName": "files[]", "Headers": { - "authorization": "Bearer ${this.token}", + "token": "${this.apiKey}", "accept": "application/vnd.chibisafe.json" }, "ResponseType": "Text", "URL": "$json:url$", - "ThumbnailURL": "$json:url$" + "ThumbnailURL": "$json:thumb$" }`; const sharexBlob = new Blob([sharexFile], { type: 'application/octet-binary' }); saveAs(sharexBlob, `${location.hostname}.sxcu`); diff --git a/src/site/components/home/links/Links.vue b/src/site/components/home/links/Links.vue index 05915b9..6777f44 100644 --- a/src/site/components/home/links/Links.vue +++ b/src/site/components/home/links/Links.vue @@ -46,13 +46,15 @@ diff --git a/src/site/components/statistics/byteUsage.vue b/src/site/components/statistics/byteUsage.vue new file mode 100644 index 0000000..740feff --- /dev/null +++ b/src/site/components/statistics/byteUsage.vue @@ -0,0 +1,31 @@ + + diff --git a/src/site/components/statistics/detailed.vue b/src/site/components/statistics/detailed.vue new file mode 100644 index 0000000..8a0722e --- /dev/null +++ b/src/site/components/statistics/detailed.vue @@ -0,0 +1,33 @@ + + diff --git a/src/site/components/statistics/generic.vue b/src/site/components/statistics/generic.vue new file mode 100644 index 0000000..704be7a --- /dev/null +++ b/src/site/components/statistics/generic.vue @@ -0,0 +1,26 @@ + + diff --git a/src/site/components/statistics/time.vue b/src/site/components/statistics/time.vue new file mode 100644 index 0000000..ff1bb8d --- /dev/null +++ b/src/site/components/statistics/time.vue @@ -0,0 +1,46 @@ + + diff --git a/src/site/pages/dashboard/admin/statistics.vue b/src/site/pages/dashboard/admin/statistics.vue new file mode 100644 index 0000000..3a2891c --- /dev/null +++ b/src/site/pages/dashboard/admin/statistics.vue @@ -0,0 +1,103 @@ + + + + diff --git a/src/site/store/admin.js b/src/site/store/admin.js index 58b63b5..b2d1926 100644 --- a/src/site/store/admin.js +++ b/src/site/store/admin.js @@ -11,7 +11,8 @@ export const state = () => ({ files: [] }, file: {}, - settings: {} + settings: {}, + statistics: {} }); export const actions = { @@ -21,6 +22,12 @@ export const actions = { return response; }, + async fetchStatistics({ commit }) { + const response = await this.$axios.$get('service/statistics'); + commit('setStatistics', response); + + return response; + }, async fetchUsers({ commit }) { const response = await this.$axios.$get('admin/users'); commit('setUsers', response); @@ -89,6 +96,9 @@ export const mutations = { setSettings(state, { config }) { state.settings = config; }, + setStatistics(state, { statistics }) { + state.statistics = statistics; + }, setUsers(state, { users }) { state.users = users; }, -- cgit v1.2.3 From be6ce9ac5aba9b8e79528707a3e7661f07b69bf4 Mon Sep 17 00:00:00 2001 From: Pitu Date: Thu, 7 Jan 2021 23:05:15 +0900 Subject: fix: indentation --- src/site/pages/dashboard/admin/statistics.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/site/pages/dashboard/admin/statistics.vue b/src/site/pages/dashboard/admin/statistics.vue index 3a2891c..4d601cf 100644 --- a/src/site/pages/dashboard/admin/statistics.vue +++ b/src/site/pages/dashboard/admin/statistics.vue @@ -96,8 +96,8 @@ h2.title { } div.stats-container { padding: 1rem; - background: #1c1e23; - box-shadow: rgba(15, 17, 21, 0.35) 0px 6px 9px 0px; + background: #1c1e23; + box-shadow: rgba(15, 17, 21, 0.35) 0px 6px 9px 0px; margin-bottom: 1rem; } -- cgit v1.2.3