Update screenshot.js
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
let url = window.location.hostname
|
|
||||||
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.hostname}/screenshots?title=${title}`
|
let apiurl = `http://${window.location.host}/screenshots?title=${title}`
|
||||||
|
let pageURL = `http://${window.location.host}/view?photo=${title}`
|
||||||
|
|
||||||
if(title) {
|
if(title) {
|
||||||
try{
|
try{
|
||||||
@@ -13,7 +13,7 @@ async function getFileUrl() {
|
|||||||
|
|
||||||
document.querySelector('meta[name="img"]').setAttribute("content", photourl)
|
document.querySelector('meta[name="img"]').setAttribute("content", photourl)
|
||||||
document.querySelector('meta[name="title"]').setAttribute("content", `Awex's screenshot from ${dateStr}`)
|
document.querySelector('meta[name="title"]').setAttribute("content", `Awex's screenshot from ${dateStr}`)
|
||||||
document.querySelector('meta[name="url"]').setAttribute("content", url)
|
document.querySelector('meta[name="url"]').setAttribute("content", pageURL)
|
||||||
|
|
||||||
document.getElementById("title").innerHTML = (`Screenshot from ${date}`)
|
document.getElementById("title").innerHTML = (`Screenshot from ${date}`)
|
||||||
document.getElementById("date").innerHTML = (`<h3>Screenshot from:<br> ${date}</h3>`)
|
document.getElementById("date").innerHTML = (`<h3>Screenshot from:<br> ${date}</h3>`)
|
||||||
@@ -33,11 +33,11 @@ async function getFileUrl() {
|
|||||||
err.style.display = "block";
|
err.style.display = "block";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteSS() {
|
async function deleteSS() {
|
||||||
|
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.hostname}/delete/${title}`, {
|
const delfile = await fetch(`http://${window.location.host}/delete/${title}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: { "secret": `${secret}`}
|
headers: { "secret": `${secret}`}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user