mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-31 07:11:33 +00:00
Removed delete URL from upload response
I wasn't aware ShareX wouldn't do a basic GET request to the delete URL, but would instead open your browser to it. Unfortunately, due to the structure of lolisafe auth setting token through HTTP header, which had always been done by JS as it has to get the value from local storage, just visiting the API from browser will merely respond with "No token provided". We'd need cookie-based auth, which I do not want to add. The old me that added deletion API long ago might have been aware of this fact, but the me of a few hours ago already forgot.. I'll give this further thoughts at a later date, as ShareX isn't really a priority to me. Bumped v1 version string and rebuilt client assets.
This commit is contained in:
parent
b4ab04f55a
commit
40dd662976
@ -753,8 +753,13 @@ self.sendUploadResponse = async (req, res, user, result) => {
|
||||
|
||||
// If uploaded by user, add delete URL (intended for ShareX and its derivatives)
|
||||
// Homepage uploader will not use this (use dashboard instead)
|
||||
// REVISION: I wasn't aware ShareX wouldn't do a basic GET request to this API,
|
||||
// which I hoped would then use the token header in the downloadable ShareX config file.
|
||||
// At its current state, this isn't really usable.
|
||||
/*
|
||||
if (user)
|
||||
map.deleteUrl = `${config.homeDomain}/api/upload/delete/${file.name}`
|
||||
*/
|
||||
|
||||
return map
|
||||
})
|
||||
|
2
dist/js/misc/utils.js
vendored
2
dist/js/misc/utils.js
vendored
@ -1,2 +1,2 @@
|
||||
lsKeys.siBytes="siBytes",page.prepareShareX=function(){var e=document.querySelector("#ShareX");if(e){var t={};page.token&&(t.token=page.token||"",t.albumid=page.album||""),t.filelength=page.fileLength||"",t.age=page.uploadAge||"",t.striptags=page.stripTags||"";var a=(window.location.hostname+window.location.pathname).replace(/\/(dashboard)?$/,""),r=a.replace(/\//g,"_"),o={Name:r,DestinationType:"ImageUploader, FileUploader",RequestMethod:"POST",RequestURL:window.location.protocol+"//"+a+"/api/upload",Headers:t,Body:"MultipartFromData",FileFormName:"files[]",URL:"$json:files[0].url$",ThumbnailURL:"$json:files[0].url$"};page.token&&(o.DeletionURL="$json:files[0].deleteUrl$");var n=JSON.stringify(o,null,2),i=new Blob([n],{type:"application/octet-binary"});e.setAttribute("href",URL.createObjectURL(i)),e.setAttribute("download",r+".sxcu")}},page.getPrettyDate=function(e){return e.getFullYear()+"/"+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"/"+(e.getDate()<10?"0":"")+e.getDate()+" "+(e.getHours()<10?"0":"")+e.getHours()+":"+(e.getMinutes()<10?"0":"")+e.getMinutes()+":"+(e.getSeconds()<10?"0":"")+e.getSeconds()},page.getPrettyBytes=function(e){if("number"!=typeof e&&!isFinite(e))return e;var t="0"!==localStorage[lsKeys.siBytes],a=e<0?"-":"",r=t?1e3:1024;if(a&&(e=-e),e<r)return""+a+e+" B";var o=Math.min(Math.floor(Math.log(e)*Math.LOG10E/3),8);return""+a+Number((e/Math.pow(r,o)).toPrecision(3))+" "+((t?"kMGTPEZY":"KMGTPEZY").charAt(o-1)+(t?"":"i"))+"B"},page.escape=function(e){if(!e)return e;var t,a=String(e),r=/["'&<>]/.exec(a);if(!r)return a;var o="",n=0,i=0;for(n=r.index;n<a.length;n++){switch(a.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}i!==n&&(o+=a.substring(i,n)),i=n+1,o+=t}return i!==n?o+a.substring(i,n):o};
|
||||
lsKeys.siBytes="siBytes",page.prepareShareX=function(){var e=document.querySelector("#ShareX");if(e){var t={};page.token&&(t.token=page.token||"",t.albumid=page.album||""),t.filelength=page.fileLength||"",t.age=page.uploadAge||"",t.striptags=page.stripTags||"";var a=(window.location.hostname+window.location.pathname).replace(/\/(dashboard)?$/,""),r=a.replace(/\//g,"_"),o={Name:r,DestinationType:"ImageUploader, FileUploader",RequestMethod:"POST",RequestURL:window.location.protocol+"//"+a+"/api/upload",Headers:t,Body:"MultipartFromData",FileFormName:"files[]",URL:"$json:files[0].url$",ThumbnailURL:"$json:files[0].url$"},n=JSON.stringify(o,null,2),i=new Blob([n],{type:"application/octet-binary"});e.setAttribute("href",URL.createObjectURL(i)),e.setAttribute("download",r+".sxcu")}},page.getPrettyDate=function(e){return e.getFullYear()+"/"+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"/"+(e.getDate()<10?"0":"")+e.getDate()+" "+(e.getHours()<10?"0":"")+e.getHours()+":"+(e.getMinutes()<10?"0":"")+e.getMinutes()+":"+(e.getSeconds()<10?"0":"")+e.getSeconds()},page.getPrettyBytes=function(e){if("number"!=typeof e&&!isFinite(e))return e;var t="0"!==localStorage[lsKeys.siBytes],a=e<0?"-":"",r=t?1e3:1024;if(a&&(e=-e),e<r)return""+a+e+" B";var o=Math.min(Math.floor(Math.log(e)*Math.LOG10E/3),8);return""+a+Number((e/Math.pow(r,o)).toPrecision(3))+" "+((t?"kMGTPEZY":"KMGTPEZY").charAt(o-1)+(t?"":"i"))+"B"},page.escape=function(e){if(!e)return e;var t,a=String(e),r=/["'&<>]/.exec(a);if(!r)return a;var o="",n=0,i=0;for(n=r.index;n<a.length;n++){switch(a.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}i!==n&&(o+=a.substring(i,n)),i=n+1,o+=t}return i!==n?o+a.substring(i,n):o};
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
2
dist/js/misc/utils.js.map
vendored
2
dist/js/misc/utils.js.map
vendored
File diff suppressed because one or more lines are too long
@ -33,8 +33,10 @@ page.prepareShareX = () => {
|
||||
ThumbnailURL: '$json:files[0].url$'
|
||||
}
|
||||
|
||||
/*
|
||||
if (page.token)
|
||||
sharexConfObj.DeletionURL = '$json:files[0].deleteUrl$'
|
||||
*/
|
||||
|
||||
const sharexConfStr = JSON.stringify(sharexConfObj, null, 2)
|
||||
const sharexBlob = new Blob([sharexConfStr], { type: 'application/octet-binary' })
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"1": "1592598701",
|
||||
"1": "1592600474",
|
||||
"2": "1589010026",
|
||||
"3": "1581416390",
|
||||
"4": "1581416390",
|
||||
|
Loading…
Reference in New Issue
Block a user