From f067eabd0556430e78fef0f9fa6f823f2d4a90d2 Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Thu, 7 Jun 2018 21:03:35 +0200 Subject: [PATCH] update docs to reflect api changes --- .gitignore | 2 +- conf/config.go | 2 +- res/template/apidoc.html | 15 ++++++++++++++- res/template/fragments/api/file-post.html | 19 +++---------------- res/template/paste.html | 2 -- webcontroller/filePreview.go | 2 +- 6 files changed, 20 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index f64d2da..135069d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .vscode main -pdwebconfig.toml \ No newline at end of file +pdwebconf.toml diff --git a/conf/config.go b/conf/config.go index 2f7e403..5cf9336 100644 --- a/conf/config.go +++ b/conf/config.go @@ -11,7 +11,7 @@ import ( var vi *viper.Viper var defaultConfig = `# Pixeldrain Web UI server configuration -api_url_external = "/api" # Used in the web browser, can be a relative path +api_url_external = "https://sia.pixeldrain.com/api" # Used in the web browser, should be a full URL. Not ending with a slash api_url_internal = "http://127.0.0.1:8080/api" # Used for internal API requests to the pixeldrain server, not visible to users static_resource_dir = "res/static" template_dir = "res/template" diff --git a/res/template/apidoc.html b/res/template/apidoc.html index 400216f..c6c49f4 100644 --- a/res/template/apidoc.html +++ b/res/template/apidoc.html @@ -43,7 +43,20 @@ resource do require an API key.

- Though API keys have not been implemented yet. + Though API keys have not been implemented yet, so you can't use + those methods yet. +

+

+ Some JSON responses include fields which end in "_href" (some + people don't know this, but "href" stands for "Hypertext + Reference", the more you know). These point to different places + in the API, which you can retrieve with a GET request. The path + is to be appended to the API URL, so "/file/someid/thumbnail" + becomes "{{apiUrl}}/file/someid/thumbnail". +

+

+ The base URL for the API is "{{apiUrl}}", all paths below are + relative to that URL.

File Methods

diff --git a/res/template/fragments/api/file-post.html b/res/template/fragments/api/file-post.html index 4030dad..e4c64a8 100644 --- a/res/template/fragments/api/file-post.html +++ b/res/template/fragments/api/file-post.html @@ -26,17 +26,10 @@ name false - 300 Characters - Name of file param + 255 Characters + Multipart file name Name of the file to upload - - description - false - 5000 Characters - Pixeldrain File - Description of the file -

Returns

@@ -73,13 +66,7 @@ { "success": false, "value": "name_too_long", - "message": "File Name is too long, Max 300 characters allowed." -} -
HTTP 413: Payload Too Large
-{
-	"success": false,
-	"value": "description_too_long",
-	"message": "File Description is too long, Max 5000 characters allowed."
+	"message": "File Name is too long, Max 255 characters allowed."
 }
diff --git a/res/template/paste.html b/res/template/paste.html index 596a716..7f31c91 100644 --- a/res/template/paste.html +++ b/res/template/paste.html @@ -15,8 +15,6 @@ - - diff --git a/webcontroller/filePreview.go b/webcontroller/filePreview.go index 5da1689..8bd5067 100644 --- a/webcontroller/filePreview.go +++ b/webcontroller/filePreview.go @@ -10,9 +10,9 @@ import ( "path/filepath" "strings" - "fornaxian.com/pixeldrain-api/log" "fornaxian.com/pixeldrain-web/conf" "fornaxian.com/pixeldrain-web/pixelapi" + "github.com/Fornaxian/log" "github.com/julienschmidt/httprouter" "github.com/timakin/gonvert"