SermonGPTUImain.tsx2 matches
76}
7778const endpointURL = "https://mjweaver01-sermongptapi.web.val.run";
7980function App() {
642<title>Sermon Generator</title>
643<style>
644@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;500&display=swap');
645body {
646font-family: 'Roboto', sans-serif;
legendaryRoseSwordfishmain.tsx10 matches
2021const fetchData = async () => {
22const response = await fetch("/api/data");
23const data = await response.json();
24setParticipants(data.participants);
28const handleLogin = async (e) => {
29e.preventDefault();
30const response = await fetch("/api/login", {
31method: "POST",
32headers: { "Content-Type": "application/json" },
49const handleSubmit = async (e) => {
50e.preventDefault();
51const response = await fetch("/api/update", {
52method: "POST",
53headers: { "Content-Type": "application/json" },
64const handleReset = async () => {
65if (window.confirm("Are you sure you want to reset all points?")) {
66const response = await fetch("/api/reset", { method: "POST" });
67if (response.ok) {
68fetchData();
7273const handleExportCSV = async () => {
74const response = await fetch("/api/export-csv");
75const blob = await response.blob();
76const url = window.URL.createObjectURL(blob);
248`);
249250if (req.method === "POST" && req.url.endsWith("/api/login")) {
251const { username, password } = await req.json();
252if (username === "admin" && password === "123123123") {
256}
257258if (req.method === "POST" && req.url.endsWith("/api/update")) {
259const { name, points, note } = await req.json();
260await sqlite.execute(
276}
277278if (req.method === "POST" && req.url.endsWith("/api/reset")) {
279await sqlite.execute(`DELETE FROM ${KEY}_participants_${SCHEMA_VERSION}`);
280await sqlite.execute(`DELETE FROM ${KEY}_logs_${SCHEMA_VERSION}`);
282}
283284if (req.url.endsWith("/api/data")) {
285const participants = await sqlite.execute(`
286SELECT * FROM ${KEY}_participants_${SCHEMA_VERSION}
303}
304305if (req.url.endsWith("/api/export-csv")) {
306const participants = await sqlite.execute(`
307SELECT * FROM ${KEY}_participants_${SCHEMA_VERSION}
SermonGPTAPIREADME.md1 match
1Migrated from folder: SermonGPT/SermonGPTAPI
blob_adminmain.tsx25 matches
73const menuRef = useRef(null);
74const isPublic = blob.key.startsWith("__public/");
75const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
7677useEffect(() => {
237setLoading(true);
238try {
239const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240const data = await response.json();
241setBlobs(data);
264setBlobContentLoading(true);
265try {
266const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267const content = await response.text();
268setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
278const handleSave = async () => {
279try {
280await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281method: "PUT",
282body: editContent,
290const handleDelete = async (key) => {
291try {
292await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293setBlobs(blobs.filter(b => b.key !== key));
294if (selectedBlob && selectedBlob.key === key) {
307const key = `${searchPrefix}${file.name}`;
308formData.append("key", encodeKey(key));
309await fetch("/api/blob", { method: "POST", body: formData });
310const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311setBlobs([newBlob, ...blobs]);
329try {
330const fullKey = `${searchPrefix}${key}`;
331await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332method: "PUT",
333body: "",
344const handleDownload = async (key) => {
345try {
346const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347const blob = await response.blob();
348const url = window.URL.createObjectURL(blob);
363if (newKey && newKey !== oldKey) {
364try {
365const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366const content = await response.blob();
367await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368method: "PUT",
369body: content,
370});
371await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373if (selectedBlob && selectedBlob.key === oldKey) {
383const newKey = `__public/${key}`;
384try {
385const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386const content = await response.blob();
387await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388method: "PUT",
389body: content,
390});
391await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393if (selectedBlob && selectedBlob.key === key) {
402const newKey = key.slice(9); // Remove "__public/" prefix
403try {
404const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405const content = await response.blob();
406await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407method: "PUT",
408body: content,
409});
410await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412if (selectedBlob && selectedBlob.key === key) {
557onClick={() =>
558copyToClipboard(
559`${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
560)}
561className="text-blue-400 hover:text-blue-300 text-sm"
580>
581<img
582src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
583alt="Blob content"
584className="max-w-full h-auto"
660661// Public route without authentication
662app.get("/api/public/:id", async (c) => {
663const key = `__public/${c.req.param("id")}`;
664const { blob } = await import("https://esm.town/v/std/blob");
765};
766767app.get("/api/blobs", checkAuth, async (c) => {
768const prefix = c.req.query("prefix") || "";
769const limit = parseInt(c.req.query("limit") || "20", 10);
774});
775776app.get("/api/blob", checkAuth, async (c) => {
777const key = c.req.query("key");
778if (!key) return c.text("Missing key parameter", 400);
782});
783784app.put("/api/blob", checkAuth, async (c) => {
785const key = c.req.query("key");
786if (!key) return c.text("Missing key parameter", 400);
791});
792793app.delete("/api/blob", checkAuth, async (c) => {
794const key = c.req.query("key");
795if (!key) return c.text("Missing key parameter", 400);
799});
800801app.post("/api/blob", checkAuth, async (c) => {
802const { file, key } = await c.req.parseBody();
803if (!file || !key) return c.text("Missing file or key", 400);
whoIsHiringmain.tsx4 matches
63const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
360export default async function(req: Request): Promise<Response> {
361const url = new URL(req.url);
362if (url.pathname === "/api/stories") {
363const storySearch = await hnSearch({
364search_by_date: true,
381}
382383if (url.pathname === "/api/comments") {
384const params = url.searchParams;
385const query = params.get("query") || "";
265266if (!jsonContent) {
267throw new Error("Failed to extract JSON from the API response");
268}
269
savvyTealCardinalmain.tsx12 matches
405406const css = `
407@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');
408409:root {
737async function server(request: Request): Promise<Response> {
738if (request.method === "POST" && new URL(request.url).pathname === "/generate-training") {
739const YOUTUBE_API_KEY = Deno.env.get("YOUTUBE_API_KEY2");
740const useApiKey = YOUTUBE_API_KEY !== undefined && YOUTUBE_API_KEY !== "";
741if (!YOUTUBE_API_KEY) {
742console.warn("YouTube API key (YOUTUBE_API_KEY2) is not set. Falling back to search URL method.");
743}
744805for (const placeholder of videoPlaceholders) {
806const searchQuery = placeholder.replace("[VIDEO: ", "").replace("]", "");
807const videoId = await getYouTubeVideoId(searchQuery, sport, YOUTUBE_API_KEY);
808if (videoId) {
809const embedHtml = `
891}
892893async function getYouTubeVideoId(query, sport, apiKey, useApiKey = true) {
894if (useApiKey) {
895try {
896const searchUrl = `https://www.googleapis.com/youtube/v3/search?part=snippet&q=${
897encodeURIComponent(sport + " " + query)
898}&key=${apiKey}&type=video&maxResults=1`;
899const response = await fetch(searchUrl);
900const data = await response.json();
901if (data.error) {
902console.warn("YouTube API error:", data.error.message);
903return getFallbackYouTubeLink(query, sport);
904}
907}
908} catch (error) {
909console.error("Error fetching from YouTube API:", error);
910}
911}
5async function fetchRandomJoke() {
6const response = await fetch(
7"https://official-joke-api.appspot.com/random_joke",
8);
9return response.json();
bandcampWrappedmain.tsx4 matches
7778<p>
79Spotify <a href='https://www.theverge.com/2024/12/5/24311523/spotify-locked-down-apis-developers'>does</a>
80a <a href='https://www.theverge.com/2024/11/14/24294995/spotify-ai-fake-albums-scam-distributors-metadata'>lot</a>
81of <a href='https://www.vice.com/en/article/spotify-rogan-rfk-vaccine-misinformation-policy/'>bad</a>
92needlessly complex because, like way too many companies,
93Bandcamp has <a href='https://www.reddit.com/r/BandCamp/comments/k8ojd2/question_for_any_devs_with_bandcamp_experience/'>locked down</a>
94and <a href='https://github.com/michaelherger/Bandcamp-API'>hobbled</a> their public
95API, probably because bad actors would abuse it, which is reasonable, but
96on the other hand, made it impossible to do creative things like this that benefit
97Bandcamp without annoying workarounds. I don't know, people would probably
98<a href='https://www.404media.co/bluesky-posts-machine-learning-ai-datasets-hugging-face/'>
99train some large language model on Bandcamp data</a> if there was a public API,
100because that's what people do now.
101</p>
bandcampWrappedREADME.md2 matches
5wacky enough to buy their music instead of streaming it from some service.
67Because Bandcamp doesn't have an API, this hinges on you going to your purchases page, copying the purchases, and pasting it in. Thanks to
8the ability of [the system clipboard to contain HTML](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem), the same technology that makes
9copy-and-pasted text have unpredictable and annoying font and boldness choices also lets this parse and reformat that purchases page into something
10shareable.