Merge pull request #611 from EstrellaXD/3.1-dev

3.1.11
This commit is contained in:
Estrella Pan
2023-10-31 21:29:26 +08:00
committed by GitHub
10 changed files with 79 additions and 18 deletions

View File

@@ -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 && \

View File

@@ -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

View File

@@ -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):

View File

@@ -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="无法解析此链接。",
)

View File

@@ -64,7 +64,6 @@ const items = [
icon: Download,
label: () => t('sidebar.downloader'),
path: '/downloader',
hidden: true,
},
{
id: 6,

View File

@@ -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<Languages>(
'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,
};
});

View File

@@ -77,6 +77,9 @@
"player": {
"hit": "Please set up the media player"
},
"downloader": {
"hit": "Please set up the downloader"
},
"log": {
"title": "Log",
"reset": "Reset",

View File

@@ -77,6 +77,9 @@
"player": {
"hit": "请设置媒体播放器地址"
},
"downloader": {
"hit": "请设置下载器"
},
"log": {
"title": "日志",
"reset": "重置",

View File

@@ -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}`;
});
</script>
<template>
<div>null</div>
<div overflow-auto mt-12px flex-grow>
<template v-if="isNull">
<div wh-full f-cer text-h1 text-primary>
<RouterLink to="/config" hover:underline>{{
$t('downloader.hit')
}}</RouterLink>
</div>
</template>
<iframe
:src="url"
frameborder="0"
allowfullscreen="true"
w-full
h-full
flex-1
rounded-12px
></iframe>
</div>
</template>

View File

@@ -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']