feat(share): expose raw password on settings page

This commit is contained in:
yiling
2026-06-22 20:32:46 +08:00
parent 48b2047a84
commit df6e392bf6
3 changed files with 9 additions and 3 deletions
+1
View File
@@ -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,
+1
View File
@@ -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 })}>