From 08403b616f9dad83cb1204eec83ba1252e3eb129 Mon Sep 17 00:00:00 2001
From: justanothercatgirl
Date: Mon, 31 Mar 2025 15:44:36 +0300
Subject: Early working state.
TODO:
* /api/linkdel, /api/linkget
* finish website
---
www/docs.html | 12 ++++++++----
www/index.html | 5 ++++-
2 files changed, 12 insertions(+), 5 deletions(-)
(limited to 'www')
diff --git a/www/docs.html b/www/docs.html
index a2fa287..8e892df 100644
--- a/www/docs.html
+++ b/www/docs.html
@@ -20,7 +20,7 @@
API reference
The API follows this convention: everything is done through GET requests, client supplies all necessary parameters in URLencoded format.
Whatever server returns depends on parameters; it may be application/json (for programmable API) OR text/html (to render in HTML)
- Example request: http://ln.twistea.su/api/linkadd?url=https%3A%2F%2Fexample.com&format=html.
+
Example request: http://ln.twistea.su/api/linkadd?url=https%3A%2F%2Fexample.com&format=html.
This request may return something like: <a href="http://server.com/DEADF00D">your link: DEADF00D</a>
Note: server may return json string like null or true: according to
rfc-8259, this is valid json and clients have to handle this accordingly.
@@ -30,8 +30,9 @@
invalid arguments: argument's type/value does not match with what server expects.
occupied: the path at which the link was attempted to be created is occupied already.
server error: something went wrong on the server. Will include additional json field "what" with error message.
+ path too long: the path is too long.
unknown: server does not know what the hell went wrong
- Plese note that the HTTP return status for malformed request may be BAD_REQUEST (400) or INTERNAL_SERVER_ERROR (500)
+ Plese note that the HTTP return status for malformed request may be BAD_REQUEST (400), URI_TOO_LONG (414), NOT_FOUND (404) or INTERNAL_SERVER_ERROR (500)
Table 1. Global parameters (applicable to all endpoints)
@@ -82,7 +83,10 @@
try? |
- string: PATH to try to put link under
+ | string: PATH to try to put link under
+ shoud match regex [a-zA-Z0-9]+, length ≤ 10
+ may work with length = 11, but not always
+
(if not occupied, WITHOUT https://server.com/) |
@@ -95,7 +99,7 @@
/api/linkget |
path |
string: PATH to get link info from |
- {"url": "original url", created: int unix_timestamp}
+ | {"url": "original url", created: int unix_timestamp}
OR null
|
diff --git a/www/index.html b/www/index.html
index a2af744..ed48fc5 100644
--- a/www/index.html
+++ b/www/index.html
@@ -12,7 +12,8 @@
JAC's link shortener
- JAC's link shortener
+
+
Just another link shortener
Try it out!