diff --git a/res/static/res/script/compiled/home.js b/res/static/res/script/compiled/home.js index ad69f60..1eb74d8 100644 --- a/res/static/res/script/compiled/home.js +++ b/res/static/res/script/compiled/home.js @@ -33,7 +33,8 @@ var UploadProgressBar = /** @class */ (function () { UploadProgressBar.prototype.onFailure = function (response, error) { this.uploadDiv.setAttribute('style', 'background: #821C40'); this.uploadDivJQ.html(this.file.name + '
' - + 'Upload failed after three tries!'); + + 'Upload failed after three tries!
' + + "Message: " + error); }; return UploadProgressBar; }()); @@ -161,14 +162,14 @@ var UploadWorker = /** @class */ (function () { UploadWorker.prototype.upload = function (file) { console.debug("Starting upload of " + file.name); var formData = new FormData(); - formData.append('file', file.file); formData.append("name", file.name); + formData.append('file', file.file); var that = this; // jquery changes the definiton of "this" $.ajax({ type: 'POST', url: apiEndpoint + "/file", data: formData, - timeout: 7200000, + timeout: 21600000, cache: false, async: true, crossDomain: false, @@ -192,7 +193,6 @@ var UploadWorker = /** @class */ (function () { error: function (xhr, status, error) { console.log("status: " + status + " error: " + error); if (that.tries === 3) { - alert("Upload failed: " + status); file.onFailure(status, error); setTimeout(function () { that.newFile(); }, 2000); // Try to continue return; // Upload failed diff --git a/res/static/res/style/layout.css b/res/static/res/style/layout.css index 2f386d4..d166f9d 100644 --- a/res/static/res/style/layout.css +++ b/res/static/res/style/layout.css @@ -16,7 +16,7 @@ body{ font-family: 'Ubuntu', sans-serif; margin: 0; text-align: center; /* Center the header and body */ - line-height: 140%; + line-height: 1.5em; height: 100%; overflow-x: hidden; color: var(--text_color); @@ -116,6 +116,7 @@ body{ /* Common elements */ +h1, h2, h3, h4, h5, h6 {line-height: 1em;} h3{border-bottom: 1px var(--accent_color_light_border) solid;} /* Differentiate it a bit, else it just looks like bold text */ hr{ diff --git a/res/static/res/typescript/home/home.ts b/res/static/res/typescript/home/home.ts index 9c8134d..633563e 100644 --- a/res/static/res/typescript/home/home.ts +++ b/res/static/res/typescript/home/home.ts @@ -54,7 +54,8 @@ class UploadProgressBar implements FileUpload { this.uploadDiv.setAttribute('style', 'background: #821C40') this.uploadDivJQ.html( this.file.name+'
' - + 'Upload failed after three tries!' + + 'Upload failed after three tries!
' + + "Message: " + error ) } } diff --git a/res/static/res/typescript/lib/uploader.ts b/res/static/res/typescript/lib/uploader.ts index 7cf2f00..2ff4386 100644 --- a/res/static/res/typescript/lib/uploader.ts +++ b/res/static/res/typescript/lib/uploader.ts @@ -68,8 +68,8 @@ class UploadWorker { console.debug("Starting upload of " + file.name) var formData = new FormData() - formData.append('file', file.file) formData.append("name", file.name) + formData.append('file', file.file) var that = this // jquery changes the definiton of "this" @@ -77,7 +77,7 @@ class UploadWorker { type: 'POST', url: apiEndpoint+"/file", data: formData, - timeout: 7200000, // 2 hours + timeout: 21600000, // 6 hours, to account for slow connections cache: false, async: true, crossDomain: false, @@ -103,7 +103,6 @@ class UploadWorker { console.log("status: "+status+" error: "+error) if (that.tries === 3) { - alert("Upload failed: " + status); file.onFailure(status, error) setTimeout(function(){that.newFile()}, 2000) // Try to continue diff --git a/res/template/apidoc.html b/res/template/apidoc.html index e070b2b..20908a2 100644 --- a/res/template/apidoc.html +++ b/res/template/apidoc.html @@ -55,6 +55,18 @@ relative to that URL.

+

Form value order

+

+ I recommend you put files at the end of every file upload form. + By doing this the pixeldrain server can respond to malformed + requests before the file upload finishes and this may save you a + lot of time and bandwidth when uploading large files. Make sure + your HTTP client has support for premature responses, pixeldrain + uses them a lot. If the server responds before your request is + finished it will always indicate an error and you may abort the + connection. +

+

File Methods

{{template "api-file-post"}} {{template "api-file-id-get"}} diff --git a/res/template/fragments/api/file.html b/res/template/fragments/api/file.html index fb0f1f8..3c8d034 100644 --- a/res/template/fragments/api/file.html +++ b/res/template/fragments/api/file.html @@ -16,13 +16,6 @@ Default Description - - file - true - 5 000 000 000 Bytes - none - Multipart file to upload - name false @@ -30,6 +23,13 @@ Multipart file name Name of the file to upload + + file + true + 5 000 000 000 Bytes + none + Multipart file to upload +

Returns