From f3dc0ffe7507915710ce2c5d36ba9125394a262e Mon Sep 17 00:00:00 2001
From: Pitu <heyitspitu@gmail.com>
Date: Thu, 7 Jan 2021 19:03:47 +0900
Subject: chore: update sharex snippet to use apiKey instead of jwt

---
 src/site/components/footer/Footer.vue | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

(limited to 'src/site/components/footer/Footer.vue')

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`);
-- 
cgit v1.2.3

