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:
43
CLI.md
43
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,7 +88,38 @@ The server will reply in the following format.
|
||||
}
|
||||
```
|
||||
|
||||
To get information about a single shortlink:
|
||||
#### `/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
|
||||
curl -H "X-API-Key: <YOUR_API_KEY>" -d '<shortlink>' http://localhost:4567/api/expand
|
||||
@@ -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.
|
||||
@@ -116,5 +118,5 @@ Password: `chhoto-url-demo-pass`
|
||||
version of [this list used by docker](https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go).
|
||||
- Although it's unlikely, it's possible that your database is mangled after some update. For mission critical use cases,
|
||||
it's recommended to keep regular versioned backups of the database, and sticking to a minor release tag e.g. 5.8.
|
||||
- If you intend to have more than a few thousand shortlinks, it's strongly recommended that you use the UID `slug_style`
|
||||
- If you intend to have more than a few thousand short links, it's strongly recommended that you use the UID `slug_style`
|
||||
with a `slug_length` of 16 or more.
|
||||
|
||||
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