async function handleRequest() { const { SMALLWEB_DOMAIN, SMALLWEB_DIR } = Deno.env.toObject() const entries = await Array.fromAsync(Deno.readDir(SMALLWEB_DIR)) const html = /* html */` ${entries.filter(entry => !entry.name.startsWith(".")).map(entry => ` `).join('')}
Name URL
${entry.name} https://${entry.name}.${SMALLWEB_DOMAIN}
` return new Response(html, { headers: { "content-type": "text/html" } }) } async function handleCommand() { const { SMALLWEB_DIR } = Deno.env.toObject() const entries = await Array.fromAsync(Deno.readDir(SMALLWEB_DIR)) console.log(entries.filter(entry => !entry.name.startsWith(".")).map(entry => entry.name).join("\n")) } export default { fetch: handleRequest, run: handleCommand, }