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