remove file download api
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
/*
|
||||
* Time for a more Java-like approach.
|
||||
*
|
||||
*
|
||||
* Feel free to use this of course
|
||||
*
|
||||
*
|
||||
* Made by Fornax
|
||||
*/
|
||||
|
||||
@@ -36,13 +36,13 @@ var Toolbar = {
|
||||
}
|
||||
},
|
||||
download: function () {
|
||||
$("#frmDownload").attr("src", "/api/file/" + Viewer.currentFile + "/download");
|
||||
$("#frmDownload").attr("src", "/api/file/" + Viewer.currentFile + "?download");
|
||||
},
|
||||
downloadList: function(){
|
||||
if(!Viewer.isList){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$("#frmDownload").attr("src", "/api/list/" + Viewer.listId + "/zip");
|
||||
},
|
||||
copyUrl: function () {
|
||||
@@ -59,7 +59,7 @@ var Toolbar = {
|
||||
$("#btnCopy>span").text("Error!");
|
||||
alert("Your browser does not support copying text.");
|
||||
}
|
||||
|
||||
|
||||
// Return to normal
|
||||
setTimeout(function(){
|
||||
$("#btnCopy>span").text("Copy");
|
||||
|
@@ -70,7 +70,6 @@
|
||||
<h2>File Methods</h2>
|
||||
{{template "api-file-post"}}
|
||||
{{template "api-file-id-get"}}
|
||||
{{template "api-file-id-download-get"}}
|
||||
{{template "api-file-id-info-get"}}
|
||||
{{template "api-file-id-thumbnail-get"}}
|
||||
{{template "api-file-id-delete"}}
|
||||
|
@@ -80,6 +80,11 @@
|
||||
Returns the full file associated with the ID. Supports
|
||||
byte range requests.
|
||||
</p>
|
||||
<p>
|
||||
When '?download' is added to the URL the server will send an
|
||||
attachment header instead of inline rendering, which causes the
|
||||
browser to show a 'Save File' dialog.
|
||||
</p>
|
||||
<h3>Parameters</h3>
|
||||
<table>
|
||||
<tr>
|
||||
@@ -94,25 +99,18 @@
|
||||
<td>URL</td>
|
||||
<td>ID of the file to request</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>download</td>
|
||||
<td>false</td>
|
||||
<td>URL</td>
|
||||
<td>Sends file attachment instead of inline</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3>Returns</h3>
|
||||
A file output stream.
|
||||
</div>
|
||||
</details>
|
||||
{{end}}
|
||||
{{define "api-file-id-download-get"}}
|
||||
<details class="api_doc_details request_get">
|
||||
<summary><span class="method">GET</span>/file/{id}/download</summary>
|
||||
<div>
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
Same as GET /file/{id}, but with File Transfer HTTP
|
||||
headers. Will trigger a save file dialog when opened in
|
||||
a web browser. Also supports byte range requests.
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
{{end}}
|
||||
{{define "api-file-id-info-get"}}
|
||||
<details class="api_doc_details request_get">
|
||||
<summary><span class="method">GET</span>/file/{id}/info</summary>
|
||||
|
@@ -49,7 +49,7 @@ type filePreview struct {
|
||||
func (f filePreview) run(inf *pixelapi.FileInfo) string {
|
||||
f.FileInfo = inf
|
||||
f.FileURL = f.APIURL + "/file/" + f.FileInfo.ID
|
||||
f.DownloadURL = f.APIURL + "/file/" + f.FileInfo.ID + "/download"
|
||||
f.DownloadURL = f.APIURL + "/file/" + f.FileInfo.ID + "?download"
|
||||
|
||||
if strings.HasPrefix(f.FileInfo.MimeType, "image") {
|
||||
return f.image()
|
||||
|
Reference in New Issue
Block a user