mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-07-26 16:41:51 +08:00
feat(webui): add search provider settings panel
- Add config-search-provider.vue component for managing search sources - Support CRUD operations for custom search providers - Default providers (mikan, nyaa, dmhy) cannot be deleted - URL template validation ensures %s placeholder is present - Add backend API endpoints GET/PUT /search/provider/config - Add i18n translations for zh-CN and en Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
from sse_starlette.sse import EventSourceResponse
|
||||
|
||||
from module.conf.search_provider import get_provider, save_provider
|
||||
from module.models import Bangumi
|
||||
from module.searcher import SEARCH_CONFIG, SearchTorrent
|
||||
from module.security.api import UNAUTHORIZED, get_current_user
|
||||
@@ -32,3 +33,24 @@ async def search_torrents(site: str = "mikan", keywords: str = Query(None)):
|
||||
)
|
||||
async def search_provider():
|
||||
return list(SEARCH_CONFIG.keys())
|
||||
|
||||
|
||||
@router.get(
|
||||
"/provider/config",
|
||||
response_model=dict[str, str],
|
||||
dependencies=[Depends(get_current_user)],
|
||||
)
|
||||
async def get_search_provider_config():
|
||||
"""Get all search providers with their URL templates."""
|
||||
return get_provider()
|
||||
|
||||
|
||||
@router.put(
|
||||
"/provider/config",
|
||||
response_model=dict[str, str],
|
||||
dependencies=[Depends(get_current_user)],
|
||||
)
|
||||
async def update_search_provider_config(providers: dict[str, str]):
|
||||
"""Update search providers configuration."""
|
||||
save_provider(providers)
|
||||
return get_provider()
|
||||
|
||||
Reference in New Issue
Block a user