1export default async function(req: Request) {
2const html = `<!DOCTYPE html>
3<html lang="en">
161162<script>
163function updateClock() {
164const now = new Date();
165const hours = now.getHours() % 12;
187188// Add minute markers
189function createMinuteMarkers() {
190const clockFace = document.querySelector('.clock-face');
191for (let i = 0; i < 60; i++) {
1(function(g) {
2const PORT = 8000;
34function WebSocketHandler(opt) {
5this.opt = opt || {};
6this.isBrowser = typeof window !== "undefined";
13}
1415WebSocketHandler.prototype._notifyStatus = function() {
16this.opt.onStatusChange && this.opt.onStatusChange({
17connected: this.connected,
20};
2122WebSocketHandler.prototype.connect = function() {
23if (!this.isBrowser) return;
2431};
3233WebSocketHandler.prototype._connectRealWS = function() {
34const self = this;
35this.ws = new WebSocket(`ws://localhost:${this.PORT}`);
70};
7172WebSocketHandler.prototype._startFallback = function() {
73if (!this.simulated) {
74this.simulated = true;
79};
8081WebSocketHandler.prototype._scheduleReconnect = function() {
82const self = this;
83if (this.reconnectTimer) return;
90};
9192WebSocketHandler.prototype.send = function(msg) {
93if (this.connected && !this.simulated && this.ws && this.ws.readyState === WebSocket.OPEN) {
94this.ws.send(msg);
103104// Server-side code (for Deno)
105if (typeof Deno !== "undefined" && typeof Deno.serve === "function") {
106Deno.serve({ port: PORT }, (req) => {
107if (req.headers.get("upgrade") !== "websocket") {
10}
1112export default function TodoChat({ todo, user, onUpdateTodo, onClose }: TodoChatProps) {
13const [message, setMessage] = useState("");
14const [loading, setLoading] = useState(false);
todo-app-conversionindex.ts16 matches
31app.get("/shared/*", c => serveFile(c.req.path, import.meta.url));
3233// Helper function to hash password (simple hash for demo)
34async function hashPassword(password: string): Promise<string> {
35const encoder = new TextEncoder();
36const data = encoder.encode(password + "conversion_salt");
40}
4142// Helper function to get user's todos key
43function getUserTodosKey(email: string): string {
44return `todos:${email}`;
45}
4647// Helper function to get user's auth key
48function getUserAuthKey(email: string): string {
49return `auth:${email}`;
50}
5152// Helper function to get user's todos
53async function getUserTodos(email: string): Promise<Todo[]> {
54const key = getUserTodosKey(email);
55const todos = await blob.getJSON(key);
57}
5859// Helper function to save user's todos
60async function saveUserTodos(email: string, todos: Todo[]): Promise<void> {
61const key = getUserTodosKey(email);
62await blob.setJSON(key, todos);
63}
6465// Helper function to get user from email/password auth
66async function getEmailUser(email: string): Promise<User | null> {
67const key = getUserAuthKey(email);
68const userData = await blob.getJSON(key);
70}
7172// Helper function to verify password
73async function verifyPassword(email: string, password: string): Promise<boolean> {
74const key = getUserAuthKey(email);
75const userData = await blob.getJSON(key);
79}
8081// Helper function to get current user
82async function getCurrentUser(c: any): Promise<User | null> {
83// Check LastLogin first
84const lastLoginEmail = c.req.header("X-LastLogin-Email");
todo-app-conversionApp.tsx1 match
18}
1920export default function App() {
21const [user, setUser] = useState<User | null>(null);
22const [todos, setTodos] = useState<Todo[]>([]);
9}
1011export default function TodoApp({ user, initialTodos }: TodoAppProps) {
12const [todos, setTodos] = useState<Todo[]>(initialTodos);
13const [newTodoTitle, setNewTodoTitle] = useState("");
2import React from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
34export default function LandingPage() {
5return (
6<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100">
8}
910export default function LoginPage({ onLogin }: LoginPageProps) {
11const [isSignup, setIsSignup] = useState(false);
12const [email, setEmail] = useState("");
todo-appTodoList.tsx1 match
10}
1112export default function TodoList({ todos, onUpdate, onDelete, loading }: TodoListProps) {
13const [filter, setFilter] = useState<'all' | 'active' | 'completed'>('all');
14const [categoryFilter, setCategoryFilter] = useState<Todo['category'] | 'all'>('all');
eink-frameREADME.md1 match
5#### Python code for display available at https://github.com/michaelwschultz/eink-frame
67## Functioning Hardware
89| News | NASA Photo of the Day |