mirror of
https://github.com/SinTan1729/chhoto-url.git
synced 2025-12-05 21:10:23 -08:00
docs: Updated docs to match the current state
This commit is contained in:
41
CLI.md
41
CLI.md
@@ -22,6 +22,10 @@ validation (see section above). If the API key is insecure, a warning will be ou
|
||||
|
||||
Example Linux command for generating a secure API key: `tr -dc A-Za-z0-9 </dev/urandom | head -c 128`
|
||||
|
||||
For each response, the response code will be `200`, `401`, `400`, `500`, or `404`, depending on the context. The routes are as follows.
|
||||
|
||||
#### `/api/new`
|
||||
|
||||
To add a link:
|
||||
|
||||
```bash
|
||||
@@ -52,6 +56,8 @@ or
|
||||
}
|
||||
```
|
||||
|
||||
#### `/api/getconfig`
|
||||
|
||||
To get the config for the backend:
|
||||
|
||||
```bash
|
||||
@@ -82,6 +88,37 @@ The server will reply in the following format.
|
||||
}
|
||||
```
|
||||
|
||||
#### `/api/whoami`
|
||||
|
||||
To get the current user role:
|
||||
|
||||
```bash
|
||||
curl -H "X-API-Key: <YOUR_API_KEY>" http://localhost:4567/api/whoami
|
||||
```
|
||||
|
||||
The server will reply with `admin` if admin access is granted, `public` if admin access is not granted but public mode is enabled,
|
||||
and `nobody` if no access is granted.
|
||||
|
||||
#### `/api/edit`
|
||||
|
||||
To edit an existing short link:
|
||||
|
||||
```bash
|
||||
curl -X POST -H "X-API-Key: <YOUR_API_KEY>" -d '{"shortlink":"<shortlink>", "longlink":"<longlink>", "reset_hit_count": <bool>}' http://localhost:4567/api/edit
|
||||
```
|
||||
|
||||
The server will reply in the following format.
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true/false,
|
||||
"error": false/true,
|
||||
"reason": "<reason"
|
||||
}
|
||||
```
|
||||
|
||||
#### `/api/expand`
|
||||
|
||||
To get information about a single short link:
|
||||
|
||||
```bash
|
||||
@@ -112,12 +149,16 @@ or
|
||||
|
||||
(This route is not accessible using cookie validation.)
|
||||
|
||||
#### `/api/all`
|
||||
|
||||
To get a list of all the currently available links:
|
||||
|
||||
```bash
|
||||
curl -H "X-API-Key: <YOUR_API_KEY>" http://localhost:4567/api/all
|
||||
```
|
||||
|
||||
#### `/api/del/{shortlink}`
|
||||
|
||||
To delete a link:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -60,6 +60,8 @@ Password: `chhoto-url-demo-pass`
|
||||
stays under 5MB under normal use.)
|
||||
- Counts number of hits for each short link in a privacy respecting way
|
||||
i.e. only the hit is recorded, and nothing else.
|
||||
- Short links can be edited after creation.
|
||||
- QR codes can be generated for easy sharing.
|
||||
- Supports operation using API key, and lets the user provide hashed password and API key.
|
||||
- Has a mobile friendly UI, and automatic dark mode.
|
||||
- Can serve a custom landing page, if needed.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 58 KiB |
Reference in New Issue
Block a user