65 lines
1.4 KiB
Markdown
65 lines
1.4 KiB
Markdown
# urls-txt
|
|
|
|
a _really_ simple url shortener: less than 200 lines of Rust and one dependency (tokio).
|
|
|
|
## usage
|
|
|
|
0. clone and install:
|
|
|
|
```
|
|
git clone https://git.alv.cx/alvierahman90/urls-txt.git
|
|
cd urls-txt
|
|
cargo install --path .
|
|
```
|
|
1. create a list of links:
|
|
|
|
```
|
|
lines that don't start with a slash (/) are ignore (they're comments)
|
|
shortlink followed by redirect link, separated by a space character
|
|
/ http://alv.cx everything after the link is ignored (they're comments)
|
|
/urls-txt http://git.alv.cx/alvierahman90/urls-txt
|
|
```
|
|
|
|
2. run:
|
|
|
|
```
|
|
urls-txt path/to/urls.txt
|
|
```
|
|
|
|
## why?
|
|
|
|
all url shorteners i've come across are too complicated:
|
|
they have account management and remote APIs and whatnot.
|
|
too complicated.
|
|
|
|
this includes my own [sus url shortener](https://pls.cx/sus),
|
|
which for some reason i decided should use redis for its database and have a HTTP API for
|
|
updating it.
|
|
|
|
### why not just configure your reverse proxy?
|
|
|
|
good question.
|
|
i'm not sure, but i think i want to separate my concerns?
|
|
you might just want to configure your reverse proxy instead.
|
|
|
|
#### caddy
|
|
|
|
```
|
|
pls.cx {
|
|
redir / http://alv.cx
|
|
redir /urls-txt https://git.alv.cx/alvierahman90/urls-txt
|
|
}
|
|
```
|
|
|
|
#### nginx
|
|
|
|
```
|
|
location / { return 301 http://alv.cx; }
|
|
location /urls-txt { return 301 https://git.alv.cx/alvierahman90/urls-txt; }
|
|
|
|
```
|
|
|
|
##### apache
|
|
|
|
there's probably a way ¯\_(ツ)_/¯
|