mirror of
https://github.com/beilunyang/moemail.git
synced 2026-08-28 19:36:38 +08:00
feat: Enhance email expiration options and update README
This commit is contained in:
@@ -58,7 +58,9 @@ export async function POST(request: Request) {
|
||||
}
|
||||
|
||||
const now = new Date()
|
||||
const expires = new Date(now.getTime() + expiryTime)
|
||||
const expires = expiryTime === 0
|
||||
? new Date('9999-01-01T00:00:00.000Z')
|
||||
: new Date(now.getTime() + expiryTime)
|
||||
|
||||
const emailData: typeof emails.$inferInsert = {
|
||||
address,
|
||||
|
||||
@@ -140,7 +140,11 @@ export function EmailList({ onEmailSelect, selectedEmailId }: EmailListProps) {
|
||||
<div className="truncate flex-1">
|
||||
<div className="font-medium truncate">{email.address}</div>
|
||||
<div className="text-xs text-gray-500">
|
||||
过期时间: {new Date(email.expiresAt).toLocaleString()}
|
||||
{new Date(email.expiresAt).getFullYear() === 9999 ? (
|
||||
"永久有效"
|
||||
) : (
|
||||
`过期时间: ${new Date(email.expiresAt).toLocaleString()}`
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+3
-2
@@ -1,10 +1,11 @@
|
||||
export interface ExpiryOption {
|
||||
label: string
|
||||
value: number // 过期时间(毫秒)
|
||||
value: number
|
||||
}
|
||||
|
||||
export const EXPIRY_OPTIONS: ExpiryOption[] = [
|
||||
{ label: '1小时', value: 1000 * 60 * 60 },
|
||||
{ label: '24小时', value: 1000 * 60 * 60 * 24 },
|
||||
{ label: '3天', value: 1000 * 60 * 60 * 24 * 3 }
|
||||
{ label: '3天', value: 1000 * 60 * 60 * 24 * 3 },
|
||||
{ label: '永久', value: 0 }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user