Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ cython_debug/

/backend/src/module/run_debug.sh
/backend/src/module/debug_run.sh
/backend/src/module/__version__.py
/backend/src/data/

/src/module/conf/config_dev.ini
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# syntax=docker/dockerfile:1

FROM ghcr.io/astral-sh/uv:0.5-python3.13-alpine AS builder
FROM ghcr.io/astral-sh/uv:0.5-python3.13-alpine AS builder

WORKDIR /app
ENV UV_COMPILE_BYTECODE=1
Expand All @@ -14,7 +12,7 @@ RUN uv sync --frozen --no-dev
COPY backend/src ./src


FROM python:3.13-alpine AS runtime
FROM ghcr.io/astral-sh/uv:0.5-python3.13-alpine AS runtime

RUN apk add --no-cache \
bash \
Expand All @@ -34,6 +32,10 @@ WORKDIR /app
# Copy venv and source from builder
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/src .

# Copy pre-built frontend from host
COPY webui/dist ./dist

COPY --chmod=755 entrypoint.sh /entrypoint.sh

# Add user
Expand All @@ -43,7 +45,7 @@ RUN mkdir -p /home/ab && \

ENV PATH="/app/.venv/bin:$PATH"

EXPOSE 7892
EXPOSE 37892
VOLUME ["/app/config", "/app/data"]

ENTRYPOINT ["tini", "-g", "--", "/entrypoint.sh"]
1 change: 1 addition & 0 deletions backend/src/module/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "3.2.6-amy"
4 changes: 3 additions & 1 deletion backend/src/module/api/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class TestProviderConfigRequest(BaseModel):
user_key: Optional[str] = Field(None, description="User key")
api_token: Optional[str] = Field(None, description="API token")
template: Optional[str] = Field(None, description="Custom template")
url: Optional[str] = Field(None, description="URL for generic webhook")
url: Optional[str] = Field(None, description="URL for generic webhook/onebot")
message_type: Optional[str] = Field(None, description="Message type for onebot: private or group")


class TestResponse(BaseModel):
Expand Down Expand Up @@ -105,6 +106,7 @@ async def test_provider_config(request: TestProviderConfigRequest):
api_token=request.api_token or "",
template=request.template,
url=request.url or "",
message_type=request.message_type or "private",
)

success, message = await NotificationManager.test_provider_config(config)
Expand Down
21 changes: 9 additions & 12 deletions backend/src/module/api/program.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import os
import signal
import sys

from fastapi import APIRouter, Depends, HTTPException
from fastapi.responses import JSONResponse
Expand Down Expand Up @@ -68,18 +69,14 @@ async def stop():

@router.get("/status", response_model=dict, dependencies=[Depends(get_current_user)])
async def program_status():
if not program.is_running:
return {
"status": False,
"version": VERSION,
"first_run": program.first_run,
}
else:
return {
"status": True,
"version": VERSION,
"first_run": program.first_run,
}
is_linux = sys.platform == "linux"
base = {
"status": program.is_running,
"version": VERSION,
"first_run": program.first_run,
"platform": "linux" if is_linux else "windows",
}
return base


@router.get(
Expand Down
2 changes: 1 addition & 1 deletion backend/src/module/conf/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"program": {
"rss_time": 900,
"rename_time": 60,
"webui_port": 7892,
"webui_port": 37892,
},
"downloader": {
"type": "qbittorrent",
Expand Down
31 changes: 18 additions & 13 deletions backend/src/module/core/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@
logger = logging.getLogger(__name__)

figlet = r"""
_ ____ _
/\ | | | _ \ (_)
/ \ _ _| |_ ___ | |_) | __ _ _ __ __ _ _ _ _ __ ___ _
/ /\ \| | | | __/ _ \| _ < / _` | '_ \ / _` | | | | '_ ` _ \| |
/ ____ \ |_| | || (_) | |_) | (_| | | | | (_| | |_| | | | | | | |
/_/ \_\__,_|\__\___/|____/ \__,_|_| |_|\__, |\__,_|_| |_| |_|_|
__/ |
|___/
"""

$$$$$$\ $$\ $$\ $$\ $$\
$$ __$$\ $$$\ $$$ |\$$\ $$ |
$$ / $$ |$$$$\ $$$$ | \$$\ $$ /
$$$$$$$$ |$$\$$\$$ $$ | \$$$$ /
$$ __$$ |$$ \$$$ $$ | \$$ /
$$ | $$ |$$ |\$ /$$ | $$ |
$$ | $$ |$$ | \_/ $$ | $$ |
\__| \__|\__| \__| \__|

___ __ __ _
/ | __ __/ /_____ / /_ ____ _____ ____ ___ ______ ___ (_)
/ /| |/ / / / __/ __ \/ __ \/ __ `/ __ \/ __ `/ / / / __ `__ \/ /
/ ___ / /_/ / /_/ /_/ / /_/ / /_/ / / / / /_/ / /_/ / / / / / / /
/_/ |_\__,_/\__/\____/_.___/\__,_/_/ /_/\__, /\__,_/_/ /_/ /_/_/
/____/
"""
class Program(RenameThread, RSSThread, OffsetScanThread, CalendarRefreshThread):
def __init__(self):
super().__init__()
Expand All @@ -39,10 +44,10 @@ def __start_info():
for line in figlet.splitlines():
logger.info(line.strip("\n"))
logger.info(
f"Version {VERSION} Author: EstrellaXD Twitter: https://twitter.com/Estrella_Pan"
f"Version {VERSION} Author: AMYdd00 | Amy 自建修复版"
)
logger.info("GitHub: https://github.com/EstrellaXD/Auto_Bangumi/")
logger.info("Starting AutoBangumi...")
logger.info("GitHub: https://github.com/AMYdd00/Auto_Bangumi/")
logger.info("Starting...")

async def startup(self):
# Prevent duplicate startup due to nested router lifespan events
Expand Down
6 changes: 5 additions & 1 deletion backend/src/module/database/bangumi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import json
import json
import logging
import re
import time
Expand Down Expand Up @@ -428,6 +428,10 @@ def match_list(self, torrent_list: list, rss_link: str) -> list:

# Build compiled regex pattern for fast substring matching
# Sort by length descending so longer (more specific) matches are found first
# If no titles are available to match, return all as unmatched
if not title_index:
return torrent_list

sorted_titles = sorted(title_index.keys(), key=len, reverse=True)
# Escape special regex characters and join with alternation
pattern = "|".join(re.escape(title) for title in sorted_titles)
Expand Down
5 changes: 4 additions & 1 deletion backend/src/module/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ class NotificationProvider(BaseModel):
None, description="Custom template for webhook provider"
)
url_: Optional[str] = Field(
None, alias="url", description="URL for generic webhook provider"
None, alias="url", description="URL for generic webhook/onebot provider"
)
message_type: Optional[str] = Field(
"private", description="Message type for onebot: 'private' or 'group'"
)

@property
Expand Down
4 changes: 3 additions & 1 deletion backend/src/module/network/request_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ async def get_torrents(
torrents: list[Torrent] = []
if _filter is None:
_filter = "|".join(settings.rss_parser.filter)
if not _filter:
_filter = None
for _title, torrent_url, homepage in parsed_items:
if re.search(_filter, _title) is None:
if _filter is None or re.search(_filter, _title) is None:
torrents.append(
Torrent(name=_title, url=torrent_url, homepage=homepage)
)
Expand Down
3 changes: 3 additions & 0 deletions backend/src/module/notification/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from module.notification.providers.gotify import GotifyProvider
from module.notification.providers.pushover import PushoverProvider
from module.notification.providers.webhook import WebhookProvider
from module.notification.providers.onebot import OneBotProvider

if TYPE_CHECKING:
from module.notification.base import NotificationProvider
Expand All @@ -25,6 +26,7 @@
"gotify": GotifyProvider,
"pushover": PushoverProvider,
"webhook": WebhookProvider,
"onebot": OneBotProvider,
}

__all__ = [
Expand All @@ -37,4 +39,5 @@
"GotifyProvider",
"PushoverProvider",
"WebhookProvider",
"OneBotProvider",
]
Loading