sqliteExplorerAppREADME.md1 match
13## Authentication
1415Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
1617## Todos / Plans
sqliteExplorerAppmain.tsx2 matches
27<head>
28<title>SQLite Explorer</title>
29<link rel="preconnect" href="https://fonts.googleapis.com" />
3031<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32<link
33href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34rel="stylesheet"
35/>
petunia_chatmain.tsx1 match
1920const sharedStyles = `
21@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400;700&display=swap');
2223body {
twitterAlertREADME.md3 matches
45This val gets Twitter data via [SocialData](https://socialdata.tools) via
6@stevekrouse/socialDataProxy. Val Town Pro users can call this API
7100 times per day, so be sure not to set this cron to run more than once every 15 min.
8If you want to use it more, get your own [SocialData](https://socialdata.tools)
9API token and pay for it directly.
1011## 1. Query
13Change the `query` variable for what you want to get notified for.
1415You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
1617## 2. Notification
58async function buscarDadosLoteria(numero = null) {
59const url = numero
60? `https://servicebus2.caixa.gov.br/portaldeloterias/api/megasena/${numero}`
61: "https://servicebus2.caixa.gov.br/portaldeloterias/api/megasena/";
6263try {
8const startingBalance = 100;
910interface ApiResponse {
11status: number;
12body: any;
131}
132133function handleHome(baseUrl: string): ApiResponse {
134return {
135status: 200,
139}
140141async function handleBalance(address: string | null): Promise<ApiResponse> {
142if (!address) {
143return {
153}
154155async function handleSend(data: any): Promise<ApiResponse> {
156const { from, to, amount } = data;
157if (!from || !to || amount === undefined) {
193}
194195async function handleAccounts(): Promise<ApiResponse> {
196const accounts = await getAllAccounts();
197return {
201}
202203async function handleMint(data: any, authHeader: string | null): Promise<ApiResponse> {
204const { address, amount } = data;
205if (!address || amount === undefined) {
235}
236237function handleFavicon(): ApiResponse {
238return {
239status: 204,
242}
243244function handleNotFound(): ApiResponse {
245return {
246status: 404,
249}
250251function logRequestResponse(req: Request, res: ApiResponse) {
252console.log(`Request: ${req.method} ${req.url}`);
253console.log(`Response: Status ${res.status}, Body:`, res.body);
260const path = url.pathname;
261262let response: ApiResponse;
263264switch (true) {
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);
superbAzureSharkmain.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);
cerebras_codermain.tsx1 match
9const STARTER_PROMPTS = [
10"todo list app persisted in local storage",
11"weather app using open-meteo API",
12"interactive markdown editor with live preview",
13"pomodoro timer with sound notifications",
gif_uploadmain.tsx1 match
7AtpAgent,
8BlobRef,
9} from "https://esm.sh/@atproto/api";
1011function App() {