diff --git a/Dockerfile b/Dockerfile index 02c9995c..af83d197 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,6 @@ RUN set -ex && \ shadow \ tini \ openssl \ - busybox-suid \ tzdata && \ python3 -m pip install --no-cache-dir --upgrade pip && \ sed -i '/bcrypt/d' requirements.txt && \ diff --git a/backend/src/module/database/bangumi.py b/backend/src/module/database/bangumi.py index ae4ed366..b484c6b0 100644 --- a/backend/src/module/database/bangumi.py +++ b/backend/src/module/database/bangumi.py @@ -144,7 +144,9 @@ class BangumiDatabase: # Find eps_complete = False # use `false()` to avoid E712 checking # see: https://docs.astral.sh/ruff/rules/true-false-comparison/ - condition = select(Bangumi).where(Bangumi.eps_collect == false()) + condition = select(Bangumi).where( + and_(Bangumi.eps_collect == false(), Bangumi.deleted == false()) + ) datas = self.session.exec(condition).all() return datas diff --git a/backend/src/module/network/request_url.py b/backend/src/module/network/request_url.py index c6148074..0b85e77e 100644 --- a/backend/src/module/network/request_url.py +++ b/backend/src/module/network/request_url.py @@ -20,10 +20,11 @@ class RequestURL: while True: try: req = self.session.get(url=url, headers=self.header, timeout=5) + logger.debug(f"[Network] Successfully connected to {url}. Status: {req.status_code}") req.raise_for_status() return req except requests.RequestException: - logger.warning( + logger.debug( f"[Network] Cannot connect to {url}. Wait for 5 seconds." ) try_time += 1 @@ -33,8 +34,7 @@ class RequestURL: except Exception as e: logger.debug(e) break - logger.error(f"[Network] Failed connecting to {url}") - logger.warning("[Network] Please check DNS/Connection settings") + logger.error(f"[Network] Unable to connect to {url}, Please check your network settings") return None def post_url(self, url: str, data: dict, retry=3): diff --git a/backend/src/module/rss/analyser.py b/backend/src/module/rss/analyser.py index af1bc79a..457098e6 100644 --- a/backend/src/module/rss/analyser.py +++ b/backend/src/module/rss/analyser.py @@ -82,14 +82,21 @@ class RSSAnalyser(TitleParser): def link_to_data(self, rss: RSSItem) -> Bangumi | ResponseModel: torrents = self.get_rss_torrents(rss.url, False) + if not torrents: + return ResponseModel( + status=False, + status_code=406, + msg_en="Cannot find any torrent.", + msg_zh="无法找到种子。", + ) for torrent in torrents: data = self.torrent_to_data(torrent, rss) if data: return data - else: - return ResponseModel( - status=False, - status_code=406, - msg_en="Cannot parse this link.", - msg_zh="无法解析此链接。", - ) + return ResponseModel( + status=False, + status_code=406, + msg_en="Cannot parse this link.", + msg_zh="无法解析此链接。", + ) + diff --git a/webui/src/components/layout/ab-sidebar.vue b/webui/src/components/layout/ab-sidebar.vue index 8aa726cf..35f442a8 100644 --- a/webui/src/components/layout/ab-sidebar.vue +++ b/webui/src/components/layout/ab-sidebar.vue @@ -64,7 +64,6 @@ const items = [ icon: Download, label: () => t('sidebar.downloader'), path: '/downloader', - hidden: true, }, { id: 6, diff --git a/webui/src/hooks/useMyI18n.ts b/webui/src/hooks/useMyI18n.ts index 01e30974..abf46890 100644 --- a/webui/src/hooks/useMyI18n.ts +++ b/webui/src/hooks/useMyI18n.ts @@ -7,8 +7,13 @@ const messages = { 'zh-CN': zhCN, }; +type Languages = keyof typeof messages; + export const useMyI18n = createSharedComposable(() => { - const lang = useLocalStorage('lang', navigator.language); + const lang = useLocalStorage( + 'lang', + navigator.language as Languages + ); const i18n = createI18n({ legacy: false, @@ -17,21 +22,31 @@ export const useMyI18n = createSharedComposable(() => { messages, }); + watch(lang, (val) => { + i18n.global.locale.value = val; + }); + function changeLocale() { if (lang.value === 'zh-CN') { - i18n.global.locale.value = 'en'; lang.value = 'en'; } else { - i18n.global.locale.value = 'zh-CN'; lang.value = 'zh-CN'; } } + function returnUserLangText(texts: { + [k in Languages]: string; + }) { + return computed(() => texts[lang.value]); + } + return { lang, i18n, t: i18n.global.t, locale: i18n.global.locale, changeLocale, + getText: returnUserLangText, + returnUserLangText, }; }); diff --git a/webui/src/i18n/en.json b/webui/src/i18n/en.json index 48897876..b66c8092 100644 --- a/webui/src/i18n/en.json +++ b/webui/src/i18n/en.json @@ -77,6 +77,9 @@ "player": { "hit": "Please set up the media player" }, + "downloader": { + "hit": "Please set up the downloader" + }, "log": { "title": "Log", "reset": "Reset", diff --git a/webui/src/i18n/zh-CN.json b/webui/src/i18n/zh-CN.json index 2947b9e4..4eae72bd 100644 --- a/webui/src/i18n/zh-CN.json +++ b/webui/src/i18n/zh-CN.json @@ -77,6 +77,9 @@ "player": { "hit": "请设置媒体播放器地址" }, + "downloader": { + "hit": "请设置下载器" + }, "log": { "title": "日志", "reset": "重置", diff --git a/webui/src/pages/index/downloader.vue b/webui/src/pages/index/downloader.vue index 2f1930bc..1cb870fd 100644 --- a/webui/src/pages/index/downloader.vue +++ b/webui/src/pages/index/downloader.vue @@ -2,8 +2,42 @@ definePage({ name: 'Downloader', }); + +const { config } = storeToRefs(useConfigStore()); +const { getConfig } = useConfigStore(); + +getConfig(); + +const isNull = computed(() => { + return config.value.downloader.host === ''; +}); + +const url = computed(() => { + const downloader = config.value.downloader; + const protocol = downloader.ssl ? 'https' : 'http'; + + return `${protocol}://${downloader.host}`; +}); diff --git a/webui/types/dts/components.d.ts b/webui/types/dts/components.d.ts index 3859b6ae..d066755e 100644 --- a/webui/types/dts/components.d.ts +++ b/webui/types/dts/components.d.ts @@ -35,7 +35,6 @@ declare module '@vue/runtime-core' { AbTag: typeof import('./../../src/components/basic/ab-tag.vue')['default'] AbTopbar: typeof import('./../../src/components/layout/ab-topbar.vue')['default'] ConfigDownload: typeof import('./../../src/components/setting/config-download.vue')['default'] - ConfigExperimental: typeof import('./../../src/components/setting/config-experimental.vue')['default'] ConfigManage: typeof import('./../../src/components/setting/config-manage.vue')['default'] ConfigNormal: typeof import('./../../src/components/setting/config-normal.vue')['default'] ConfigNotification: typeof import('./../../src/components/setting/config-notification.vue')['default']