1export async function getCurrentWeather(latitude = 0, longitude = 0) {
2 const pointsResponse = await fetch(`https://api.weather.gov/points/${latitude},${longitude}`),
3 { properties: { forecastHourly } } = await pointsResponse.json(),
4 forecastResponse = await fetch(forecastHourly),
5 { properties: { periods } } = await forecastResponse.json();
6
3Reacquaint myself with how modern browsers deal with cross-origin cookies. Specifically, how aggressive does Safari limit them nowadays? (Answer: very aggressive, to the point of just disabling them.)
4
5This endpoint simply tries to assign a 28-day-from-now-expiring device cookie when requested, providing all of the obligatory-in-2024 cookie flags and headers to allow cross-origin support. You can request it from another origin in different browsers and inspect if cookies are sent back or not (either via `sendBeacon` or `fetch(..., {credentials: "include"})` or in the iframe browser preview below).
6
7Chrome and Firefox subsequently send back a persistent cookie; Safari does not. Edge probably does what Chrome does. I dunno what Braze does.
55});
56
57export default app.fetch;
67 fillBlank: FILL_BLANK,
68 quiz: QUIZ,
69 fetchHtml: (email: string, lesson: number) =>
70 generateLessonHtml({
71 email,
7});
8
9export default app.fetch;
32 });
33
34 return app.fetch(req);
35};
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export const createVal = async ({ code, token, name, privacy }: {
7 privacy?: "public" | "unlisted" | "private";
8}) => {
9 return fetchJSON("https://api.val.town/v1/vals", {
10 method: "post",
11 bearer: token,
1import { paginateAPI } from "https://esm.town/v/andreterron/paginateAPI";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
4
5let max: { lines: number; name: string } | undefined;
10 },
11};
12const me = await fetchJSON(
13 `${API_URL}/v1/me`,
14 opts,
1import { fetch } from "https://esm.town/v/std/fetch?v=4";
2import OpenAI, { type ClientOptions } from "npm:openai";
3
25async function getVal(username: string, valName: string) {
26 try {
27 const res = await fetch(`https://api.val.town/v1/alias/${username}/${valName}`, {
28 method: "GET",
29 headers: {
67async function updateReadme(id: string, readme: string) {
68 try {
69 const res = await fetch(`https://api.val.town/v1/vals/${id}`, {
70 method: "PUT",
71 headers: {
1import { type WriterOptions } from "https://esm.town/v/nbbaier/WriterOptions";
2import { fetch } from "https://esm.town/v/std/fetch?v=4";
3import OpenAI, { type ClientOptions } from "npm:openai";
4
32 private async getVal(username: string, valName: string) {
33 try {
34 const res = await fetch(`https://api.val.town/v1/alias/${username}/${valName}`, {
35 method: "GET",
36 headers: {
72 private async updateReadme(id: string, readme: string) {
73 try {
74 const res = await fetch(`https://api.val.town/v1/vals/${id}`, {
75 method: "PUT",
76 headers: {