1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2export function SparklineSVG({ strokeWidth = 2, data = [], fill = "none", stroke = "black" }) {
3 const padding = 2;
4 const xMargin = 25;
7);
8
9export async function uptimeCheck(url: string) {
10 let reason: string, status: number, end: number;
11 let ok = true;
1/** @jsxImportSource npm:react */
2import { renderToString } from "npm:react-dom/server";
3export default async function(req: Request): Promise<Response> {
4 return new Response(
5 renderToString(
1export default async function(req: Request): Promise<Response> {
2 return new Response(
3 `
7type Handler = (r: Request) => Promise<Response> | Response;
8
9export async function logMeInMiddleware(
10 importMetaUrl: string,
11 handle: Handler,
34}
35
36function htmlTemplateResponse(body: JSX.Element, options?: Partial<ResponseInit>): Response {
37 const headers = { "content-type": "text/html charset=utf-8" };
38 return new Response(
1import { logMeInMiddleware, LOGOUT_URL, RESET_URL } from "https://esm.town/v/maxm/logmein/mw";
2
3async function handler(req: Request): Promise<Response> {
4 return new Response(
5 `
1import { Cookie, deleteCookie, getCookies, setCookie } from "https://deno.land/std/http/cookie.ts";
2export const SESSION_COOKIE_NAME = "logmein_session";
3function setSessionCookie(key: string): Cookie {
4 return {
5 name: SESSION_COOKIE_NAME,
12}
13
14export function getSessionKey(headers: Headers): string | undefined {
15 return getCookies(headers)[SESSION_COOKIE_NAME];
16}
17
18export function setSession(key: string, headers: Headers) {
19 const cookie = setSessionCookie(key);
20 setCookie(headers, cookie);
4const thisURL = parseProject(import.meta.url).links.self.latest;
5
6export async function notify(message: string) {
7 await email({ subject: message, text: `Email sent from ${thisURL}` });
8}
14
15// adapted from https://www.val.town/v/pomdtr/extractValInfo
16export function parseVal(url: string | URL): Val {
17 const { pathname, search } = new URL(url);
18 const [username, filename] = pathname.split("/").slice(-2);
12const valtown = new ValTown();
13
14export default async function GitHubPush(c: Context) {
15 // auth check in /index
16 const user = await valtown.me.profile.retrieve();