3import { fetch } from "https://esm.town/v/std/fetch";
4
5export async function bsky_rss_poll() {
6 const { parseFeed } = await import("https://deno.land/x/rss/mod.ts");
7 const res = await fetch("https://v8.dev/blog.atom")
4It's split into three parts:
51. [`bsky_rss_poll`](https://val.town/@jordan.bsky_rss_poll)
6 - This function runs every hour and polls the provided RSS feed, turns it into XML and runs the check. If there *is* a new post, it tell `rss_to_bsky`to post a link (and the title) to Bluesky
72. [`latest_rss`](https://val.town/@jordan.latest_rss)
8 - This is a stored object that keeps the latest object for the poll to test against
93. [`rss_to_bsky`](https://val.town/@jordan.rss_to_bsky)
10 - This function turns the text post into a rich text post and posts it to Bluesky
11
12Migrated from folder: Archive/bsky_rss_poll
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
1import net, { AddressInfo } from "node:net";
2
3export default async function(req: Request): Promise<Response> {
4 return serveRequest(
5 req,
6 `data:text/tsx,${
7 encodeURIComponent(`
8export default async function(req: Request): Promise<Response> {
9 return Response.json("I am within a worker!")
10}
14}
15
16export async function serveRequest(req: Request, importUrl: string): Promise<Response> {
17 let port = await getFreePort();
18 const worker = new Worker(`https://esm.town/v/maxm/evaltownWorker?cachebust=${crypto.randomUUID()}`, {
56 });
57
58export async function isPortListening(port: number): Promise<boolean> {
59 let isListening = false;
60 const maxWaitTime = 2000; // ms
48await contentStore.init();
49
50function Town() {
51 return (
52 <div
69}
70
71function HomePage() {
72 return (
73 <html>
82 <form method="POST" action="/submit">
83 <textarea name="handler" rows={10} cols={50} autoFocus>
84 {`export default async function(req: Request) {
85 return Response.json("Hello, world!");
86}`}
95}
96
97function ContentPage({ handler, id }: { handler: string; id: string }) {
98 return (
99 <html>
122 let originalContent = textarea.value;
123
124 textarea.addEventListener('input', function() {
125 if (textarea.value !== originalContent) {
126 submitButton.style.display = 'inline-block';
7import About from "https://esm.town/v/vawogbemi/whoIsHiringAbout";
8
9function App() {
10 const tabs = { "/": "Home", "/about": "About" };
11 const [activeTab, setActiveTab] = useState("/");
352}
353
354function ServerApp() {
355 return (
356 <html>
375}
376
377export default async function(req: Request): Promise<Response> {
378 const url = new URL(req.url);
379 if (url.pathname === "/api/stories") {
8};
9
10async function handleRequest(request) {
11 const url = new URL(request.url);
12
1import Parser from "https://esm.sh/rss-parser@3.13.0";
2
3export default async function(req: Request): Promise<Response> {
4 const url = new URL(req.url);
5 const feedUrl = url.searchParams.get("url");
1export default async function server(request: Request): Promise<Response> {
2 const url = new URL(request.url);
3 const min = parseInt(url.searchParams.get("min") || "2");
81`;
82
83function Instructions() {
84 return (
85 <div className="mb-4">
95}
96
97function TipList({ tips, selectedDate, sortOrder, setSortOrder }) {
98 const filteredTips = tips.filter((tip) => {
99 const tipDate = new Date(tip.timestamp);
145}
146
147function DateSelector({ selectedDate, setSelectedDate }) {
148 const [isCalendarOpen, setIsCalendarOpen] = useState(false);
149 const today = new Date();
232}
233
234function App({ initialTips }) {
235 const [amount, setAmount] = useState(20);
236 const [name, setName] = useState("");
350}
351
352function Confetti() {
353 useEffect(() => {
354 confetti({
362}
363
364function SuccessPage({ payments }) {
365 return (
366 <div className="min-h-screen bg-white text-black flex flex-col items-center justify-center p-4">
387}
388
389function client() {
390 const root = document.getElementById("root");
391 if (root.dataset.page === "success") {
402}
403
404export default async function server(req: Request): Promise<Response> {
405 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
406 const SCHEMA_VERSION = 2;