FeedPondreceiveCreation.js1 match
7const SHARED_SECRET = Deno.env.get("PONDIVERSE_PUSH_SECRET");
89export async function handleReceiveCreation(req: Request): Promise<Response> {
10// 1. Check Method
11if (req.method !== "POST") {
5export const UPSTREAM_PONDIVERSE_URL = "https://pondiverse.com"; // URL for linking, not fetching
67export async function initializeAggregatorDB() {
8// Store original ID to prevent duplicates, store necessary RSS fields
9await sqlite.execute(`
FeedPondgenerateRSS.js2 matches
34// Helper to escape XML characters - IMPORTANT!
5function escapeXml(unsafe) {
6if (typeof unsafe !== 'string') return '';
7return unsafe.replace(/[<>&'"\\]/g, (c) => { // Added backslash escape
18}
1920export async function generateRSSFeed() {
21const feedUrl = `https://${Deno.env.get("USER")}-${Deno.env.get("NAME")}.web.val.run/feed.xml`; // Auto-detects your val URL
22const siteUrl = "https://pondiverse.com/explore/"; // Link to the main explore page
untitled-6323new-file-8750.tsx11 matches
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
45function Slideshow({ images }) {
6useEffect(() => {
7let currentSlideIndex = 0;
11const transitionDuration = 800; // 0.8 seconds (must match CSS)
1213function showNextSlide() {
14if (totalSlides <= 1) return;
1564}
6566function Card({ title, subtitle, amount, steps, footerSlides, buttonText, modalTitle, modalContent }) {
67const [isModalActive, setIsModalActive] = useState(false);
6873let footerSlideInterval = null;
7475function showNextFooterSlide() {
76footerSlideContainers.forEach((container) => {
77const slides = container.querySelectorAll(".footer-slide");
171}
172173function Modal({ isActive, onClose, title, content }) {
174return (
175<div className={`modal-overlay ${isActive ? "active" : ""}`} onClick={onClose}>
186}
187188function InviteCard() {
189return (
190<div className="card invite-card">
208}
209210function BottomNavigation() {
211return (
212<nav className="bottom-nav">
226}
227228function LoadingOverlay() {
229const [message, setMessage] = useState("");
230const [showTryLater, setShowTryLater] = useState(true);
275}
276277function App() {
278const [showOverlay, setShowOverlay] = useState(false);
279364}
365366function client() {
367createRoot(document.getElementById("root")).render(<App />);
368}
372}
373374export default async function server(request: Request): Promise<Response> {
375return new Response(
376`
stevensDemotestDailyBrief.ts1 match
4import { DateTime } from "https://esm.sh/luxon@3.4.4";
56export async function testDailyBrief() {
7try {
8const testChatId = Deno.env.get("TEST_TELEGRAM_CHAT_ID");
2// Run this script manually to create the database table
34export default async function setupTelegramChatDb() {
5try {
6// Import SQLite module
stevensDemosendDailyBrief.ts6 matches
13} from "../memoryUtils.ts";
1415async function generateBriefingContent(anthropic, memories, today, isSunday) {
16try {
17const weekdaysHelp = generateWeekDays(today);
96}
9798export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
99// Get API keys from environment
100const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
135const lastSunday = today.startOf("week").minus({ days: 1 });
136137// Fetch relevant memories using the utility function
138const memories = await getRelevantMemories();
139216}
217218function generateWeekDays(today) {
219let output = [];
220239// console.log(weekDays);
240241// Export a function that calls sendDailyBriefing with no parameters
242// This maintains backward compatibility with existing cron jobs
243export default async function (overrideToday?: DateTime) {
244return await sendDailyBriefing(undefined, overrideToday);
245}
stevensDemoREADME.md2 matches
16In a normal server environment, you would likely use a middleware [like this one](https://hono.dev/docs/getting-started/nodejs#serve-static-files) to serve static files. Some frameworks or deployment platforms automatically make any content inside a `public/` folder public.
1718However in Val Town you need to handle this yourself, and it can be suprisingly difficult to read and serve files in a Val Town Project. This template uses helper functions from [stevekrouse/utils/serve-public](https://www.val.town/x/stevekrouse/utils/branch/main/code/serve-public/README.md), which handle reading project files in a way that will work across branches and forks, automatically transpiles typescript to javascript, and assigns content-types based on the file's extension.
1920### `index.html`
26## CRUD API Routes
2728This app has two CRUD API routes: for reading and inserting into the messages table. They both speak JSON, which is standard. They import their functions from `/backend/database/queries.ts`. These routes are called from the React app to refresh and update data.
2930## Errors
stevensDemoREADME.md2 matches
45* `migrations.ts` - code to set up the database tables the app needs
6* `queries.ts` - functions to run queries against those tables, which are imported and used in the main Hono server in `/backend/index.ts`
78## Migrations
18The queries file is where running the migrations happen in this app. It'd also be reasonable for that to happen in index.ts, or as is said above, for that line to be commented out, and only run when actual changes are made to your database schema.
1920The queries file exports functions to get and write data. It relies on shared types and data imported from the `/shared` directory.
stevensDemoqueries.ts4 matches
6const tableName = "memories_demo";
78export async function getAllMemories(): Promise<Memory[]> {
9const result = await sqlite.execute(
10`SELECT id, date, text, createdBy, createdDate, tags FROM ${tableName}
23}
2425export async function createMemory(
26memory: Omit<Memory, "id">
27): Promise<Memory> {
51}
5253export async function updateMemory(
54id: string,
55memory: Partial<Omit<Memory, "id">>
70}
7172export async function deleteMemory(id: string): Promise<void> {
73await sqlite.execute(`DELETE FROM ${tableName} WHERE id = ?`, [id]);
74}