diff --git a/README.md b/README.md index 1fe9167..d7f7e80 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# shortn +

+ shortn logo +

+

shortn

+ HTML/CSS/JS Framework Free ✅ • Lightweight ✅ • Functional ✅ • No plaintext passwords ✅ @@ -12,12 +16,22 @@ pip install -r requirements.txt ## Usage ```bash -python app.py +python manage_users.py init # to create the database +python manage_users.py add # to add a user +>>> Name: admin +>>> Password: ***** +>>> Again: ***** + +python manage_users.py list # to list users +python manage_users.py remove --username # to remove a user + +# Finally, running the app +python app.py ``` ## TODOs - [x] basic UI (to add links) - [x] basic auth for UI - [x] sqlite3 to store links -- [ ] responsive? +- [x] responsive? (sorta) - [ ] dockerize diff --git a/src/manage_users.py b/src/manage_users.py index 085b844..d3c581d 100644 --- a/src/manage_users.py +++ b/src/manage_users.py @@ -74,9 +74,9 @@ def main(): init_db() print("Database initialized.") elif args.command == 'add': - user = input("Enter username: ") - password = getpass.getpass("Enter password: ") - verify = getpass.getpass("Re-enter password: ") + user = input("Name: ") + password = getpass.getpass("Password: ") + verify = getpass.getpass("Again: ") if password != verify: print("Error: Passwords do not match.") sys.exit(1) diff --git a/src/static/img/favicon.png b/src/static/img/favicon.png index b8caa19..e37a473 100644 Binary files a/src/static/img/favicon.png and b/src/static/img/favicon.png differ diff --git a/src/test.py b/src/test.py deleted file mode 100644 index e9278eb..0000000 --- a/src/test.py +++ /dev/null @@ -1,28 +0,0 @@ -import sqlite3 - -DATABASE = 'database.db' - -# Function to insert links into the redirects table -def add_links(): - links = [ - { - "dest_link": f"https://example{num}.com", - "custom_link": f"custom{num}" - } for num in range(1, 31) - ] - - with sqlite3.connect(DATABASE) as conn: - cursor = conn.cursor() - for link in links: - try: - cursor.execute( - 'INSERT INTO redirects (dest_link, custom_link) VALUES (?, ?)', - (link["dest_link"], link["custom_link"]) - ) - except sqlite3.IntegrityError: - print(f"Custom link {link['custom_link']} already exists.") - conn.commit() - print(f"Added {len(links)} links to the database.") - -if __name__ == "__main__": - add_links()