Skip to content

Commit 0b2fa1d

Browse files
committed
Fix bug
1 parent 4b6a049 commit 0b2fa1d

File tree

10 files changed

+805
-423
lines changed

10 files changed

+805
-423
lines changed

public/images/new_icon.png

7.24 KB
Loading

src/components/ChooseTree.tsx

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,6 @@ const FolderTreeNode = (props: FolderTreeNodeProps) => {
278278
// 统一的节点点击处理函数
279279
const handleNodeClick = async (e: Event, segments: string[]) => {
280280
e.stopPropagation()
281-
console.log("\n========== 节点点击开始 ==========")
282-
console.log("事件类型:", e.type)
283-
console.log("事件目标:", e.target)
284-
console.log("点击的路径段:", segments)
285-
console.log("当前节点状态:", nodeState())
286-
console.log("当前选中路径:", selectedPaths?.())
287281

288282
if (multiSelect && onSelect) {
289283
// 获取当前节点的选中状态
@@ -323,6 +317,13 @@ const FolderTreeNode = (props: FolderTreeNodeProps) => {
323317
const load = async () => {
324318
if (children()?.length) return
325319
const resp = await fetchDirs()
320+
if (
321+
resp.code === 500 &&
322+
resp.message?.includes("storage not found; please add a storage first")
323+
) {
324+
setChildren([])
325+
return
326+
}
326327
handleResp(
327328
resp,
328329
(data) => {
@@ -480,6 +481,12 @@ const FolderTreeNode = (props: FolderTreeNodeProps) => {
480481
const getChildrenPaths = async (path: string): Promise<string[]> => {
481482
try {
482483
const resp = await fsDirs(path, password(), true)
484+
if (
485+
resp.code === 500 &&
486+
resp.message?.includes("storage not found; please add a storage first")
487+
) {
488+
return []
489+
}
483490
if (resp.code === 200) {
484491
return resp.data
485492
.filter((item: Obj) => item.is_dir)
@@ -495,6 +502,12 @@ const getChildrenPaths = async (path: string): Promise<string[]> => {
495502
const getChildrenNodes = async (path: string): Promise<PathNode[]> => {
496503
try {
497504
const resp = await fsDirs(path, password(), true)
505+
if (
506+
resp.code === 500 &&
507+
resp.message?.includes("storage not found; please add a storage first")
508+
) {
509+
return []
510+
}
498511

499512
if (resp.code === 200 && Array.isArray(resp.data)) {
500513
// API 返回的都是文件夹,直接映射成节点
@@ -523,6 +536,12 @@ const getSiblingPaths = async (path: string): Promise<PathNode[]> => {
523536
const parentPath = pathBase(path) || "/"
524537
try {
525538
const resp = await fsDirs(parentPath, password(), true)
539+
if (
540+
resp.code === 500 &&
541+
resp.message?.includes("storage not found; please add a storage first")
542+
) {
543+
return []
544+
}
526545
if (resp.code === 200 && Array.isArray(resp.data)) {
527546
return resp.data.map((item: Obj) => {
528547
const siblingPath = pathJoin(parentPath, item.name)
@@ -639,6 +658,12 @@ const checkAllChildrenSelected = async (
639658
): Promise<boolean> => {
640659
try {
641660
const resp = await fsDirs("/" + parentPath.join("/"), password(), true)
661+
if (
662+
resp.code === 500 &&
663+
resp.message?.includes("storage not found; please add a storage first")
664+
) {
665+
return false
666+
}
642667
if (resp.code === 200) {
643668
const dirs = resp.data.filter((item: Obj) => item.is_dir)
644669
// 检查每个子目录是否都被选中
@@ -694,6 +719,14 @@ const optimizeSelectedPaths = async (
694719
// 获取父路径下的实际子目录
695720
try {
696721
const resp = await fsDirs("/" + parentPathStr, password(), true)
722+
if (
723+
resp.code === 500 &&
724+
resp.message?.includes(
725+
"storage not found; please add a storage first",
726+
)
727+
) {
728+
continue
729+
}
697730
if (resp.code === 200) {
698731
// 后端返回的都是文件夹,不需要过滤
699732
const actualDirs = resp.data

src/components/EditLabelDialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const EditLabelDialog = (props: EditLabelDialogProps) => {
146146
</SelectPlaceholder>
147147
}
148148
>
149-
<For each={selectedLabelIds()}>
149+
<For each={selectedLabelIds().slice(0, 3)}>
150150
{(labelId) => (
151151
<Tag
152152
size="lg"
@@ -166,7 +166,7 @@ const EditLabelDialog = (props: EditLabelDialogProps) => {
166166
</Tag>
167167
)}
168168
</For>
169-
<Show when={selectedLabelIds().length >= 3}>
169+
<Show when={selectedLabelIds().length > 3}>
170170
<Tag
171171
size="lg"
172172
variant="subtle"

src/lang/en/storages.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@
4444
"load_all": "Reload All",
4545
"filter_by_driver": "Filter by driver",
4646
"table_layout": "Table layout"
47-
}
47+
},
48+
"no_storage_content": "failed get storage: storage not found; please add a storage first"
4849
}

src/pages/home/header/Header.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ import { isMac } from "~/utils/compatibility"
1919

2020
export const Header = () => {
2121
const logos = getSetting("logo").split("\n")
22-
const logo = useColorModeValue(logos[0], logos.pop())
22+
const defaultLogo =
23+
logos[0] === "https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg"
24+
? "/images/new_icon.png"
25+
: logos[0]
26+
const logo = useColorModeValue(
27+
defaultLogo,
28+
logos.pop() === "https://cdn.jsdelivr.net/gh/alist-org/logo@main/logo.svg"
29+
? "/images/new_icon.png"
30+
: logos.pop(),
31+
)
2332

2433
const stickyProps = createMemo<CenterProps>(() => {
2534
switch (local["position_of_header_navbar"]) {

src/pages/login/LoginBg.tsx

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
import { Box, useColorModeValue } from "@hope-ui/solid"
22
import CornerBottom from "./CornerBottom"
33
import CornerTop from "./CornerTop"
4+
import { Show } from "solid-js"
45

5-
const LoginBg = () => {
6+
interface LoginBgProps {
7+
useNewVersion: boolean
8+
}
9+
10+
const LoginBg = (props: LoginBgProps) => {
611
const bgColor = useColorModeValue("#a9c6ff", "#062b74")
712
return (
813
<Box
9-
// bgColor={bgColor()}
10-
style={{
11-
"background-image": "url(/images/new_bg.png)",
12-
"background-size": "cover",
13-
"background-position": "center",
14-
}}
14+
bgColor={props.useNewVersion ? undefined : bgColor()}
15+
style={
16+
props.useNewVersion
17+
? {
18+
"background-image": "url(/images/new_bg.png)",
19+
"background-size": "cover",
20+
"background-position": "center",
21+
}
22+
: undefined
23+
}
1524
pos="fixed"
1625
top="0"
1726
left="0"
@@ -20,32 +29,34 @@ const LoginBg = () => {
2029
w="100vw"
2130
h="100vh"
2231
>
23-
<Box
24-
pos="absolute"
25-
right={{
26-
"@initial": "-100px",
27-
"@sm": "-300px",
28-
}}
29-
top={{
30-
"@initial": "-1170px",
31-
"@sm": "-900px",
32-
}}
33-
>
34-
{/* <CornerTop /> */}
35-
</Box>
36-
<Box
37-
pos="absolute"
38-
left={{
39-
"@initial": "-100px",
40-
"@sm": "-200px",
41-
}}
42-
bottom={{
43-
"@initial": "-760px",
44-
"@sm": "-400px",
45-
}}
46-
>
47-
{/* <CornerBottom /> */}
48-
</Box>
32+
<Show when={!props.useNewVersion}>
33+
<Box
34+
pos="absolute"
35+
right={{
36+
"@initial": "-100px",
37+
"@sm": "-300px",
38+
}}
39+
top={{
40+
"@initial": "-1170px",
41+
"@sm": "-900px",
42+
}}
43+
>
44+
<CornerTop />
45+
</Box>
46+
<Box
47+
pos="absolute"
48+
left={{
49+
"@initial": "-100px",
50+
"@sm": "-200px",
51+
}}
52+
bottom={{
53+
"@initial": "-760px",
54+
"@sm": "-400px",
55+
}}
56+
>
57+
<CornerBottom />
58+
</Box>
59+
</Show>
4960
</Box>
5061
)
5162
}

0 commit comments

Comments
 (0)