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>
30};
31
32function TitleBar(props) {
33 return (
34 <div
46}
47
48function TitleBarText(props) {
49 return (
50 <div
62}
63
64function TitleBarControls(props) {
65 return <div style={{ display: "flex" }}>{props.children}</div>;
66}
67
68function Button(props) {
69 return (
70 <div
90}
91
92function TitleBarControl(props) {
93 return (
94 <Button
118}
119
120function MinimizeButton(props) {
121 return (
122 <TitleBarControl
135}
136
137function MaximizeButton(props) {
138 return (
139 <TitleBarControl
150}
151
152function CloseButton(props) {
153 return (
154 <TitleBarControl
166}
167
168function Window(props) {
169 return (
170 <div
186}
187
188function WindowBody(props) {
189 return (
190 <div
202}
203
204function Text(props) {
205 return (
206 <div
219}
220
221function Row(props) {
222 return (
223 <div
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 },