Skip to main content

deecubes (DSSS - Damn Simple Static url Shortener)

Project description

# deecubes (Damn Simple Static url Shortener)

The name comes from the short form DSSS of Damn Simple Static url Shortener (so, a D and a cube of S's. Idiotic, I know :P). This program allows to maintain a website of short urls, akin to bit.ly/tinyurl etc, that can redirect to longer urls so one has to remember/give shorter ones. The main point of this project is to allow this to be done via a static website instead of a database based solution.

There are several benefits of a static website like they are much cheaper (Free to host on github/gitlab etc), easy to migrate to any host in minutes (if not seconds), etc. On top of this, the project strives to make this process as simple as possible to use.

## Input

Long url that you want to shorten

A mnemonic/shorturl you want to assign to it (Optional. If not given, one is generated automatically)

## Output

Static website of shorturls redirecting to your long urls

One can also go to shorturl/preview.html to see the long url it points to without getting redirected.

# Demo Website:
https://shgl.in/ uses this project. Repository for reference: https://shgl.in/deecubesdemo

# Installation

It's recommended to install deecubes from pypi using pip

`pip install deecubes`

# Deployment methods

You can use/deploy your own shorturl websites using deecubes in various ways given below and more:

- Host website on github/gitlab etc. Run deecubes cli commands (given in next section) locally to generate shorturls in a git repository. Commit and upload.

- Host website on github/gitlab etc. Create a 'source' branch in the website repository. Add a link to input directory from PC or directly through web interface and use a CI job (like Travis/CircleCI/Pipeline etc) to automatically generate shorturls using "sync" commands. https://shgl.in/ uses this method.

- Create your own automation to host the output directory on any host (through APIs or mounted directories etc)

# CLI Usage

```
usage: deecubes [-h] [-v] [-l LOGLEVEL]
[-a SHORTURL URL | -g URL | -d SHORTURL | -s] -r RAW_DATA_PATH
-o OUTPUT_PATH

optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-l LOGLEVEL, --log LOGLEVEL
Set log level. 0=> Warning, 1=>Info, 2=>Debug
-a SHORTURL URL, --add SHORTURL URL
Add given shorturl for given url
-g URL, --generate URL
Generate shorturl for given url
-d SHORTURL, --delete SHORTURL
Delete given shorturl
-s, --sync Sync raw data storage and html output

required arguments:
-r RAW_DATA_PATH, --raw-data-path RAW_DATA_PATH
Raw data storage path
-o OUTPUT_PATH, --output-path OUTPUT_PATH
HTML output path

```

# TODO

- Add collision handling

- Add google analytics

- Add configurable templates

- Suggestions?


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

deecubes-0.2.1-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page