forms-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev ce303909347f
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone cf614aedcf4cdabfa9c45095
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
src/lib/api.ts
// The public form page talks to the app's own public API: no sign-in, one request to read and one to send.
import { APP_ID } from "../../functions/lib/config";

/** The app this page is served for: the host injects it, so a preview talks to its own data. Local dev falls back to config. */
export const SERVED_APP_ID =
  (typeof document !== "undefined" && document.getElementById("__bounded-first-live-bridge")?.getAttribute("data-app-id")) || APP_ID;

export const SERVED_API = `https://functions.bounded.sh/apps/${SERVED_APP_ID}/api`;

export class ApiError extends Error {
  constructor(public status: number, message: string, public body: Record<string, any> = {}) { super(message); }
}

/** Calls the API; a failure throws ApiError with the API's own sentence, or an offline sentence. */
export async function callApi<T>(path: string, init?: RequestInit): Promise<T> {
  let res: Response;
  try {
    res = await fetch(SERVED_API + path, init);
  } catch {
    throw new ApiError(0, "You seem to be offline. Check your connection and try again.");
  }
  const body = await res.json().catch(() => ({}));
  if (!res.ok) throw new ApiError(res.status, body.error || "Something went wrong. Try again.", body);
  return body as T;
}

Change history

Quality pass: conditional questions, 0 to 10 scale, QR code, prefill links, results tabs, API docs
ce30390934 · 4 hours ago
Bounded source sync
7d82add8ae · 1 day ago
Bounded source sync
8230fd7d59 · 1 day ago
Bounded source sync
d92a6e3b44 · 1 day ago
Bounded source sync
b548641922 · 1 day ago
Bounded source sync
b89074ffd2 · 1 day ago