diff --git a/src/lang/en/settings.json b/src/lang/en/settings.json index bc0efca9b..284f5518f 100755 --- a/src/lang/en/settings.json +++ b/src/lang/en/settings.json @@ -106,6 +106,9 @@ "sso_organization_name": "Sso organization name", "text_types": "Text types", "token": "Token", + "115_temp_dir": "115 temp dir", + "pikpak_temp_dir": "PikPak temp dir", + "thunder_temp_dir": "Thunder temp dir", "transmission_seedtime": "Transmission seedtime", "transmission_uri": "Transmission uri", "version": "Version", diff --git a/src/lang/en/settings_other.json b/src/lang/en/settings_other.json index c1fd77447..d635230d8 100644 --- a/src/lang/en/settings_other.json +++ b/src/lang/en/settings_other.json @@ -9,5 +9,11 @@ "set_qbit": "Set qBittorrent", "qbittorrent": "qBittorrent", "transmission": "Transmission", - "set_transmission": "Set Transmission" + "set_transmission": "Set Transmission", + "115": "115", + "set_115": "Set 115", + "pikpak": "PikPak", + "set_pikpak": "Set PikPak", + "thunder": "Thunder", + "set_thunder": "Set Thunder" } diff --git a/src/pages/manage/settings/Other.tsx b/src/pages/manage/settings/Other.tsx index 5ddae0bf7..5b0c95125 100644 --- a/src/pages/manage/settings/Other.tsx +++ b/src/pages/manage/settings/Other.tsx @@ -1,6 +1,14 @@ -import { Button, Heading, HStack, Input, SimpleGrid } from "@hope-ui/solid" +import { + Button, + FormControl, + FormLabel, + Heading, + HStack, + Input, + SimpleGrid, +} from "@hope-ui/solid" import { createSignal } from "solid-js" -import { MaybeLoading } from "~/components" +import { FolderChooseInput, MaybeLoading } from "~/components" import { useFetch, useManageTitle, useT, useUtil } from "~/hooks" import { Group, SettingItem, PResp } from "~/types" import { handleResp, notify, r } from "~/utils" @@ -15,6 +23,9 @@ const OtherSettings = () => { const [qbitSeedTime, setQbitSeedTime] = createSignal("") const [transmissionUrl, setTransmissionUrl] = createSignal("") const [transmissionSeedTime, setTransmissionSeedTime] = createSignal("") + const [pan115TempDir, set115TempDir] = createSignal("") + const [pikpakTempDir, setPikPakTempDir] = createSignal("") + const [thunderTempDir, setThunderTempDir] = createSignal("") const [token, setToken] = createSignal("") const [settings, setSettings] = createSignal([]) const [settingsLoading, settingsData] = useFetch( @@ -39,6 +50,24 @@ const OtherSettings = () => { seedtime: transmissionSeedTime(), }), ) + const [set115Loading, set115] = useFetch( + (): PResp => + r.post("/admin/setting/set_115", { + temp_dir: pan115TempDir(), + }), + ) + const [setPikPakLoading, setPikPak] = useFetch( + (): PResp => + r.post("/admin/setting/set_pikpak", { + temp_dir: pikpakTempDir(), + }), + ) + const [setThunderLoading, setThunder] = useFetch( + (): PResp => + r.post("/admin/setting/set_thunder", { + temp_dir: thunderTempDir(), + }), + ) const refresh = async () => { const resp = await settingsData() handleResp(resp, (data) => { @@ -55,6 +84,13 @@ const OtherSettings = () => { setTransmissionSeedTime( data.find((i) => i.key === "transmission_seedtime")?.value || "", ) + set115TempDir(data.find((i) => i.key === "115_temp_dir")?.value || "") + setPikPakTempDir( + data.find((i) => i.key === "pikpak_temp_dir")?.value || "", + ) + setThunderTempDir( + data.find((i) => i.key === "thunder_temp_dir")?.value || "", + ) setSettings(data) }) } @@ -141,6 +177,75 @@ const OtherSettings = () => { > {t("settings_other.set_transmission")} + {t("settings_other.115")} + + + {t(`settings.115_temp_dir`)} + + set115TempDir(path)} + /> + + + {t("settings_other.pikpak")} + + + {t(`settings.pikpak_temp_dir`)} + + setPikPakTempDir(path)} + /> + + + {t("settings_other.thunder")} + + + {t(`settings.thunder_temp_dir`)} + + setThunderTempDir(path)} + /> + + {t("settings.token")} diff --git a/src/pages/manage/sidemenu_items.tsx b/src/pages/manage/sidemenu_items.tsx index 5999292cb..a6950e587 100644 --- a/src/pages/manage/sidemenu_items.tsx +++ b/src/pages/manage/sidemenu_items.tsx @@ -108,7 +108,7 @@ export const side_menu_items: SideMenuItem[] = [ { title: "manage.sidemenu.offline_download", icon: IoMagnetOutline, - to: "/@manage/tasks/aria2", + to: "/@manage/tasks/offline_download", role: UserRole.GENERAL, component: lazy(() => import("./tasks/offline_download")), }, diff --git a/src/pages/manage/tasks/helper.tsx b/src/pages/manage/tasks/helper.tsx index 066fb26f1..7428f1597 100644 --- a/src/pages/manage/tasks/helper.tsx +++ b/src/pages/manage/tasks/helper.tsx @@ -3,12 +3,16 @@ import { me } from "~/store" import { TaskNameAnalyzer } from "./Tasks" import { useT } from "~/hooks" -export const getPath = (device: string, path: string): JSX.Element => { +export const getPath = ( + device: string, + path: string, + asLink: boolean = true, +): JSX.Element => { const fullPath = (device === "/" ? "" : device) + path const prefix = me().base_path === "/" ? "" : me().base_path const accessible = fullPath.startsWith(prefix) const [underline, setUnderline] = createSignal(false) - return accessible ? ( + return accessible && asLink ? ( setUnderline(true)} @@ -49,14 +53,13 @@ export const getOfflineDownloadNameAnalyzer = (): TaskNameAnalyzer => { export const getOfflineDownloadTransferNameAnalyzer = (): TaskNameAnalyzer => { const t = useT() return { - regex: /^transfer ((?:.*\/)?(.+)) to \[(.+)]$/, - title: (matches) => matches[2], + regex: /^transfer \[(.*)]\((.*\/([^\/]+))\) to \[(.+)]\((.+)\)$/, + title: (matches) => matches[3], attrs: { - [t(`tasks.attr.offline_download.transfer_src`)]: (matches) => ( -

{matches[1]}

- ), + [t(`tasks.attr.offline_download.transfer_src`)]: (matches) => + getPath(matches[1], matches[2], false), [t(`tasks.attr.offline_download.transfer_dst`)]: (matches) => - getPath("", matches[3]), + getPath(matches[4], matches[5]), }, } }