Enhance admin interface, security, and feed management with improved UX and authentication

This commit is contained in:
Young Lee
2025-02-27 18:04:01 -08:00
parent 8839aac24b
commit 56a8263f33
19 changed files with 2022 additions and 523 deletions
+3 -2
View File
@@ -6,11 +6,12 @@ import { EmailData } from '../types';
export class EmailParser {
/**
* Extract the feed ID from an email address
* @param emailAddress The email address (e.g., newsletter-xyz@domain.com)
* @param emailAddress The email address (e.g., apple.mountain.42@domain.com)
* @returns The feed ID or null if not found
*/
static extractFeedId(emailAddress: string): string | null {
const match = emailAddress.match(/^newsletter-([a-zA-Z0-9]+)@/);
// Match pattern for noun1.noun2.XY before the @ symbol
const match = emailAddress.match(/^([a-z]+\.[a-z]+\.\d{2})@/i);
return match ? match[1] : null;
}
+17
View File
@@ -0,0 +1,17 @@
import { nouns } from '../data/nouns';
/**
* Generates a random feed ID in the format noun1.noun2.XY
* @returns A random feed ID string
*/
export function generateFeedId(): string {
// Select two random nouns
const noun1 = nouns[Math.floor(Math.random() * nouns.length)];
const noun2 = nouns[Math.floor(Math.random() * nouns.length)];
// Generate a random 2-digit number between 10 and 99
const number = Math.floor(Math.random() * 90) + 10;
// Combine to create the ID with dots as separators
return `${noun1}.${noun2}.${number}`;
}