chore: update sharex snippet to use apiKey instead of jwt
This commit is contained in:
parent
46ec3f7168
commit
f3dc0ffe75
|
@ -11,7 +11,8 @@ class verifyGET extends Route {
|
|||
user: {
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
isAdmin: user.isAdmin
|
||||
isAdmin: user.isAdmin,
|
||||
apiKey: user.apiKey
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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`);
|
||||
|
|
|
@ -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`);
|
||||
|
|
Loading…
Reference in New Issue