Initial commit.

This commit is contained in:
2026-05-09 21:49:10 +01:00
commit 79ed58ee23
5 changed files with 320 additions and 0 deletions

64
readme.md Normal file
View File

@@ -0,0 +1,64 @@
# 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 ¯\_(ツ)_/¯