Update logo and doc

This commit is contained in:
Boyan 2024-12-07 22:51:38 +01:00
parent 8ace6f551b
commit ce105eff11
4 changed files with 20 additions and 34 deletions

View File

@ -1,4 +1,8 @@
# shortn <p text-align="center">
<img src="src/static/img/favicon.png" alt="shortn logo" width="100px">
</p>
<h1 text-align="center"> shortn </h1>
HTML/CSS/JS Framework Free ✅ • Lightweight ✅ • Functional ✅ • No plaintext passwords ✅ HTML/CSS/JS Framework Free ✅ • Lightweight ✅ • Functional ✅ • No plaintext passwords ✅
@ -12,6 +16,16 @@ pip install -r requirements.txt
## Usage ## Usage
```bash ```bash
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 <username> # to remove a user
# Finally, running the app
python app.py python app.py
``` ```
@ -19,5 +33,5 @@ python app.py
- [x] basic UI (to add links) - [x] basic UI (to add links)
- [x] basic auth for UI - [x] basic auth for UI
- [x] sqlite3 to store links - [x] sqlite3 to store links
- [ ] responsive? - [x] responsive? (sorta)
- [ ] dockerize - [ ] dockerize

View File

@ -74,9 +74,9 @@ def main():
init_db() init_db()
print("Database initialized.") print("Database initialized.")
elif args.command == 'add': elif args.command == 'add':
user = input("Enter username: ") user = input("Name: ")
password = getpass.getpass("Enter password: ") password = getpass.getpass("Password: ")
verify = getpass.getpass("Re-enter password: ") verify = getpass.getpass("Again: ")
if password != verify: if password != verify:
print("Error: Passwords do not match.") print("Error: Passwords do not match.")
sys.exit(1) sys.exit(1)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -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()