mirror of
https://github.com/beilunyang/moemail.git
synced 2025-12-24 11:30:51 +08:00
feat: Enhance email expiration options and update README
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
|
||||
- 🔒 **隐私保护**:保护您的真实邮箱地址,远离垃圾邮件和不必要的订阅
|
||||
- ⚡ **实时收件**:自动轮询,即时接收邮件通知
|
||||
- ⏱️ **灵活过期**:支持 1 小时、24 小时或 3 天的过期时间选择
|
||||
- ⏱️ **灵活有效期**:支持 1 小时、24 小时、3 天或永久有效
|
||||
- 🎨 **主题切换**:支持亮色和暗色模式
|
||||
- 📱 **响应式设计**:完美适配桌面和移动设备
|
||||
- 🔄 **自动清理**:自动清理过期的邮箱和邮件
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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