From c570200b2feb5a935412f447c0e2d9d1e8bb8883 Mon Sep 17 00:00:00 2001 From: 132ikl <132@ikl.sh> Date: Sun, 24 Feb 2019 02:30:57 -0500 Subject: [PATCH] Add LICENSE, GitHub link on page --- LICENSE | 7 +++++++ config.yml | 22 +++++++++++++--------- liteshort.py | 10 ++++++++-- static/GitHub.svg | 1 + static/styles.css | 30 +++++++++++++++++++++++++++--- templates/main.html | 13 +++++++++++++ 6 files changed, 69 insertions(+), 14 deletions(-) create mode 100644 LICENSE create mode 100644 static/GitHub.svg diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..46908db --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright 2019 Steven Spangler + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/config.yml b/config.yml index 193dd63..a385dce 100644 --- a/config.yml +++ b/config.yml @@ -5,28 +5,28 @@ admin_username: 'admin' # Plaintext password to make admin API requests # Safe to remove if admin_hashed_password is set # Default: unset -admin_password: 'password' +#admin_password: # Hashed password (bcrypt) to make admin API requests - Preferred over plaintext, use securepass.sh to generate # Please note that authentication takes noticeably longer than using plaintext password # Don't include the : segment, just the hash # Default: unset (required to start application) -#admin_hashed_password: '$2y$15$Dhll3IY42R.JNOYazarlG.8IndwMjxmHLpFsebJzcGTJd.gbsAwna' +admin_hashed_password: '$2y$15$Dhll3IY42R.JNOYazarlG.8IndwMjxmHLpFsebJzcGTJd.gbsAwna' -# Secret key used for cookies (used for storage of messages) +# String: Secret key used for cookies (used for storage of messages) # This should be a 12-16 character randomized string with letters, numbers, and symbols # Default: unset (required to start application) secret_key: 'S$JI8L*&xua%gBoL' -# Filename of the URL database +# String: Filename of the URL database without extension # Default: 'urls' database_name: 'urls' -# Length of random short URLs by default +# Integer: Length of random short URLs by default # Default: 4 random_length: 4 -# Allowed URL characters +# String: Allowed URL characters # Default: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ allowed_chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' @@ -34,11 +34,15 @@ allowed_chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ # Default: 5 random_gen_timeout: 5 -# Name shown on tab while on site and on page header +# String: Name shown on tab while on site and on page header # Default: 'liteshort' site_name: 'liteshort' -# URL shown when finished generating shortlinks. Include the / at the end. +# String: URL shown when finished generating shortlinks. Include the / at the end. # If not set, it is automatically taken from the URL the shorten request is sent to. # Default: unset -site_url: \ No newline at end of file +site_url: + +# Boolean: Show link to project repository on GitHub at bottom right corner of page +# Default: true +show_github_link: false \ No newline at end of file diff --git a/liteshort.py b/liteshort.py index 2454432..a27f5fe 100644 --- a/liteshort.py +++ b/liteshort.py @@ -1,3 +1,8 @@ +# Copyright (c) 2019 Steven Spangler <132@ikl.sh> +# This file is part of liteshort by 132ikl +# This software is license under the MIT license. It should be included in your copy of this software. +# A copy of the MIT license can be obtained at https://mit-license.org/ + from flask import Flask, current_app, flash, g, jsonify, redirect, render_template, request, url_for import bcrypt import random @@ -15,12 +20,13 @@ def load_config(): req_options = {'admin_username': 'admin', 'database_name': "urls", 'random_length': 4, 'allowed_chars': 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_', - 'random_gen_timeout': 5, 'site_name': 'liteshort', 'site_url': None + 'random_gen_timeout': 5, 'site_name': 'liteshort', 'site_url': None, 'show_github_link': True, + 'secret_key': None } config_types = {'admin_username': str, 'database_name': str, 'random_length': int, 'allowed_chars': str, 'random_gen_timeout': int, 'site_name': str, - 'site_url': (str, type(None))} + 'site_url': (str, type(None)), 'show_github_link': bool, 'secret_key': str} for option in req_options.keys(): if option not in new_config.keys(): # Make sure everything in req_options is set in config diff --git a/static/GitHub.svg b/static/GitHub.svg new file mode 100644 index 0000000..53bd7b2 --- /dev/null +++ b/static/GitHub.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/styles.css b/static/styles.css index f5249fb..7273bc3 100644 --- a/static/styles.css +++ b/static/styles.css @@ -1,3 +1,10 @@ +/* +Copyright (c) 2019 Steven Spangler <132@ikl.sh> +This file is part of liteshort by 132ikl +This software is license under the MIT license. It should be included in your copy of this software. +A copy of the MIT license can be obtained at https://mit-license.org/ +*/ + div.form { margin-top: 5%; text-align: center; @@ -28,6 +35,11 @@ body { text-align: center } +h2 { + font-weight: normal; + font-family: Open Sans; +} + div.success > a:link { color: #62ad2c; } @@ -36,7 +48,19 @@ div.success > a:visited { color: #507c52; } -h2 { - font-weight: normal; - font-family: Open Sans; +div.github { + position: absolute; + transition: opacity .25s ease-out; + -moz-transition: opacity .25s ease-out; + -webkit-transition: opacity .25s ease-out; + -o-transition: opacity .25s ease-out; + opacity: 0.3; + right: 2.5%; + bottom: 10%; + width: 2.5%; + height: 2.5%; +} + +div.github:hover { + opacity: 1; } \ No newline at end of file diff --git a/templates/main.html b/templates/main.html index 94dd809..5ae9901 100644 --- a/templates/main.html +++ b/templates/main.html @@ -1,3 +1,9 @@ + @@ -38,5 +44,12 @@ {% endfor %} {% endif %} {% endwith %} + {% if config.show_github_link %} +
+ + + +
+ {% endif %} \ No newline at end of file