Link shortener in Rust. https://s.42l.fr/
Go to file
neil 8ae3a471f0
All checks were successful
Build and push / release (push) Successful in 4m49s
Merge pull request 'Do not assume 'Accept-Language' length' (#37) from axpio/42l-rs-short:fix-language-panic into master
Reviewed-on: #37
2024-08-23 10:45:42 +00:00
.gitea/workflows [skip ci] update scripts path 2024-07-09 08:22:44 +02:00
assets hotfixing 42l icon on phishing page 2021-03-02 13:57:23 +01:00
db Don't delete the db folder; don't push blacklists 2019-10-13 17:17:19 +02:00
migrations add support for PostgreSQL and MySQL. Fixes #4 2022-04-25 23:23:13 +02:00
screenshots version 2.0.0, initial commit 2020-04-10 01:45:25 +02:00
src Do not assume 'Accept-Language' length 2024-08-23 11:17:03 +02:00
templates Explicitly state that the admin link should be kept 2024-01-14 14:33:13 +01:00
.gitignore Switch from lazy_static crate to once_cell crate 2022-09-14 19:19:28 +02:00
Cargo.toml update lists and version 2024-04-02 09:56:37 +09:00
config.toml.sample finish config check function 2022-10-20 23:30:38 +02:00
Dockerfile fixing assets copy again 2024-07-08 23:43:59 +02:00
lang.json Missing word in English string 2024-04-23 12:03:12 +02:00
LICENSE Initial commit, version 1.0.0 2019-09-22 20:43:44 +02:00
lists.toml update lists and version 2024-04-02 09:56:37 +09:00
README.md README.md: Update links to point directly to the new website 2023-10-07 17:13:24 +00:00

rs-short

Link shortener in Rust.

Developed to be as minimal and lightweight as possible.

Powered by the Actix framework using (server-side) Askama templates.

  • Around 1000 lines of code, including 20% of comments
  • Consumes between 5MB and 20MB of RAM
  • No JS, no CSS framework
  • No tracking features, user IPs are not saved in database
  • No unsafe block
  • Compiles on Rust stable

Features:

  • Includes a captcha as a minimal protection against spamming
  • Easily customizable assets, contact details and hoster information
  • Light / dark theme
  • Only needs a SQLite database to work
  • Robust caching features to serve content even with database locks
  • Localization (available in French, English, Croatian and Occitan, please translate!)
  • Basic protection against spambots (captcha with a customizable difficulty)
  • Active detection of phishing links (detects "suspicious activity")
  • Counting clicks
  • Allows shortcut deletion by the user
  • Allows marking a shortcut as "phishing", which displays a awareness-raising message to victims
  • Blocks URL with regexes, includes a default blocklist

Official instance: https://s.42l.fr/

Screenshots

Main page:

Main page screenshot

Admin page for users when they create a link:

New link screenshot

Page displayed when a link is marked as phishing by the server administrator:

Main page screenshot

Running an instance

First, you must install Cargo and the latest stable version of Rust by following the instructions on this website. Alternatively, you can use the liuchong/rustup Docker image.

  • Clone the project:
git clone https://git.42l.fr/42l/rs-short.git
  • Edit what you need. You might want to change the following files:

    • assets/hoster-logo.svg: replace with the logo of your organization
    • assets/logo.svg: the software logo
    • assets/themes/light/background.jpg: the default background for the light theme
  • Copy config.toml.sample to config.toml and edit its values to suit your needs:

    • Important: Replace default values of cookie_key and phishing_password.
  • Edit the policy lists in lists.toml at your convenience.

You can configure a fail2ban instance and watch your favourite reverse-proxy logs to see which IPs are getting a 403 Forbidden and ban accordingly for the duration of your choice.

  • Choose a database:
    • cargo run --release for SQLite (default, dont use in production)
    • cargo run --release --no-default-features --features postgres for PostgreSQL
    • cargo run --release --no-default-features --features mysql for MySQL

To integrate the service with a systemd or nginx configuration, please check the wiki.

Contributing

Here are many ways to contribute:

  • Translate!
    • Add your entries in the lang.json file.
    • Once you're done, edit init.rs and add your language in the ValidLanguages structure.
  • Add some more CSS themes
  • Rework default themes' CSS (they've gone a bit messy since then. hopefully they are commented)
  • Develop a more resilient protection to spambots
    • Add JS? :(
  • Add a toggle to disable the captcha
  • Experiment around captchas to match accessibility needs. I have no idea... :(

This software is mainly developed and maintained by Neil for La Contre-Voie.

If you like the work done on this project, please consider donating or joining the association. Thank you!

Graphical credits