Remove library selection and default theme

This commit is contained in:
Koha9 2025-06-20 22:32:05 +09:00
parent 75a413667d
commit 83c5780c57
4 changed files with 6 additions and 15 deletions

View File

@ -1,7 +1,6 @@
{ {
"theme": "light", "theme": "auto",
"token": "", "token": "",
"server_url": "", "server_url": "",
"server_port": "32400", "server_port": "32400"
"library": ""
} }

View File

@ -32,13 +32,12 @@ async def login(
user: str = Form(...), user: str = Form(...),
pw: str = Form(...), pw: str = Form(...),
url: str = Form(...), url: str = Form(...),
port: str = Form("32400"), port: str = Form("32400")
library: str = Form(...)
): ):
config = load_config() config = load_config()
theme = config.get("theme", "auto") theme = config.get("theme", "auto")
try: try:
connect_plex(config, user, pw, url, port, library) connect_plex(config, user, pw, url, port)
save_config(config) save_config(config)
return templates.TemplateResponse( return templates.TemplateResponse(
"login.html", "login.html",

View File

@ -21,13 +21,6 @@
<label for="port" class="form-label">端口</label> <label for="port" class="form-label">端口</label>
<input type="text" class="form-control" id="port" name="port" value="32400"> <input type="text" class="form-control" id="port" name="port" value="32400">
</div> </div>
<div class="mb-3">
<label for="library" class="form-label">选择库</label>
<select class="form-select" id="library" name="library">
<option>Music</option>
<option>Podcast</option>
</select>
</div>
<button type="submit" class="btn btn-primary">连接</button> <button type="submit" class="btn btn-primary">连接</button>
</form> </form>

View File

@ -2,7 +2,7 @@ from plexapi.myplex import MyPlexAccount
from plexapi.server import PlexServer from plexapi.server import PlexServer
def connect_plex(config, username, password, url, port="32400", library=""): def connect_plex(config, username, password, url, port="32400"):
"""Return a connected PlexServer instance and update config with token and server info.""" """Return a connected PlexServer instance and update config with token and server info."""
token = config.get("token") token = config.get("token")
if not token: if not token:
@ -12,5 +12,5 @@ def connect_plex(config, username, password, url, port="32400", library=""):
base_url = f"http://{url}:{port}" base_url = f"http://{url}:{port}"
server = PlexServer(base_url, token) server = PlexServer(base_url, token)
config.update({"server_url": url, "server_port": port, "library": library}) config.update({"server_url": url, "server_port": port})
return server return server