updated ss script again

This commit is contained in:
Alex / Awex
2021-07-15 11:23:44 -04:00
parent afe96a2c52
commit 6f77632c27
+4 -3
View File
@@ -1,12 +1,13 @@
async function getFileUrl() { async function getFileUrl() {
const params = new URLSearchParams(window.location.search) const params = new URLSearchParams(window.location.search)
let title = params.get('photo') let title = params.get('photo')
let apiurl = `https://${window.location.host}/screenshots?title=${title}` let apiurl = `http://${window.location.host}/screenshots?title=${title}`
let pageURL = `https://${window.location.host}/view?photo=${title}` let pageURL = `http://${window.location.host}/view?photo=${title}`
if(title) { if(title) {
try{ try{
const { response } = await fetch(apiurl).then(response => response.json()); const { response } = await fetch(apiurl).then(response => response.json());
console.log(response)
let date = response.date; let date = response.date;
let photourl = response.directurl; let photourl = response.directurl;
var dateStr = new Date(); var dateStr = new Date();
@@ -37,7 +38,7 @@ async function getFileUrl() {
const params = new URLSearchParams(window.location.search) const params = new URLSearchParams(window.location.search)
let title = params.get('photo') let title = params.get('photo')
var secret = document.querySelector("#secret").value var secret = document.querySelector("#secret").value
const delfile = await fetch(`https://${window.location.host}/delete/${title}`, { const delfile = await fetch(`http://${window.location.host}/delete/${title}`, {
method: "DELETE", method: "DELETE",
headers: { "secret": `${secret}`} headers: { "secret": `${secret}`}
}) })