mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-06 16:24:17 +00:00
feat(share): expose raw password on settings page
This commit is contained in:
@@ -301,6 +301,7 @@ export class ShareService {
|
|||||||
expireAt: l.expireAt?.toISOString(),
|
expireAt: l.expireAt?.toISOString(),
|
||||||
isDisabled: l.isDisabled,
|
isDisabled: l.isDisabled,
|
||||||
hasPassword: !!l.password,
|
hasPassword: !!l.password,
|
||||||
|
password: l.password,
|
||||||
defaultSortOrder: l.defaultSortOrder,
|
defaultSortOrder: l.defaultSortOrder,
|
||||||
viewMode: l.viewMode,
|
viewMode: l.viewMode,
|
||||||
fieldVisibility: l.fieldVisibility as Record<string, boolean> | undefined,
|
fieldVisibility: l.fieldVisibility as Record<string, boolean> | undefined,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export interface ShareLinkInfo {
|
|||||||
expireAt?: string
|
expireAt?: string
|
||||||
isDisabled: boolean
|
isDisabled: boolean
|
||||||
hasPassword: boolean
|
hasPassword: boolean
|
||||||
|
password?: string | null
|
||||||
defaultSortOrder?: string
|
defaultSortOrder?: string
|
||||||
viewMode?: string
|
viewMode?: string
|
||||||
fieldVisibility?: Record<string, boolean>
|
fieldVisibility?: Record<string, boolean>
|
||||||
|
|||||||
@@ -45,10 +45,14 @@ export function ShareSettingsSidebar({
|
|||||||
onSortOrderChange,
|
onSortOrderChange,
|
||||||
}: ShareSettingsSidebarProps) {
|
}: ShareSettingsSidebarProps) {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const [password, setPassword] = useState('')
|
const [password, setPassword] = useState(shareLink.password || '')
|
||||||
const [expireAt, setExpireAt] = useState<Date | undefined>(
|
const [expireAt, setExpireAt] = useState<Date | undefined>(
|
||||||
shareLink.expireAt ? new Date(shareLink.expireAt) : undefined,
|
shareLink.expireAt ? new Date(shareLink.expireAt) : undefined,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
setPassword(shareLink.password || '')
|
||||||
|
}, [shareLink.password])
|
||||||
const [isPasswordEnabled, setIsPasswordEnabled] = useState(shareLink.hasPassword)
|
const [isPasswordEnabled, setIsPasswordEnabled] = useState(shareLink.hasPassword)
|
||||||
const [isExpireEnabled, setIsExpireEnabled] = useState(!!shareLink.expireAt)
|
const [isExpireEnabled, setIsExpireEnabled] = useState(!!shareLink.expireAt)
|
||||||
|
|
||||||
@@ -146,10 +150,10 @@ export function ShareSettingsSidebar({
|
|||||||
{isPasswordEnabled && (
|
{isPasswordEnabled && (
|
||||||
<div className="flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200">
|
<div className="flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200">
|
||||||
<Input
|
<Input
|
||||||
type="password"
|
type="text"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
placeholder={shareLink.hasPassword ? '••••••••' : 'Set password'}
|
placeholder="Enter password"
|
||||||
className="text-xs"
|
className="text-xs"
|
||||||
/>
|
/>
|
||||||
<Button size="sm" onClick={() => updateShare({ password })}>
|
<Button size="sm" onClick={() => updateShare({ password })}>
|
||||||
|
|||||||
Reference in New Issue
Block a user