Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/lang/en/settings_other.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"pikpak": "PikPak",
"set_pikpak": "Set PikPak",
"thunder": "Thunder",
"set_thunder": "Set Thunder"
"set_thunder": "Set Thunder",
"set_thunderX": "Set ThunderX"
}
33 changes: 33 additions & 0 deletions src/pages/manage/settings/Other.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const OtherSettings = () => {
const [pan115TempDir, set115TempDir] = createSignal("")
const [pikpakTempDir, setPikPakTempDir] = createSignal("")
const [thunderTempDir, setThunderTempDir] = createSignal("")
const [thunderXTempDir, setThunderXTempDir] = createSignal("")
const [token, setToken] = createSignal("")
const [settings, setSettings] = createSignal<SettingItem[]>([])
const [settingsLoading, settingsData] = useFetch(
Expand Down Expand Up @@ -68,6 +69,12 @@ const OtherSettings = () => {
temp_dir: thunderTempDir(),
}),
)
const [setThunderXLoading, setThunderX] = useFetch(
(): PResp<string> =>
r.post("/admin/setting/set_thunderx", {
temp_dir: thunderXTempDir(),
}),
)
const refresh = async () => {
const resp = await settingsData()
handleResp(resp, (data) => {
Expand All @@ -91,6 +98,9 @@ const OtherSettings = () => {
setThunderTempDir(
data.find((i) => i.key === "thunder_temp_dir")?.value || "",
)
setThunderXTempDir(
data.find((i) => i.key === "thunderx_temp_dir")?.value || "",
)
setSettings(data)
})
}
Expand Down Expand Up @@ -246,6 +256,29 @@ const OtherSettings = () => {
>
{t("settings_other.set_thunder")}
</Button>
<Heading my="$2">{t("settings_other.thunderx")}</Heading>
<FormControl w="$full" display="flex" flexDirection="column">
<FormLabel for="thunderX_temp_dir" display="flex" alignItems="center">
{t(`settings.thunderX_temp_dir`)}
</FormLabel>
<FolderChooseInput
id="thunderX_temp_dir"
value={thunderTempDir()}
onChange={(path) => setThunderTempDir(path)}
/>
</FormControl>
<Button
my="$2"
loading={setThunderXLoading()}
onClick={async () => {
const resp = await setThunderX()
handleResp(resp, (data) => {
notify.success(data)
})
}}
>
{t("settings_other.set_thunderX")}
</Button>
<Heading my="$2">{t("settings.token")}</Heading>
<Input value={token()} readOnly />
<HStack my="$2" spacing="$2">
Expand Down