The first link shortener with good UX for admins and users! https://go.momar.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Moritz Marquardt acce538672 Fix out-of-memory error during strings.Repeat (related to #1) 2 years ago
names Fix out-of-memory error during strings.Repeat (related to #1) 2 years ago
web Full implementation of the link shortener with improved UX design 2 years ago
.gitignore Add Dockerfile & README, switch to go-bindata for static resources 2 years ago
Dockerfile Add Dockerfile & README, switch to go-bindata for static resources 2 years ago
README.md Add instructions for non-Docker deployment 2 years ago
go.mod Full implementation of the link shortener with improved UX design 2 years ago
go.sum Full implementation of the link shortener with improved UX design 2 years ago
main.go Add Dockerfile & README, switch to go-bindata for static resources 2 years ago
qr.go Full implementation of the link shortener with improved UX design 2 years ago
routes.go Full implementation of the link shortener with improved UX design 2 years ago
static.go Add Dockerfile & README, switch to go-bindata for static resources 2 years ago
template.go Full implementation of the link shortener with improved UX design 2 years ago

README.md

Linkding

The linkding is a link shortener/alias service focused on awesome UX for both users and system administrators.

Awesome features include QR code generation, click-to-copy, deleting & editing links click count, and custom link names.

Installation

docker run --name linkding -e DOMAIN=http://localhost -p 80:80 -v "$PWD:/data" momar/linkding

Environment

  • DOMAIN - the domain that will be used as a link prefix later, without trailing slash
  • LISTEN - the listen address (e.g. :80)
  • DEBUG - set to 1 for more verbose logs

non-Docker installation

wget https://get.mo-mar.de/linkding /usr/local/bin/linkding && chmod +x /usr/local/bin/linkding
mkdir /var/linkding && useradd -d /var/linkding -M -r linkding
wget https://qbin.io/arms-vpn-ic6o -O /etc/systemd/system/linkding.service
vim /etc/systemd/system/linkding.service  # adjust configuration
systemctl enable linkding
systemctl start linkding

You probably also want a reverse proxy like Caddy to enable HTTPS.

Custom names

Custom link names can contain the characters a-z, 0-9 and dashes (-). Also, there are a few placeholders for random name generation:

  • #w is replaced by a random english word
  • #n is replaced by a random english noun
  • #a is replaced by a random english adjective
  • #f is replaced by a random german word from the list of most common 1000 words in Goethe's Faust
  • #x produces a random character (except for dashes)
  • #l produces a random letter
  • #d produces a random digit
  • #v produces a random vowel
  • #c produces a random consonant
  • #x{5} is replaced by 5 random characters
  • [...]{5} repeats ... 5 times
  • [#v#c]{5} produces 10 pronouncable characters, e.g. ``
  • #l|#x{100} produces a single-letter link, or a 100-character link if 3 randomly generated single-letter links were all already in use

Relevant endpoints

http://localhost/?spec=hello-world&url=example.org

Returns a 301 redirect to http://localhost/hello-world/abc123 - http://localhost/hello-world in this instance is the link that's being used, abc123 is the edit token. spec is not required (see "Custom names" below), and the request can also be a POST request containing a body with those fields in one of a couple formats.

If the link already exists, or the URL or the spec is invalid, it returns a 400 error.

http://localhost/hello-world

Returns a 301 redirect to (in this case) http://example.org.

http://localhost/hello-world/abc123

Displays a page with the shortened link, a QR code, and the click count of the link.

http://localhost/hello-world/abc123/delete

Deletes the link, so it can be created again. Is a non-idempotent GET request against all best practices, but makes the frontend way simpler, and as it can only be called once the browser-history argument is not relevant.

Displays the link creation page with all fields pre-filled to undo the deletion or to edit the link (albeit this will generate a new edit token).

If the link doesn't exist, this returns a 404 error; if the token is wrong it returns a 403 error.