mirror of
https://github.com/juherr/kill-the-news.git
synced 2026-06-20 22:03:48 +00:00
Set up initial project and files
This commit is contained in:
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
import { Env } from './index';
|
||||
|
||||
// Extend Hono's types to include our custom environment
|
||||
declare module 'hono' {
|
||||
interface ContextVariableMap {
|
||||
env: Env;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// Global environment interface for Cloudflare Workers
|
||||
export interface Env {
|
||||
EMAIL_STORAGE: KVNamespace;
|
||||
ADMIN_PASSWORD: string;
|
||||
DOMAIN: string;
|
||||
}
|
||||
|
||||
// Email interface for stored emails
|
||||
export interface EmailData {
|
||||
subject: string;
|
||||
from: string;
|
||||
content: string;
|
||||
receivedAt: number;
|
||||
headers: Record<string, string>;
|
||||
}
|
||||
|
||||
// Feed configuration interface
|
||||
export interface FeedConfig {
|
||||
title: string;
|
||||
description?: string;
|
||||
language: string;
|
||||
site_url: string;
|
||||
feed_url: string;
|
||||
author?: string;
|
||||
created_at: number;
|
||||
updated_at?: number;
|
||||
}
|
||||
|
||||
// Feed metadata interface
|
||||
export interface FeedMetadata {
|
||||
emails: EmailMetadata[];
|
||||
}
|
||||
|
||||
// Email metadata interface (summary info for listing)
|
||||
export interface EmailMetadata {
|
||||
key: string;
|
||||
subject: string;
|
||||
receivedAt: number;
|
||||
}
|
||||
|
||||
// Feed list interface
|
||||
export interface FeedList {
|
||||
feeds: FeedListItem[];
|
||||
}
|
||||
|
||||
// Feed summary interface (for the global feed list)
|
||||
export interface FeedListItem {
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
// Declare KVNamespace for TypeScript
|
||||
declare global {
|
||||
// This is not an ideal solution but works for our example
|
||||
interface KVNamespace {
|
||||
get(key: string, options?: { type: 'text' }): Promise<string | null>;
|
||||
get(key: string, options: { type: 'json' }): Promise<any | null>;
|
||||
get(key: string, options: { type: 'arrayBuffer' }): Promise<ArrayBuffer | null>;
|
||||
get(key: string, options: { type: 'stream' }): Promise<ReadableStream | null>;
|
||||
put(key: string, value: string | ArrayBuffer | ReadableStream | FormData): Promise<void>;
|
||||
delete(key: string): Promise<void>;
|
||||
list(options?: { prefix?: string; limit?: number; cursor?: string }): Promise<{
|
||||
keys: { name: string; expiration?: number }[];
|
||||
list_complete: boolean;
|
||||
cursor?: string;
|
||||
}>;
|
||||
}
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Extend mailparser types for Buffer in worker environment
|
||||
declare module 'buffer-polyfill' {
|
||||
global {
|
||||
var Buffer: {
|
||||
from(data: string, encoding?: string): {
|
||||
toString(encoding?: string): string;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Add missing atob declaration
|
||||
declare module 'atob-polyfill' {
|
||||
global {
|
||||
function atob(data: string): string;
|
||||
}
|
||||
}
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
declare module 'rss' {
|
||||
interface RSSOptions {
|
||||
title: string;
|
||||
description: string;
|
||||
feed_url: string;
|
||||
site_url: string;
|
||||
language?: string;
|
||||
image_url?: string;
|
||||
docs?: string;
|
||||
managingEditor?: string;
|
||||
webMaster?: string;
|
||||
copyright?: string;
|
||||
pubDate?: Date;
|
||||
ttl?: number;
|
||||
generator?: string;
|
||||
categories?: string[];
|
||||
custom_namespaces?: Record<string, string>;
|
||||
custom_elements?: any[];
|
||||
}
|
||||
|
||||
interface RSSItemOptions {
|
||||
title: string;
|
||||
description: string;
|
||||
url: string;
|
||||
guid?: string;
|
||||
categories?: string[];
|
||||
author?: string;
|
||||
date?: Date;
|
||||
lat?: number;
|
||||
long?: number;
|
||||
enclosure?: {
|
||||
url: string;
|
||||
file?: string;
|
||||
size?: number;
|
||||
type?: string;
|
||||
};
|
||||
custom_elements?: any[];
|
||||
}
|
||||
|
||||
interface RSSXMLOptions {
|
||||
indent?: boolean;
|
||||
}
|
||||
|
||||
class RSS {
|
||||
constructor(options: RSSOptions);
|
||||
item(options: RSSItemOptions): void;
|
||||
xml(options?: RSSXMLOptions): string;
|
||||
}
|
||||
|
||||
export = RSS;
|
||||
}
|
||||
Reference in New Issue
Block a user