Allow downloading shareX config file

This commit is contained in:
Pitu 2019-03-02 02:45:31 +09:00
parent 73d85e8c79
commit 0ed4624dd0
3 changed files with 40 additions and 2 deletions

View File

@ -43,6 +43,7 @@
"dumper.js": "^1.3.1",
"express": "^4.16.4",
"express-rate-limit": "^3.4.0",
"file-saver": "^2.0.1",
"fluent-ffmpeg": "^2.1.2",
"fs-jetpack": "^2.2.2",
"fuse.js": "^3.4.0",

View File

@ -72,7 +72,9 @@
<p class="bd-footer-subtitle">Deploy your own lolisafe</p>
</header>
</a>
<div class="link">
<div v-if="loggedIn"
class="link"
@click="createShareXThing">
<header class="bd-footer-star-header">
<h4 class="bd-footer-title">ShareX</h4>
<p class="bd-footer-subtitle">Upload from your Desktop</p>
@ -96,5 +98,35 @@
</div>
</template>
<script>
export default {};
import { saveAs } from 'file-saver';
export default {
computed: {
loggedIn() {
return this.$store.state.loggedIn;
},
token() {
return this.$store.state.token;
}
},
methods: {
createShareXThing() {
const sharexFile = `{
"Name": "${location.hostname}",
"DestinationType": "ImageUploader, FileUploader",
"RequestType": "POST",
"RequestURL": "${location.origin}/api/upload",
"FileFormName": "file",
"Headers": {
"authorization": "${this.token}",
"accept": "application/vnd.lolisafe.json"
},
"ResponseType": "Text",
"URL": "$json:url$",
"ThumbnailURL": "$json:url$"
}`;
const sharexBlob = new Blob([sharexFile], { type: 'application/octet-binary' });
saveAs(sharexBlob, `${location.hostname}.sxcu`);
}
}
};
</script>

View File

@ -3458,6 +3458,11 @@ file-loader@^3.0.1:
loader-utils "^1.0.2"
schema-utils "^1.0.0"
file-saver@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/file-saver/-/file-saver-2.0.1.tgz#7fe2242af1cbc559a29d8176078a8b56d781fa79"
integrity sha512-dCB3K7/BvAcUmtmh1DzFdv0eXSVJ9IAFt1mw3XZfAexodNRoE29l3xB2EX4wH2q8m/UTzwzEPq/ArYk98kUkBQ==
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"