refactor: migrate to Tailwind CSS v4 and TypeScript

Replaces PostCSS-based styling with Tailwind CSS v4 via Vite plugin
Converts all .js files to .ts with proper type annotations
Adds comprehensive type definitions for Telegram data structures
Extracts reusable UI components and standardizes class utilities

Improves maintainability by eliminating custom CSS in favor of
Tailwind utilities and design tokens
Enhances type safety across Telegram parsing, env access, and API routes
Centralizes agent guidelines in AGENTS.md following repository standards
Upgrades iconography to astro-icon with Remix Icon integration

Expands accessible HTML patterns including ARIA labels, semantic
navigation, and keyboard interaction support
Refactors static proxy logic into shared utility functions
Consolidates modal and image preview markup for consistency
This commit is contained in:
面条
2026-03-26 21:11:11 +08:00
parent 5d1001011e
commit 6ec262d8cf
55 changed files with 5063 additions and 5527 deletions

View File

@@ -1,26 +0,0 @@
import { GET } from '../../src/pages/static/[...url]'
export const config = {
runtime: 'edge',
}
export default function handler(request) {
const url = request.url?.split('/static/')?.[1]
if (!url) {
return new Response('Not Found', { status: 404 })
}
const target = new URL(url)
target.searchParams.delete('path')
return GET({
request,
params: {
url: target.origin + target.pathname,
},
url: {
search: target.search,
},
})
}

25
api/static/index.ts Normal file
View File

@@ -0,0 +1,25 @@
import { createStaticProxyResponse } from '../../src/lib/static-proxy'
export const config = {
runtime: 'edge',
}
export default async function handler(request: Request): Promise<Response> {
try {
const urlStr = request.url?.split('/static/')?.[1]
if (!urlStr) {
return new Response('Not Found', { status: 404 })
}
const parsed = new URL(urlStr)
parsed.searchParams.delete('path')
const rawTarget = parsed.origin + parsed.pathname + parsed.search
return await createStaticProxyResponse(request, rawTarget)
}
catch (error) {
const message = error instanceof Error ? error.message : String(error)
return new Response(message, { status: 500 })
}
}