Skip to content

A URL shortener with target URL preview and spam protection

License

Notifications You must be signed in to change notification settings

rtwnt/url-shortener

Repository files navigation

url-shortener

A URL shortener application using Flask, Flask-SQLAlchemy, Flask-WTF , Flask-Migrate, Flask-Script, Flask-Injector and spam-lists.

Features

  • providing unique short alias for each registered URL

  • a preview page for registered short URLs

  • configurable range of character numbers for newly registered aliases

  • logging using logging.handlers.TimedRotatingFileHandler

  • preventing registration of URLs recognized as spam or having a blaclisted host

  • always previewing registered URLs that have been blacklisted or recognized as spam after their registration

  • displaying proper warning when previewing spam or blacklisted URLs

  • customizable whitelist for trusted, non-spam hosts

  • support for database migration commands:

    $ python manage.py db init
    $ python manage.py db migrate
    $ python manage.py db upgrade
    $ python manage.py db --help

Installation

Clone from GitHub and install using pip:

$ git clone https://github.com/piotr-rusin/url-shortener
$ cd url-shortener
$ pip install .

To be able to run tests, install test extras:

$ pip install url-shortener[test]

It is necessary to override default configuration by setting URL_SHORTENER_CONFIGURATION environment variable to a name of a custom configuration file. This file must provide its own value of the following options:

  • SQLALCHEMY_DATABASE_URI
  • SECRET_KEY
  • GOOGLE_SAFE_BROWSING_API_KEY
  • RECAPTCHA_PUBLIC_KEY
  • RECAPTCHA_PRIVATE_KEY

For more details, read docstring in url_shortener.default_config.py

When installing a new version of the project, run the following command to upgrade your database in case the new version introduces changes to its database schema:

$ python manage.py db upgrade

License

MIT

About

A URL shortener with target URL preview and spam protection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published