aboutsummaryrefslogtreecommitdiff
path: root/src/site
diff options
context:
space:
mode:
authorPitu <[email protected]>2021-01-07 19:03:47 +0900
committerPitu <[email protected]>2021-01-07 19:03:47 +0900
commitf3dc0ffe7507915710ce2c5d36ba9125394a262e (patch)
treec80ee29b003f4ea250a680052527ccb3f8bd3b67 /src/site
parentfix: normalize url and thumbnail response (diff)
downloadhost.fuwn.me-f3dc0ffe7507915710ce2c5d36ba9125394a262e.tar.xz
host.fuwn.me-f3dc0ffe7507915710ce2c5d36ba9125394a262e.zip
chore: update sharex snippet to use apiKey instead of jwt
Diffstat (limited to 'src/site')
-rw-r--r--src/site/components/footer/Footer.vue15
-rw-r--r--src/site/components/home/links/Links.vue12
2 files changed, 15 insertions, 12 deletions
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 @@
</div>
</template>
<script>
+import { mapGetters } from 'vuex';
import { saveAs } from 'file-saver';
export default {
computed: {
- loggedIn() {
- return this.$store.state.auth.loggedIn;
- }
+ ...mapGetters({
+ loggedIn: 'auth/isLoggedIn',
+ apiKey: 'auth/getApiKey'
+ })
},
methods: {
createShareXThing() {
@@ -63,12 +65,12 @@ export default {
"RequestURL": "${location.origin}/api/upload",
"FileFormName": "files[]",
"Headers": {
- "authorization": "Bearer ${this.$store.state.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`);