12const isProd = false;
13
14export async function twitterAlert({ lastRunAt }: Interval) {
15 // If isProd, search for tweets since that last time this interval ran
16 // if not, search for tweets since 48 hours ago for testing
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export async function socialDataSearch(query: string): Promise<SocialDataResponse> {
4 const url = new URL("https://stevekrouse-socialdataproxy.web.val.run/twitter/search");
5 url.searchParams.set("query", query);
2import { summarizeFeedbinEntries } from "https://esm.town/v/kamalnrf/summarizeFeedbinEntries";
3
4export async function dailyFeedbinDigest() {
5 const result = await summarizeFeedbinEntries();
6
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function fetchFromWikipedia(params) {
4 const endpoint = 'https://en.wikipedia.org/w/api.php';
5 const url = `${endpoint}?${new URLSearchParams(params).toString()}`;
14}
15
16export async function searchWikipedia(searchTerm, additionalParams = {}) {
17 const defaultParams = {
18 action: 'query',
58`;
59
60async function feedbinUnreadEntries() {
61 const { result } = await (await fetch("https://kamalnrf-feedbinunreads.web.val.run")).json();
62 return result ?? [];
63}
64
65export async function summarizeFeedbinEntries() {
66 try {
67 const entries = await feedbinUnreadEntries();
154}
155
156// Helper function to strip HTML tags
157function stripHtml(html?: string) {
158 if (!html || typeof html !== "string") {
159 return "";
13];
14
15function App() {
16 const [noClicks, setNoClicks] = useState(0);
17 const [isValentine, setIsValentine] = useState(false);
91}
92
93function client() {
94 createRoot(document.getElementById("root")).render(<App />);
95}
96if (typeof document !== "undefined") { client(); }
97
98export default async function server(request: Request): Promise<Response> {
99 return new Response(
100
17////
18
19export default async function valTownDeploy(c: Context) {
20 console.log("deploy to valtown");
21 const body = await c.req.json();
45}
46
47async function getContents(repo: Repo, after: string, commits: Commit[]) {
48 const filenames = config.vals.map((name: string) => name + ".tsx");
49 console.log(`${filenames.length} val files updated`);
55}
56
57function getModified(commits: Commit[], filenames: string[]) {
58 return commits.reduce((a: string[], b: Commit) => {
59 return [...a, ...b.modified];
61}
62
63function getFileContent(repo: Repo, after: string) {
64 return async (path: string): Promise<{
65 name: string;
81}
82
83async function updateVals(user: ValUser, updates: { name: string; code: string; }[]) {
84 console.log("updateVals");
85 await Promise.all(updates.map(async (update) => {
88}
89
90async function updateVal(username: string, update: { name: string; code: string; }) {
91 const { name, code } = update;
92 const val = await valtown.alias.username.valName.retrieve(username, name);
1/**
2 * Use this function along with your valtown webhook secret to create
3 * the x-val-signature header when posting to the /export webhook
4 */
42const url = Deno.env.get("PUSH_URL") as string;
43
44async function pushValsToGitHub() {
45 const body = "hello";
46 const signature = await sign(body, secret);
4import type { Context } from "npm:hono";
5
6export default async function(c: Context) {
7 return c.html(
8 <html>
A helper function to build a file's email
Simple functional CSS library for Val Town
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.