Skip to content

redds-be/reddlinks

Repository files navigation


Logo

reddlinks

A simple link shortener written in Go

View Demo · Wiki · Report Bug · Request Feature

GitHub Workflow Status (with event) GitHub Workflow Status (with event) GitHub Workflow Status (with event) GitHub Workflow Status (with event) GitHub pull requests GitHub issues GitHub License GitHub go.mod Go version (subdirectory of monorepo) Go Reference

Table of Contents
  1. About The Project
  2. Features
  3. Usage
  4. Installation
  5. Roadmap
  6. Contributing
  7. License

About reddlinks

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.

(back to top)

Features

  • 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

(back to top)

Usage

To use it in a web browser, follow the instruction on the front page.

API requests:

  1. 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
  1. 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.

(back to top)

Installation

Read the configuration and installation instructions in the wiki.

(back to top)

Roadmap

  • Add a private mode with authentication

(back to top)

Contributing

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.

(back to top)

License

Project under the GPLv3 License.

Copyright (C) 2024 redd

(back to top)