mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-15 08:56:21 +00:00
3a398721b5
* Replaced all instances of getElementById and getElementsByClassName with querySelector or querySelectorAll. * Updated utilsController.js to stop disabling no-async-promise-executor eslint rule. * Removed unused lines in dashboard.njk. * Refactored maxFileSize to maxSize in home.{css,js,njk}. * Updated ClamAV codes in lolisafe.js. No more pinging. Since querying version will also check connection anyway. * Option "Upload to album" in homepage is now selectable. Selecting this option will restore the uploader to not associate files with an album. * Fixed uploader to properly respect server's max file size. Also updated error message of file size to use MB instead of MiB. * Creating an album from homepage will automatically select the album. * Updated Dropzone.js to v5.5.0. * Bumped v1 & v3 version strings. * Various other small fixes.
25 lines
865 B
JavaScript
25 lines
865 B
JavaScript
/* global page */
|
|
|
|
page.prepareShareX = function () {
|
|
if (!page.token) return
|
|
const origin = (location.hostname + location.pathname).replace(/\/(dashboard)?$/, '')
|
|
const originClean = origin.replace(/\//g, '_')
|
|
const sharexElement = document.querySelector('#ShareX')
|
|
const sharexFile = `{
|
|
"Name": "${originClean}",
|
|
"DestinationType": "ImageUploader, FileUploader",
|
|
"RequestType": "POST",
|
|
"RequestURL": "${location.protocol}//${origin}/api/upload",
|
|
"FileFormName": "files[]",
|
|
"Headers": {
|
|
"token": "${page.token}"
|
|
},
|
|
"ResponseType": "Text",
|
|
"URL": "$json:files[0].url$",
|
|
"ThumbnailURL": "$json:files[0].url$"
|
|
}\n`
|
|
const sharexBlob = new Blob([sharexFile], { type: 'application/octet-binary' })
|
|
sharexElement.setAttribute('href', URL.createObjectURL(sharexBlob))
|
|
sharexElement.setAttribute('download', `${originClean}.sxcu`)
|
|
}
|