Sign inSign up

12abcloud/tiny-link-rust

By 12abcloud

•Updated over 5 years ago

Server for tiny-link server rewritten in rust

Image
0

2.0K

12abcloud/tiny-link-rust repository overview

Build Status

Tiny-link-rust is a fast and private URL shortner written in rust with several different ways to shorten any URL. It is available as Firefox and Chrome Plugin.  

⁠Pre requirements

For hosting your own tiny-link instance you only need docker installed. Here you find a short documentation how to install docker⁠.

 

⁠How to run

⁠Docker run

To persist the shortened links we mount the path where the links are saved to our local file system(with -v ).

docker run -d -p 8080:8080 -v /data/tiny-link:/var/lib/tiny-link/ 12abcloud/tiny-link-rust

 

⁠API calls

Checkout the swagger documentation as well https://app.swaggerhub.com/apis-docs/aeggerd/tiny-link-rust/1.5.0#/⁠

⁠Create short URL
curl -X POST \
  -H "Content-Type: application/json" \
  http://localhost:8080/create \
  -d '{"longurl":"https://example.com","duration":"1Y10m","selfdestruct":true}'
http://localhost:8080/l/e4f-e8
⁠Open short URL
curl -X GET \
  http://localhost:8080/l/526-e
⁠Delete short URL
curl -X DELETE \
  http://localhost:8080/l/526-e

 

⁠Environment variables

Environment variables can get set with the -e parameter, like docker run -e APP_DEBUG=true 12abcloud/tiny-link-rust

VariableDescriptionDefault
APP_DEBUGactivate debug log levelfalse
APP_WORKERSnumbers of http workers16
APP_HTTP_PROTOprotocol for the short linkhttp
APP_WORKDIRdirectory for persisting the data/var/lib/tiny-link/
APP_OLDMAPpath to legacy filemap/var/lib/tiny-link/tiny-link.map
APP_PHISHTANKurl of phishtankhttps://phish.12ab.pw/scan⁠

 

⁠HTTP status codes/methodes

PathMethodResponse codeResponse bodyExplanation
/createPOST201 Createdhttp://localhost:8080/l/534-e⁠create new short URL
/createPOST418 I'm a teapotLink is a phishingrequest got blocked because of phishing
/l/*GET308 Permanent Redirect-redirect to long URL
/l/*GET404 Not Found-short hash not found/long URL is phishing
/l/*DELETE200 OK-delete short URL
/healthGET200 OK-health check

⁠How to use your own Server

⁠Browser plugin
  1. Install the latest Browser Plug-in

https://addons.mozilla.org/de/firefox/addon/tiny-link https://chrome.google.com/webstore/detail/tiny-link/giiekkmkblmcnafbpohakghlaldmbilf ⁠  
2. Open the Plug-in Settings  
3. Enter your endpoint (e.g. https://example.com/create⁠) and hit Save

Tag summary

Content type

Image

Digest

Size

48 MB

Last updated

over 5 years ago

docker pull 12abcloud/tiny-link-rust