Update logo and doc
This commit is contained in:
parent
8ace6f551b
commit
ce105eff11
18
README.md
18
README.md
@ -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 ✅
|
||||
|
||||
|
||||
@ -12,6 +16,16 @@ pip install -r requirements.txt
|
||||
|
||||
## Usage
|
||||
```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
|
||||
```
|
||||
|
||||
@ -19,5 +33,5 @@ python app.py
|
||||
- [x] basic UI (to add links)
|
||||
- [x] basic auth for UI
|
||||
- [x] sqlite3 to store links
|
||||
- [ ] responsive?
|
||||
- [x] responsive? (sorta)
|
||||
- [ ] dockerize
|
||||
|
@ -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)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 27 KiB |
28
src/test.py
28
src/test.py
@ -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()
|
Loading…
x
Reference in New Issue
Block a user