1export default async function (req: Request): Promise<Response> {
2 return Response.json({
3 type: 'Feature',
4import mime from "npm:mime@4.0.1";
5
6export function extractFiles(markdown: string): Record<string, string> {
7 const fileRegex = /^```(\w+)\s*(.*)\s*\n([\s\S]*?)```/gm;
8 const files: Record<string, string> = {};
18}
19
20export default async function(req: Request) {
21 const { pathname, search } = new URL(req.url);
22 const params = new URLSearchParams(search);
3 const allowedLogLevels = ["error", "debug", "info", "warn"];
4
5 function logMessage(level, message) {
6 // console.log("logMessage function called");
7 // Check if the specified log level is allowed
8 if (allowedLogLevels.includes(level)) {
16 }
17
18 return logMessage; // Return the logMessage function for usage
19})();
20
21// Export the logMessage function for use in other modules
22export { logMessage };
23
1import { logMessage } from "https://esm.town/v/willthereader/logMessage";
2
3// Immediately invoked function that exports a function generating a URL as a string,
4// which fetches all comments from an article associated with the provided post_id.
5export const constructReadTangleUrl = (() => {
17];
18
19function renderCell(header, row) {
20 let data = row[header];
21 if (header === "Name") {
31}
32
33export async function docs_table() {
34 const docs = await getDocs();
35 return (
6const styleEl = document.getElementById("style");
7
8DataTable.ext.search.push(function(settings, data, dataIndex) {
9 let min = parseInt(minEl.value, 10);
10 let max = parseInt(maxEl.value, 10);
11});
12
13async function getKnownThreads() {
14 const result = await db.select().from(threadsTbl);
15 return result.reduce((r, { id, last_message_id }) => {
19}
20
21async function getNewThreads() {
22 const resp = await fetch(`https://discord.com/api/guilds/${guild}/threads/active`, {
23 headers: {
34}
35
36export async function getThreadsActivity(
37 token: string,
38 guild: string,
4const desiredGenderEl = document.getElementById("desired-gender");
5
6DataTable.ext.search.push(function(settings, data, dataIndex) {
7 let min = parseInt(minEl.value, 10);
8 let max = parseInt(maxEl.value, 10);
28</html>`;
29
30export function redirect(location: string): Response {
31 return new Response(null, {
32 headers: {
37}
38
39function generateAccessToken(user) {
40 return jwt.sign(user, process.env.ACCESS_TOKEN_SECRET, { expiresIn: "1800s" });
41}
46};
47
48async function fetchUser(token: string): Promise<User> {
49 const resp = await fetch("https://api.val.town/v1/me", {
50 headers: {
60}
61
62function signout() {
63 const res = redirect("/");
64 cookie.setCookie(res.headers, {
73}
74
75export function auth(handler) {
76 const secretKey = Deno.env.get("AUTH_SECRET_KEY");
77 if (!secretKey) {
14import { auth } from "https://esm.town/v/pomdtr/auth_middleware";
15
16async function handler(req: Request): Promise<Response> {
17 return new Response("You are authenticated!");
18}
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.