update pdf viewer and remove CORS check

This commit is contained in:
2020-02-04 22:29:48 +01:00
parent 3ebf9785da
commit 754fcb7f21
72 changed files with 1507 additions and 79890 deletions

View File

@@ -51,10 +51,7 @@ function Viewer(type, viewToken, data) {
document.getElementById("stat_views").remove()
document.getElementById("stat_downloads_label").remove()
document.getElementById("stat_downloads").remove()
let file = fileFromSkyNet(data)
console.log(file)
this.setFile(file)
this.setFile(fileFromSkyNet(data))
}
this.renderSponsors()
@@ -247,7 +244,7 @@ function fileFromSkyNet(resp) {
let file = fileFromAPIResp(resp)
file.icon_href = "/res/img/mime/empty.png"
file.get_href = "https://siasky.net/"+resp.id
file.download_href = "https://siasky.net/"+resp.id
file.download_href = "https://siasky.net/"+resp.id+"?attachment=1"
file.availability_href = ""
file.view_href = ""
file.timeseries_href = ""

View File

@@ -5,7 +5,7 @@ function PDFViewer(viewer, file) {
this.container = document.createElement("iframe")
this.container.classList = "image-container"
this.container.style.border = "none"
this.container.src = "/res/misc/pdf-viewer/web/viewer.html?file="+this.file.get_href
this.container.src = "/res/misc/pdf-viewer/web/viewer.html?file="+encodeURIComponent(this.file.get_href)
}
PDFViewer.prototype.render = function(parent) {
parent.appendChild(this.container)