fix skynet links

This commit is contained in:
2020-02-11 21:52:14 +01:00
parent 9912497c2d
commit 0fea58d27d
3 changed files with 6 additions and 5 deletions

View File

@@ -99,7 +99,7 @@ UploadManager.prototype.uploadThread = function() {
console.debug("Starting upload of " + job.name); console.debug("Starting upload of " + job.name);
let form = new FormData(); let form = new FormData();
form.append('file', job.file); form.append('file', job.file, job.name);
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", this.uploadEndpoint, true); xhr.open("POST", this.uploadEndpoint, true);

View File

@@ -243,8 +243,8 @@ function fileFromAPIResp(resp) {
function fileFromSkyNet(resp) { function fileFromSkyNet(resp) {
let file = fileFromAPIResp(resp) let file = fileFromAPIResp(resp)
file.icon_href = "/res/img/mime/empty.png" file.icon_href = "/res/img/mime/empty.png"
file.get_href = "https://sky.pixeldrain.com/"+resp.id file.get_href = "https://sky.pixeldrain.com/file/"+resp.id
file.download_href = "https://sky.pixeldrain.com/"+resp.id+"?attachment=1" file.download_href = "https://sky.pixeldrain.com/file/"+resp.id+"?attachment=1"
file.availability_href = "" file.availability_href = ""
file.view_href = "" file.view_href = ""
file.timeseries_href = "" file.timeseries_href = ""

View File

@@ -165,7 +165,7 @@ func (wc *WebController) serveSkynetViewer(w http.ResponseWriter, r *http.Reques
// Get the first few bytes from the file to probe the content type and // Get the first few bytes from the file to probe the content type and
// length // length
rq, err := http.NewRequest("GET", "https://sky.pixeldrain.com/"+p.ByName("id"), nil) rq, err := http.NewRequest("GET", "https://sky.pixeldrain.com/file/"+p.ByName("id"), nil)
if err != nil { if err != nil {
log.Warn("Failed to make request to sia portal: %s", err) log.Warn("Failed to make request to sia portal: %s", err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
@@ -183,7 +183,8 @@ func (wc *WebController) serveSkynetViewer(w http.ResponseWriter, r *http.Reques
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode >= 500 { if resp.StatusCode >= 500 {
log.Warn("Sia portal returned error: %s", err) head, _ := ioutil.ReadAll(resp.Body)
log.Warn("Sia portal returned error: %s", head)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
wc.templates.Get().ExecuteTemplate(w, "500", templateData) wc.templates.Get().ExecuteTemplate(w, "500", templateData)
return return