tuna9 file matches
Simple functional CSS library for Val Town
getFileEmail4 file matches
A helper function to build a file's email
AutomationFunction1 file match
trmnl_plugins2 file matches
Backend functions for TRMNL plugins
You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=function&page=1&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=function
Returns an array of strings in format "username" or "username/projectName"
Found 31473 results for "function"(2369ms)
2627// Initialize the cache table
28export async function initializeCache(): Promise<void> {
29try {
30console.log("Initializing cache table...");
5051// Normalize plant name for consistent caching
52function normalizePlantName(name: string): string {
53return name.toLowerCase()
54.trim()
5960// Get cached plant information
61export async function getCachedPlant(plantName: string): Promise<PlantInfo | null> {
62const normalizedName = normalizePlantName(plantName);
63console.log(`getCachedPlant: original="${plantName}", normalized="${normalizedName}"`);
9091// Cache plant information
92export async function cachePlant(plantName: string, plantInfo: PlantInfo): Promise<void> {
93const normalizedName = normalizePlantName(plantName);
94const now = new Date().toISOString();
119120// Get cache statistics
121export async function getCacheStats(): Promise<{
122totalEntries: number;
123oldestEntry: string | null;
154155// List all cached plants (for debugging/admin purposes)
156export async function listCachedPlants(): Promise<
157Array<{
158plantName: string;
178179// Clear cache (for maintenance)
180export async function clearCache(): Promise<void> {
181try {
182await sqlite.execute(`DELETE FROM ${TABLE_NAME}`);
3132// Generate a simple session token
33function generateSessionToken(): string {
34return crypto.randomUUID();
35}
3637// Authentication middleware
38async function requireAuth(c: any, next: any) {
39const sessionToken = await getSignedCookie(c, SESSION_SECRET, "admin_session");
404950// Check if user is authenticated (for API endpoints)
51function isAuthenticated(c: any): boolean {
52const sessionToken = getSignedCookie(c, SESSION_SECRET, "admin_session");
53console.log(`Session token: ${sessionToken}`);
279console.log("Testing database connection...");
280281// Test basic SQLite functionality
282const testResult = await sqlite.execute("SELECT 1 as test");
283console.log("Basic SQLite test result:", testResult);