Update logo and doc
This commit is contained in:
@ -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()
|
Reference in New Issue
Block a user