diff --git a/src/lang/en/entry.ts b/src/lang/en/entry.ts index 238c699..c9ab661 100644 --- a/src/lang/en/entry.ts +++ b/src/lang/en/entry.ts @@ -13,7 +13,6 @@ import shares from "./shares.json" import storages from "./storages.json" import tasks from "./tasks.json" import users from "./users.json" -import virtual_hosts from "./virtual_hosts.json" export const dict = { br, @@ -31,5 +30,4 @@ export const dict = { storages, tasks, users, - virtual_hosts, } diff --git a/src/lang/en/manage.json b/src/lang/en/manage.json index 2269587..5829c6e 100644 --- a/src/lang/en/manage.json +++ b/src/lang/en/manage.json @@ -11,7 +11,6 @@ "storages": "Storages", "shares": "Shares", "metas": "Metas", - "virtual_hosts": "Virtual Hosts", "profile": "Profile", "about": "About", "tasks": "Tasks", diff --git a/src/lang/en/virtual_hosts.json b/src/lang/en/virtual_hosts.json deleted file mode 100644 index 7e04017..0000000 --- a/src/lang/en/virtual_hosts.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "domain": "Domain", - "domain_help": "The domain name to bind (e.g. blog.example.com)", - "path": "Path", - "path_help": "The OpenList path to map this domain to", - "enabled": "Enabled", - "web_hosting": "Web Hosting", - "web_hosting_help": "If enabled, HTML files will be served directly instead of the file browser" -} diff --git a/src/pages/manage/routes.tsx b/src/pages/manage/routes.tsx index 9da9377..5fa444d 100644 --- a/src/pages/manage/routes.tsx +++ b/src/pages/manage/routes.tsx @@ -39,14 +39,6 @@ const hide_routes: Route[] = [ to: "/metas/edit/:id", component: lazy(() => import("./metas/AddOrEdit")), }, - { - to: "/virtual_hosts/add", - component: lazy(() => import("./virtual_hosts/AddOrEdit")), - }, - { - to: "/virtual_hosts/edit/:id", - component: lazy(() => import("./virtual_hosts/AddOrEdit")), - }, { to: "/2fa", component: lazy(() => import("./users/2fa")), diff --git a/src/pages/manage/sidemenu_items.tsx b/src/pages/manage/sidemenu_items.tsx index 360d1e0..6776e38 100644 --- a/src/pages/manage/sidemenu_items.tsx +++ b/src/pages/manage/sidemenu_items.tsx @@ -14,7 +14,6 @@ import { BsBucket, BsHddNetwork, BsArrowLeftRight, - BsGlobe, } from "solid-icons/bs" import { FiLogIn } from "solid-icons/fi" import { SiMetabase } from "solid-icons/si" @@ -188,12 +187,6 @@ export const side_menu_items: SideMenuItem[] = [ to: "/@manage/metas", component: lazy(() => import("./metas/Metas")), }, - { - title: "manage.sidemenu.virtual_hosts", - icon: BsGlobe, - to: "/@manage/virtual_hosts", - component: lazy(() => import("./virtual_hosts/VirtualHosts")), - }, { title: "manage.sidemenu.indexes", icon: BsSearch, diff --git a/src/pages/manage/virtual_hosts/AddOrEdit.tsx b/src/pages/manage/virtual_hosts/AddOrEdit.tsx deleted file mode 100644 index ad8d264..0000000 --- a/src/pages/manage/virtual_hosts/AddOrEdit.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { - Button, - Switch as HopeSwitch, - FormControl, - FormHelperText, - FormLabel, - Heading, - Input, - VStack, -} from "@hope-ui/solid" -import { MaybeLoading, FolderChooseInput } from "~/components" -import { useFetch, useRouter, useT } from "~/hooks" -import { handleResp, notify, r } from "~/utils" -import { VirtualHost, PEmptyResp, PResp } from "~/types" -import { createStore } from "solid-js/store" - -const AddOrEdit = () => { - const t = useT() - const { params, back } = useRouter() - const { id } = params - const [vhost, setVhost] = createStore({ - id: 0, - enabled: true, - domain: "", - path: "", - web_hosting: false, - }) - const [vhostLoading, loadVhost] = useFetch( - (): PResp => r.get(`/admin/vhost/get?id=${id}`), - ) - - const initEdit = async () => { - const resp = await loadVhost() - handleResp(resp, setVhost) - } - if (id) { - initEdit() - } - const [okLoading, ok] = useFetch((): PEmptyResp => { - return r.post(`/admin/vhost/${id ? "update" : "create"}`, vhost) - }) - return ( - - - {t(`global.${id ? "edit" : "add"}`)} - - {/* 启用开关 */} - - - {t("virtual_hosts.enabled")} - - setVhost("enabled", e.currentTarget.checked)} - /> - - - {/* 域名 */} - - {t("virtual_hosts.domain")} - setVhost("domain", e.currentTarget.value)} - /> - {t("virtual_hosts.domain_help")} - - - {/* 路径 */} - - {t("virtual_hosts.path")} - setVhost("path", path)} - /> - {t("virtual_hosts.path_help")} - - - {/* Web 托管开关 */} - - - - {t("virtual_hosts.web_hosting")} - - - setVhost("web_hosting", e.currentTarget.checked) - } - /> - - {t("virtual_hosts.web_hosting_help")} - - - - - - ) -} - -export default AddOrEdit diff --git a/src/pages/manage/virtual_hosts/VirtualHosts.tsx b/src/pages/manage/virtual_hosts/VirtualHosts.tsx deleted file mode 100644 index 80dc390..0000000 --- a/src/pages/manage/virtual_hosts/VirtualHosts.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { - Box, - Button, - HStack, - Table, - Tbody, - Td, - Th, - Thead, - Tr, - VStack, -} from "@hope-ui/solid" -import { createSignal, For } from "solid-js" -import { - useFetch, - useListFetch, - useManageTitle, - useRouter, - useT, -} from "~/hooks" -import { handleResp, notify, r } from "~/utils" -import { VirtualHost, PEmptyResp, PPageResp } from "~/types" -import { DeletePopover } from "../common/DeletePopover" -import { Wether } from "~/components" - -const VirtualHosts = () => { - const t = useT() - useManageTitle("manage.sidemenu.virtual_hosts") - const { to } = useRouter() - const [getVhostsLoading, getVhosts] = useFetch( - (): PPageResp => r.get("/admin/vhost/list"), - ) - const [vhosts, setVhosts] = createSignal([]) - const refresh = async () => { - const resp = await getVhosts() - handleResp(resp, (data) => setVhosts(data.content)) - } - refresh() - - const [deleting, deleteVhost] = useListFetch( - (id: number): PEmptyResp => r.post(`/admin/vhost/delete?id=${id}`), - ) - return ( - - - - - - - - - - - {(title) => } - - - - - - - {(vhost) => ( - - - - - - - - )} - - -
{t(`virtual_hosts.${title}`)}{t("global.operations")}
{vhost.domain}{vhost.path} - - - - - - - { - const resp = await deleteVhost(vhost.id) - handleResp(resp, () => { - notify.success(t("global.delete_success")) - refresh() - }) - }} - /> - -
-
-
- ) -} - -export default VirtualHosts diff --git a/src/types/index.ts b/src/types/index.ts index 8241449..52f45e9 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -8,4 +8,3 @@ export * from "./item_type" export * from "./meta" export * from "./task" export * from "./share" -export * from "./virtual_host" diff --git a/src/types/virtual_host.ts b/src/types/virtual_host.ts deleted file mode 100644 index 5114e56..0000000 --- a/src/types/virtual_host.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface VirtualHost { - id: number - enabled: boolean - domain: string - path: string - web_hosting: boolean -}