Skip to content

Open-source URL shortener - Solution for URL shortening: nginx, postgres, json

License

Notifications You must be signed in to change notification settings

cryptofuture/urlhda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

urlhda

Open-source URL shortener - Solution for URL shortening: nginx, postgres, json

Includes: Website, android application, tizen application and simple bash script for url shortening

Features:

  • Strong URL (15 symbols long uid for shorted URLs, 5 symbols by default)
  • Fast copy-paste. Auto selection in browser, and copy button in android app
  • Ability to share URLs (Android App only) Live example: hda.me (its down due I don't have funds to run it)

To use it as a service

  • You can use HDA URL (Urlhda) android application
    Get it on F-Droid
  • Or you can use Urlhda from CLI Install it via PPA.
sudo apt-add-repository ppa:hda-me/urlhda
sudo apt-get update
sudo apt-get install urlhda

Or copy this script to /usr/local/bin

Setup it yourself

Requirements

Configuration examples location and installation

  • conf folder includes nginx.conf section example, site-enabled/sitename (vhost) example, sql file to import and debian rules file example, useful for package rebuild
  • script folder includes shortening bash script example
  • website folder includes url shortener website page example
  • android_app android application, used for hda.me url shortener website
  • tizen app tizen application, used for hda.me url shortener website

Once you have nginx and modules installed you can start nginx with the the configuration from /conf and /website folders You also need to setup a database in your PostgreSQL-server and create separate table, don't forget set password. Use the /config/database.sql file to do it for you. After you are done adjust the settings to your environment in the nginx configuration.

Creating user and database:

CREATE USER "user" WITH PASSWORD 'password';  
CREATE DATABASE databasename WITH OWNER "user";  

Importing:

psql -h localhost -d databasename -U user -f database.sql

Upgrading old installation (database) for Strong URLs support:

\c databasename
ALTER TABLE links ALTER COLUMN uid TYPE character varying(30);

Usage

  1. Script
    Edit host, chmod 755, and copy to /usr/local/bin/ Or you can install it via PPA:
sudo apt-add-repository ppa:hda-me/urlhda
sudo apt-get update
sudo apt-get install urlhda
# 5 symbols uid (default)  
urlhda http[s]:https://your_long_url_here  
# To generate Strong URL (15 symbols uid)  
urlhda -s http[s]:https://your_long_url_here 
  1. Website
    Edit index.html to change appearance for your needs and your done
  2. Android application
    Install app and change hostname URL in application Settings (gear icon)

Donation

Consider making a donation, if you like what I doing. I working remotely and income is unstable, so every little bit helps.

Also it would be nice if you provide, a note on [email protected] after making a donation with information what you like and what you want to improve. So, I would consider giving more time and support to particular project.

I also open to reasonable work offers, especially if offer would be close to a field or project I work with.

E-money & Fiat

Yandex Money

Donation on Yandex Money: https://money.yandex.ru/to/410015241627045)

Advanced Cash

Open https://wallet.advcash.com/pages/transfer/wallet and use [email protected] in Specify the recipient's wallet or e-mail field

PayPal

Donation with PayPal: https://paypal.me/hdadonation

Payeer

Donation with Payeer: On https://payeer.com/en/account/send/ use P2865115 in Account, e-mail or phone number field

Cryptocurrency

Bitcoin

Address is 1N5czHaoSLukFSTq2ZJujaWGjkmBxv2dT9

Musicoin

Address is 0xf449f8c17a056e9bfbefe39637c38806246cb2c9

Ethereum

Address is 0x23459a89eAc054bdAC1c13eB5cCb39F42574C26a

Other

I could provide you with some relatively cheap "hardware" donation options directly to my PO Box, if you prefer real gifts. Ask for details on [email protected]

How it works

You can shorten URLs with a POST-request:

  curl -X POST https://website.name/add?url=https://add.me

This will give you JSON-response back with the generated 5 character UID:

[{"uid":"abcd5"}]

With that you can go to for example to https://website.name/abcd5 and you will be redirected to https://add.me

Other

Original idea: Sebastian Gräßl, forked from https://github.com/bastilian/sebas

About

Open-source URL shortener - Solution for URL shortening: nginx, postgres, json

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published