diff --git a/doc/api.md b/doc/api.md index 9e2cf64..c922de5 100644 --- a/doc/api.md +++ b/doc/api.md @@ -145,10 +145,11 @@ Upload your paste. It accept parameters in form-data: Explanation of the fields: - - `url`: mandatory. The URL to fetch the paste. When using a customized name, it looks like `https//shz.al/~myname`. - - `admin`: mandatory. The URL to update and delete the paste, which is `url` suffixed by `~` and the password. - - `expire`: optional. The expiration seconds. - - `isPrivate`: mandatory. Whether the paste is in private mode. + - `url`: String. The URL to fetch the paste. When using a customized name, it looks like `https//shz.al/~myname`. + - `suggestUrl`: String or null. The URL that may carry filename or URL redirection. + - `admin`: String. The URL to update and delete the paste, which is `url` suffixed by `~` and the password. + - `expire`: String or null. The expiration seconds. + - `isPrivate`: Bool. Whether the paste is in private mode. If error occurs, the worker returns status code different from `200`: @@ -193,7 +194,7 @@ Update you paste of the name `` and password ``. It accept the par - `e`: optional. Same as `POST` method. Note that the deletion time is now recalculated. - `s`: optional. Same as `POST` method. -The returning of `PUT` method is also the same as `POST` method. +The returning of `PUT` method is the same as `POST` method. If error occurs, the worker returns status code different from `200`: diff --git a/frontend/index.client.js b/frontend/index.client.js index 6fd3212..ec47dd0 100644 --- a/frontend/index.client.js +++ b/frontend/index.client.js @@ -271,6 +271,9 @@ window.addEventListener('DOMContentLoaded', () => { $('#paste-uploaded-panel').removeClass('hidden') $('#uploaded-url').prop('value', uploaded.url) $('#uploaded-admin-url').prop('value', uploaded.admin) + if (uploaded.suggestUrl) { + $('#uploaded-suggest-url').prop('value', uploaded.suggestUrl) + } if (uploaded.expire) { $('#uploaded-expiration').prop('value', uploaded.expire) } diff --git a/frontend/index.html b/frontend/index.html index 55b5e5c..15ab1e5 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -87,11 +87,16 @@

Uploaded paste

- + +
+ + +
+
- +
diff --git a/src/index.js b/src/index.js index 5a1ee36..086a2a0 100644 --- a/src/index.js +++ b/src/index.js @@ -260,7 +260,7 @@ async function createPaste(env, content, isPrivate, expire, short, date, passwd, suggestUrl: suggestUrl(content, filename, short, env.BASE_URL), admin: adminUrl, isPrivate: isPrivate, - expire: expire, + expire: expire || null, } }