Remove default link presets from startup
All checks were successful
docker / build-and-push (push) Successful in 52s
All checks were successful
docker / build-and-push (push) Successful in 52s
This commit is contained in:
@@ -23,19 +23,6 @@ DB_USER = os.getenv("DB_USER", "jellomator")
|
|||||||
DB_PASSWORD = os.getenv("DB_PASSWORD", "jellomator")
|
DB_PASSWORD = os.getenv("DB_PASSWORD", "jellomator")
|
||||||
DB_NAME = os.getenv("DB_NAME", "jellomator")
|
DB_NAME = os.getenv("DB_NAME", "jellomator")
|
||||||
|
|
||||||
DEFAULT_LINKS = [
|
|
||||||
{"name": "Jellyfin", "url": "http://localhost:8096", "description": "Media server", "category": "Media"},
|
|
||||||
{"name": "Jellyseerr", "url": "http://localhost:5055", "description": "Request management", "category": "Media"},
|
|
||||||
{"name": "Sonarr", "url": "http://localhost:8989", "description": "TV automation", "category": "Arr"},
|
|
||||||
{"name": "Radarr", "url": "http://localhost:7878", "description": "Movie automation", "category": "Arr"},
|
|
||||||
{"name": "Lidarr", "url": "http://localhost:8686", "description": "Music automation", "category": "Arr"},
|
|
||||||
{"name": "Readarr", "url": "http://localhost:8787", "description": "Book automation", "category": "Arr"},
|
|
||||||
{"name": "Bazarr", "url": "http://localhost:6767", "description": "Subtitle management", "category": "Arr"},
|
|
||||||
{"name": "Prowlarr", "url": "http://localhost:9696", "description": "Indexer management", "category": "Arr"},
|
|
||||||
{"name": "qBittorrent", "url": "http://localhost:8080", "description": "Torrent client", "category": "Download"},
|
|
||||||
{"name": "SABnzbd", "url": "http://localhost:8085", "description": "Usenet client", "category": "Download"},
|
|
||||||
]
|
|
||||||
|
|
||||||
app = FastAPI(title="Jellomator")
|
app = FastAPI(title="Jellomator")
|
||||||
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"])
|
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"])
|
||||||
|
|
||||||
@@ -59,23 +46,6 @@ def db():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
def seed_default_links(conn):
|
|
||||||
now = datetime.utcnow().isoformat()
|
|
||||||
with conn.cursor() as cur:
|
|
||||||
for item in DEFAULT_LINKS:
|
|
||||||
cur.execute(
|
|
||||||
"""insert into links(name,url,description,category,enabled,created_at,updated_at)
|
|
||||||
values (%s,%s,%s,%s,1,%s,%s)
|
|
||||||
on duplicate key update
|
|
||||||
url=values(url),
|
|
||||||
description=values(description),
|
|
||||||
category=values(category),
|
|
||||||
updated_at=values(updated_at)
|
|
||||||
""",
|
|
||||||
(item["name"], item["url"], item["description"], item["category"], now, now),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def init_db():
|
def init_db():
|
||||||
with db() as c:
|
with db() as c:
|
||||||
with c.cursor() as cur:
|
with c.cursor() as cur:
|
||||||
@@ -111,9 +81,6 @@ def init_db():
|
|||||||
updated_at varchar(64) not null
|
updated_at varchar(64) not null
|
||||||
) engine=InnoDB default charset=utf8mb4
|
) engine=InnoDB default charset=utf8mb4
|
||||||
""")
|
""")
|
||||||
seed_default_links(c)
|
|
||||||
|
|
||||||
|
|
||||||
init_db()
|
init_db()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user