1Returns a simple privacy policy for the GPT Memory API.
23Examples of input:
4- `apiName`: `Memory API`
5- `contactEmail`: `some@email.com`
6- `lastUpdated`: `2023-11-28`
2import { markdownToHtml } from "https://esm.town/v/xkonti/markdownToHtml";
34export const getPolicy = (apiName: string, contactEmail: string, lastUpdated: string) => {
5if (apiName == null || apiName === "") apiName = "Memory API";
6if (contactEmail == null || contactEmail === "") throw new Error("Contact email must be specified");
7if (lastUpdated == null || lastUpdated === "") throw new Error("The last updated date must be specified");
8const body = markdownToHtml(
9`# ${apiName} Privacy Policy
10Last Updated: ${lastUpdated}
1112## 1. Introduction
13Welcome to ${apiName}. This privacy policy outlines our practices regarding the collection, use, and sharing of information through ${apiName}.
1415## 2. Data Collection and Use
16${apiName} allows users to store, retrieve, list, and delete data. The data stored can be of any type as inputted by the user. We do not restrict or control the content of the data stored. ${apiName} serves as a public database accessible to anyone with an API key.
1718## 3. User Restrictions
19${apiName} does not impose age or user restrictions. However, users are advised to consider the sensitivity of the information they share.
2021## 4. Global Use
22Our API is accessible globally. Users from all regions can store and access data on ${apiName}.
2324## 5. Data Management
25Given the nature of ${apiName}, there are no user accounts or user identification measures. The API operates like a public database where data can be added, viewed, and deleted by any user. Users should be aware that any data they input can be accessed, modified, or deleted by other users.
2627## 6. Data Security
28${apiName} is protected by an API key; beyond this, there is no specific data security measure in place. Users should not store sensitive, personal, or confidential information using ${apiName}. We assume no responsibility for the security of the data stored.
2930## 7. Third-Party Involvement
31The API code is run and data is stored by val.town. They act as a third-party service provider for ${apiName}.
3233## 8. Changes to This Policy
FixItWandworkorders.ts4 matches
10}> {
11try {
12const response = await fetch("/api/workorders/user", {
13credentials: "include",
14});
38}> {
39try {
40const response = await fetch(`/api/workorders/user/${id}/send`, {
41method: "POST",
42credentials: "include",
66}> {
67try {
68const response = await fetch(`/api/workorders/user/${id}/complete`, {
69method: "POST",
70credentials: "include",
94}> {
95try {
96const response = await fetch(`/api/workorders/user/${id}`, {
97method: "DELETE",
98credentials: "include",
magicalOrangeLobstermain.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");
778};
779780app.get("/api/blobs", checkAuth, async (c) => {
781const prefix = c.req.query("prefix") || "";
782const limit = parseInt(c.req.query("limit") || "20", 10);
787});
788789app.get("/api/blob", checkAuth, async (c) => {
790const key = c.req.query("key");
791if (!key) return c.text("Missing key parameter", 400);
795});
796797app.put("/api/blob", checkAuth, async (c) => {
798const key = c.req.query("key");
799if (!key) return c.text("Missing key parameter", 400);
804});
805806app.delete("/api/blob", checkAuth, async (c) => {
807const key = c.req.query("key");
808if (!key) return c.text("Missing key parameter", 400);
812});
813814app.post("/api/blob", checkAuth, async (c) => {
815const { file, key } = await c.req.parseBody();
816if (!file || !key) return c.text("Missing file or key", 400);
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();
1// SBC Ladder Client for Val Town
2// Requires fetch API which is available in Val Town environment
34const BASE_URL = "https://sbc-ladder.kgignatyev.com/badminton/api/v1";
56class SBCLadderClient {
3import { useAuth } from "../hooks/useAuth.ts";
4import { Link } from "https://esm.sh/react-router-dom@7.4.1?deps=react@19.0.0,react-dom@19.0.0";
5import * as api from "../crud/workorders.ts";
6import { WorkOrder } from "../../backend/db/schemas_http.ts";
7import { GenerateWorkorderForm } from "../components/WorkOrders/GenerateWorkOrderForm/GenerateWorkOrderForm.tsx";
1920setLoading(true);
21const result = await api.fetchWorkorders();
22setWorkorders(result.workorders);
23setError(result.error);
39// Handle sending a workorder
40const handleSendWorkorder = async (id: string) => {
41const result = await api.sendWorkorder(id);
42if (result.error) {
43setError(result.error);
49// Handle completing a workorder
50const handleCompleteWorkorder = async (id: string) => {
51const result = await api.completeWorkorder(id);
52if (result.error) {
53setError(result.error);
59// Handle deleting a workorder
60const handleDeleteWorkorder = async (id: string) => {
61const result = await api.deleteWorkorder(id);
62if (result.error) {
63setError(result.error);
FixItWandconsts.tsx1 match
4export const MAGIC_LINK_SECRET = Deno.env.get("MAGIC_LINK_SECRET")!;
5export const JWT_SECRET = Deno.env.get("JWT_SECRET")!;
6export const VAL_TOWN_API_KEY = Deno.env.get("valtown")!;
78export const EmailTemplate = ({ magicLink }) => (
1export { apiRoute } from "./api.ts";
2export { authRoute } from "./auth.tsx";
3export { workorderRoute } from "./workorder.ts";
methodicalTanFishmain.tsx1 match
4async function fetchRandomJoke() {
5const response = await fetch(
6"https://official-joke-api.appspot.com/random_joke",
7);
8return response.json();