3export async function translate(req: Request) {
4 if (req.method === "POST") {
5 const { code: status, data } = await fetch("https://deepl.deno.dev/translate", {
6 method: "POST",
7 body: req.body,
35 <script type="module">
36 import { html, Component, render } from "https://cdn.cbd.int/htm/preact/standalone.module.js";
37 import { ofetch } from "https://esm.sh/ofetch/dist/index.mjs";
38 import { z } from "https://esm.sh/zod";
39 // https://github.com/developit/htm
132 target_lang: z.string().default("zh"),
133 });
134 const data = await ofetch("/", {
135 method: "POST",
136 body: Options.parse({
24}
25
26async function fetchAndProcessData() {
27 const response = await fetch(
28 'https://api.npmjs.org/versions/xstate/last-week',
29 )
145
146 if (await isTableEmpty()) {
147 await fetchAndProcessData()
148 }
149
157export default async function cron(interval: Interval,): Promise<void> {
158 await ensureTableExists()
159 await fetchAndProcessData()
160}
161
1import ValTown from "https://esm.sh/@valtown/sdk@0.22.0";
2import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo?v=2";
3
4export async function selfDestruct(importMetaUrl: string) {
5 const { id } = await fetchValInfo(importMetaUrl);
6 const { vals } = new ValTown();
7
18const getSpaces = async () => {
19 const options = requestOptions({ method: "GET" });
20 const response = await fetch(`${apiHost}/user/spaces`, options);
21 const data = await response.json();
22 const spaceNames = data.map(space => space.name);
10 useEffect(() => {
11 const checkAuth = async () => {
12 const response = await fetch('/auth/check');
13 const data = await response.json();
14 setEmail(data.email);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const telegramGetMe = async (botToken: string) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/getMe`,
6 );
76 .toString("base64");
77
78 const response = await fetch(`https://api.switch-bot.com/${path}`, {
79 headers: {
80 "Authorization": token,
244});
245
246export default app.fetch;
1import ValTown from "https://esm.sh/@valtown/sdk@0.22.0";
2import { fetchValInfo } from "https://esm.town/v/pomdtr/fetchValInfo?v=2";
3
4export async function selfDestruct(importMetaUrl: string) {
5 const { id } = await fetchValInfo(importMetaUrl);
6 const { vals } = new ValTown();
7
2import ValTown from "npm:@valtown/sdk";
3
4export function fetchValInfo(importMetaURL: string) {
5 const vt = new ValTown();
6 const { author, name } = extractValInfo(importMetaURL);