8const USERNAME = extractValInfo(import.meta.url).author;
910export async function createInjectMyFooterStream(logo = valTownLogoAuto) {
11const footer = await MyFooter(logo);
12return new InjectHTMLElementStream(footer.toString());
13}
1415export async function MyFooter(logo = valTownLogoAuto) {
16const recommendation = rootValRef().handle === USERNAME
17? html`<span class="recommends">${await recommends()}</span>`
41}
4243export default async function(req) {
44const { Layout } = await import("https://esm.town/v/postpostscript/Layout");
45return htmlResponse`${Layout`
magentaDogmain.tsx2 matches
1let currentNumber = 0; // Assuming starting point, but this could be loaded/stored elsewhere.
23// This function increments the number and returns the new value.
4function incrementNumber() {
5currentNumber += 1;
6// Here, you would ideally persist the current number to a database or file for long-term storage.
2import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
34export default function(req: Request) {
5const { author, name } = extractValInfo(import.meta.url);
6const blogEndpoint = getValEndpointFromName(`@${author}/blog`);
4import { getValEndpointFromName } from "https://esm.town/v/postpostscript/meta";
56export default function(req: Request) {
7const { author, name } = extractValInfo(import.meta.url);
8const blogEndpoint = getValEndpointFromName(`@${author}/blog`);
twitterAlertmain.tsx1 match
4const query = "\"val.town\" OR \"val town\" -_ValTown_";
56export async function twitterAlert({ lastRunAt }: Interval) {
7const results = await twitterSearch({
8query,
54export default app.fetch;
5556async function createPage(c: Context<HonoEnvOptional>) {
57const auth = c.get("auth");
58
1import { email as sendEmail } from "https://esm.town/v/std/email?v=11";
23export default async function(email: Email) {
4await sendEmail({
5subject: email.subject,
authMiddlewaremain.tsx12 matches
25};
2627async function normalizeOption<T>(value: MaybeMethod<T>, req: Request, payload: JWTPayload): Promise<T> {
28return value instanceof Function
29? await value(req, payload)
30: value;
31}
3233export function getRequestContextRequest(context: ImplementsRequestContext) {
34return "raw" in context.req
35? context.req.raw
47}
4849export function authWrapperCookie(
50handler: (req: Request, context: ImplementsRequestContext) => MaybePromise<Response>,
51options: AuthMiddlewareOptions<ImplementsRequestContext> & {
79}
8081export function authWrapperToken(
82handler: (req: Request, context: ImplementsRequestContext) => MaybePromise<Response>,
83options: AuthMiddlewareOptions<ImplementsRequestContext> & {
109}
110111export function authMiddlewareToken<Context extends ImplementsRequestContext>(
112options: Omit<AuthMiddlewareOptions<Context>, "requestScope"> & {
113createResponse?: (context: Context, content: unknown, init?: ResponseInit) => MaybePromise<Response>;
161}
162163export function authMiddlewareTokenQS<Context extends ImplementsRequestContext>(
164options: Omit<AuthMiddlewareOptions<Context>, "requestScope"> & {
165createResponse?: (context: Context, content: unknown, init?: ResponseInit) => MaybePromise<Response>;
213}
214215export function authMiddlewareCookie<Context extends ImplementsRequestContext>(
216options: AuthMiddlewareOptions<Context> & {
217rootPath?: string;
261};
262263function verifyAuthToken(token: string, req: Request) {
264return verifyThirdParty(token, {
265issuer: `@${handle}/authId`,
371};
372373newPayload.requestScope = requestScope instanceof Function
374? await requestScope(req, name)
375: requestScope;
451};
452453export function userDisplay(payload: JWTPayload) {
454return payload.sub.replace(/\/.*/, "");
455}
456457export function userActionsDisplay(
458payload: JWTPayload,
459{
3334const ENDPOINT = getValEndpointFromUrl(import.meta.url);
35export function api(path: string, token: string, init: RequestInit = {}) {
36return fetch(`${ENDPOINT}/${path.replace(/^\/+/, "")}`, {
37...init,
playgroundREADME.md1 match
8- only script vals supported
910everything else should be fully functional.
1112you can prefill the editor with