Table of Contents
A simple link shortener written in Go. Made while I was bored.
In case it has been a while since the last commit, no, this project is not dead, if you have an issue or have a feature request, I will respond to it in a reasonable time frame.
- URL shortening
- Front-facing website
- API endpoints
- Random path generation (ex: ls.redds.be/ag4vb~, defaults to a pre-configured value)
- Custom path (ex: ls.redds.be/custom, overrides path generation)
- Password protected links using argon2
- PostgreSQL and SQLite
To use it in a web browser, follow the instruction on the front page.
API requests:
- Shorten link:
Use your favorite http client to make a POST request in JSON, example with curl
:
curl -X POST https://ls.redds.be -H 'Content-Type: application/json' -d '{"url":"http://example.com"}'
Available params for link shortening are:
- "url": "URL". A valid URL
- "length": "Number". A number for an auto-generated short path, defaults to a pre-configure length. Optional
- "customPath": "Path". A custom path to access the shortened link instead of an auto-generated one Optional
- "expireAfter": "1d1h1m1s". 1d = 1 day; 1h = 1 hour; 1m = 1 minute; 1s = 1 second; the format should be entered from greater (1d) to lesser (1s). Defaults to a pre-configured time. Example : "3d5h34m54s" = 3 days, 5 hours, 34 minutes and 54 seconds from now. Optional
- "password": "Password". A password to protect the shortened link with. Optional
- Access password-protected links:
Use your favorite http client to make a GET request whilst posting JSON, example with curl
:
curl -X GET https://ls.redds.be/ag4vb~ -H 'Content-Type: application/json' -d '{"password":"secret123"}'
More information in the wiki.
Read the configuration and installation instructions in the wiki.
- Add a private mode with authentication
I don't expect anyone other than me to contribute, but you should follow these steps :
Fork -> Patch -> Push -> Pull Request
The Go code is linted with golangci-lint
and
formatted with golines
(width 120) and
gofumpt
. See the Makefile targets.
If there are false positives, feel free to use the
//nolint:
directive
and justify it when committing to your branch or in your pull request.
For any contribution to the code, make sure to create tests/alter the already existing ones according to the new code.
Make sure to run make prep
before committing any code.
Project under the GPLv3 License.
Copyright (C) 2024 redd