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
6 changes: 5 additions & 1 deletion src/lang/en/shares.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@
},
"input_password": "Please enter Share Code",
"copy_msg": "Copy link",
"no_permission_tip": "To create a share, you need \"Share\" permission."
"no_permission_tip": "To create a share, you need \"Share\" permission.",
"domain": "Domain",
"domain_help": "The domain name to bind (e.g. blog.example.com); leave empty for a normal share link.",
"web_hosting": "Web Hosting",
"web_hosting_help": "If enabled, HTML files will be served directly via the bound domain instead of the file browser."
}
19 changes: 19 additions & 0 deletions src/pages/manage/shares/AddOrEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,25 @@ const AddOrEdit = () => {
setShare("header", h)
}}
/>
<Item
name="domain"
type={Type.String}
value={share.domain ?? ""}
valid
placeholder="blog.example.com"
onChange={(d) => {
setShare("domain", d)
}}
/>
<Item
name="web_hosting"
type={Type.Bool}
value={share.web_hosting ?? false}
valid
onChange={(w) => {
setShare("web_hosting", w)
}}
/>
</ResponsiveGrid>
<Button
mt="$2"
Expand Down
5 changes: 5 additions & 0 deletions src/pages/manage/shares/Share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { DeletePopover } from "../common/DeletePopover"
import { getSetting, me } from "~/store"
import { Show } from "solid-js"
import { Wether } from "~/components"

interface ShareProps {
share: ShareInfo
Expand Down Expand Up @@ -139,6 +140,10 @@ export function ShareListItem(props: ShareProps) {
<Td>{accessed()}</Td>
<Td>{t(`shares.status_list.${status()}`)}</Td>
<Td>{props.share.remark}</Td>
<Td>{props.share.domain ? props.share.domain : "-"}</Td>
<Td>
<Wether yes={!!props.share.web_hosting} />
</Td>
<Td>
<HStack spacing="$2">
<Button
Expand Down
11 changes: 10 additions & 1 deletion src/pages/manage/shares/Shares.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,16 @@ const Shares = () => {
<Show when={UserMethods.is_admin(me())}>
<Th>{t(`shares.creator`)}</Th>
</Show>
<For each={["expires", "accessed", "status", "remark"]}>
<For
each={[
"expires",
"accessed",
"status",
"remark",
"domain",
"web_hosting",
]}
>
{(title) => <Th>{t(`shares.${title}`)}</Th>}
</For>
<Th>{t("global.operations")}</Th>
Expand Down
2 changes: 2 additions & 0 deletions src/types/share.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export interface Share {
remark: string
readme: string
header: string
domain?: string
web_hosting?: boolean
}

export interface ShareUpdate extends Share {
Expand Down