1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { ValTownBlobError } from "https://esm.town/v/std/ValTownBlobError";
3import { ValTownBlobNotFoundError } from "https://esm.town/v/std/ValTownBlobNotFoundError";
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO
41
42const loadEmoji = (code) => {
43 // const api = `https://cdnjs.cloudflare.com/ajax/libs/twemoji/14.0.2/svg/${code.toLowerCase()}.svg`
44 const api = `https://cdn.jsdelivr.net/gh/shuding/fluentui-emoji-unicode/assets/${code.toLowerCase()}_color.svg`
45 return fetch(api).then((r) => r.text())
46}
4
5const DATABASE_ID = "519446a0d3ed47038fffd669b9ece770";
6const notion = new Client({ auth: process.env.NOTION_API_KEY });
7
8const intervalMapping = {
1/** @jsxImportSource npm:hono@3/jsx */
2import { frameHtml } from "https://esm.town/v/moe/frameHtml"
3import { getLaunches } from "https://esm.town/v/moe/spacexapi"
4import { homeImage, launchImage } from "https://esm.town/v/moe/spaceximage"
5import { Hono } from "npm:hono"
14 const params = new URL(req.url).searchParams;
15 try {
16 const feed = await getText("https://kagi.com/api/v1/smallweb/feed/");
17 const parser = new DOMParser();
18 const atom = parser.parseFromString(feed, "text/html");
5 try {
6 const soRes = await fetch(
7 `https://api.stackexchange.com/2.3/questions?fromdate=${startDate}&todate=${endDate}&order=desc&sort=creation&tagged=upload&site=stackoverflow`,
8 {
9 method: "GET",
24
25 const seRes = await fetch(
26 `https://api.stackexchange.com/2.3/questions?fromdate=${startDate}&todate=${endDate}&order=desc&sort=creation&tagged=s3&site=stackoverflow`,
27 {
28 method: "GET",
42 });
43
44 const fileApiRes = await fetch(
45 `https://api.stackexchange.com/2.3/questions?fromdate=${startDate}&todate=${endDate}&order=desc&sort=creation&tagged=fileapi&site=stackoverflow`,
46 )
47 const fileApiResData = await fileApiRes.json()
48 const fileApiArray = fileApiResData.items;
49 const newFileApiItems = fileApiArray
50 .filter(item => !item.is_answered)
51 .map(item => {
67 }).join("");
68
69 let formattedArray3 = newFileApiItems.map(obj => {
70 return `Post: <a href='${obj.link}'>${obj.title}</a></br>
71Creation Date: ${obj.date} </br> </br>`;
79${formattedArray2}
80
81<h2>Posts about File API</h2></br>
82${formattedArray3}
83`;
26 // return discordWebhook({
27 // url:
28 // "https://discord.com/api/webhooks/1265415063200862231/nNfLgaIb53nFsamMBCjR8telo9HrwE1dlIIkJ5vJdLYLNNFqE3FK8IqAlExMBkQz8S5_",
29 // content: "bobobo",
30 // });
8 long: number;
9}) {
10 // Get date and API key
11 const now = new Date();
12 const apiKey = process.env.WEATHER_BIT_API_KEY;
13 if (!apiKey) {
14 throw new Error("Must define WEATHER_BIT_API_KEY in secrets");
15 }
16 const res = await fetch(
17 `https://api.weatherbit.io/v2.0/current/airquality?lat=${lat}&lon=${long}&key=${apiKey}`,
18 );
19 const jsonObj = await res.json();
3Get the Air Quality Index (AQI) for a location via open data sources.
4
5It's "easy" because it strings together multiple lower-level APIs to give you a simple interface for AQI.
6
71. Accepts a location in basically any string format (ie "downtown manhattan")