4import { generateId, Scrypt } from "npm:lucia";
5
6export async function createTables(userTable: string, sessionTable: string) {
7 return sqlite.batch([
8 `CREATE TABLE ${userTable} (
20}
21
22async function safeExecute({ userTable, sessionTable, query, error }: {
23 userTable: string;
24 sessionTable: string;
38}
39
40export async function createUser({ userTable, sessionTable, username, password }: {
41 userTable: string;
42 sessionTable: string;
58}
59
60export async function getUser(
61 { userTable, sessionTable, username },
62): Promise<{ id: string; username: string; hashed_password: string } | null> {
74}
75
76export async function verifyPassword(hashed_password: string, password: string): Promise<boolean> {
77 return new Scrypt().verify(hashed_password, password);
78}
4let pg;
5
6async function init() {
7 if (pg) return;
8 console.log(1);
25}
26
27export default async function(req: Request): Promise<Response> {
28 console.log(0);
29 await init();
3console.log("potato", main);
4
5export default async function printWeather(req: Request) {
6 if (typeof main === "function") {
7 const newWeather = await main(req);
8
12 return new Response(JSON.stringify(data));
13 } else {
14 console.error("main is not a function");
15 return new Response("Error: main is not a function", { status: 500 });
16 }
17}
1const getText = async url => (await fetch(url)).text();
2
3export default async function(req: Request): Promise<Response> {
4 if (req.headers.get("referer")?.includes("val.")) {
5 return Response.json({ error: "Cannot access from val.town" }, {
9- **Multi-format Support**: Works with JSON, YAML, CSV, and TOML.
10- **Dynamic Selectors**: Use conditions to filter data dynamically.
11- **Function Support**: Built-in functions for data manipulation (e.g., length, sum, avg).
12- **Easy Integration**: Can be used in both Deno and Val Town environments.
13
17import Diesel from "https://esm.town/v/yawnxyz/diesel";
18
19async function main() {
20 const jsonData = `
21 {
8const KEY = new URL(import.meta.url).pathname;
9
10export default async function main(req: Request): Promise<Response> {
11 const url = new URL(req.url);
12
4const tabs = { "/": "Home", "/about": "About" }; // { "/": "Home", "/browse": "Browse", "/faq": "FAQ" };
5
6export default function({ activeTab, children }: PropsWithChildren<{ activeTab: string }>) {
7 return (
8 <html>
1/**
2 * Function to extract the val HTTP endpoint URL.
3 * @example getEndpointUrl(import.meta.url)
4 * @returns endpoint url without a trailing slash
5 */
6export function getEndpointUrl(url: string | URL) {
7 const { pathname } = new URL(url);
8 const [author, filename] = pathname.split('/').slice(-2);
1import { ImageMagick, initializeImageMagick, MagickGeometry } from "https://deno.land/x/imagemagick_deno@0.0.14/mod.ts";
2
3export async function modifyImage(
4 file: File,
5 params: { width: number; height: number },
2// It uses CSS for styling and animations and JavaScript for the countdown logic.
3
4export default async function main(req: Request): Promise<Response> {
5 const html = `
6 <!DOCTYPE html>
52 </div>
53 <script>
54 function updateCountdown() {
55 const eventDate = new Date('2025-04-14T00:00:00');
56 const now = new Date();