mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 18:07:13 +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(),
|
||||
isDisabled: l.isDisabled,
|
||||
hasPassword: !!l.password,
|
||||
password: l.password,
|
||||
defaultSortOrder: l.defaultSortOrder,
|
||||
viewMode: l.viewMode,
|
||||
fieldVisibility: l.fieldVisibility as Record<string, boolean> | undefined,
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface ShareLinkInfo {
|
||||
expireAt?: string
|
||||
isDisabled: boolean
|
||||
hasPassword: boolean
|
||||
password?: string | null
|
||||
defaultSortOrder?: string
|
||||
viewMode?: string
|
||||
fieldVisibility?: Record<string, boolean>
|
||||
|
||||
@@ -45,10 +45,14 @@ export function ShareSettingsSidebar({
|
||||
onSortOrderChange,
|
||||
}: ShareSettingsSidebarProps) {
|
||||
const queryClient = useQueryClient()
|
||||
const [password, setPassword] = useState('')
|
||||
const [password, setPassword] = useState(shareLink.password || '')
|
||||
const [expireAt, setExpireAt] = useState<Date | undefined>(
|
||||
shareLink.expireAt ? new Date(shareLink.expireAt) : undefined,
|
||||
)
|
||||
|
||||
React.useEffect(() => {
|
||||
setPassword(shareLink.password || '')
|
||||
}, [shareLink.password])
|
||||
const [isPasswordEnabled, setIsPasswordEnabled] = useState(shareLink.hasPassword)
|
||||
const [isExpireEnabled, setIsExpireEnabled] = useState(!!shareLink.expireAt)
|
||||
|
||||
@@ -146,10 +150,10 @@ export function ShareSettingsSidebar({
|
||||
{isPasswordEnabled && (
|
||||
<div className="flex gap-2 animate-in fade-in slide-in-from-top-1 duration-200">
|
||||
<Input
|
||||
type="password"
|
||||
type="text"
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
placeholder={shareLink.hasPassword ? '••••••••' : 'Set password'}
|
||||
placeholder="Enter password"
|
||||
className="text-xs"
|
||||
/>
|
||||
<Button size="sm" onClick={() => updateShare({ password })}>
|
||||
|
||||
Reference in New Issue
Block a user