split-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 9ed962174401
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 20ace674a35b849ffda63b30
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/mine.ts
// What this browser remembers: the groups it opened and which person it is in each. Nothing leaves the device.
const GROUPS = "split:groups";

export interface SavedGroup { id: string; name: string; at: number }

function read<T>(key: string, fallback: T): T {
  try {
    const raw = localStorage.getItem(key);
    return raw ? (JSON.parse(raw) as T) : fallback;
  } catch {
    return fallback;
  }
}

function write(key: string, value: unknown) {
  try { localStorage.setItem(key, JSON.stringify(value)); } catch { /* storage full or blocked: the app still works */ }
}

export function savedGroups(): SavedGroup[] {
  const list = read<SavedGroup[]>(GROUPS, []);
  return Array.isArray(list) ? list.filter((g) => g && typeof g.id === "string").sort((a, b) => b.at - a.at) : [];
}

export function rememberGroup(id: string, name: string) {
  write(GROUPS, [{ id, name, at: Date.now() }, ...savedGroups().filter((g) => g.id !== id)].slice(0, 100));
}

export function forgetGroup(id: string) {
  write(GROUPS, savedGroups().filter((g) => g.id !== id));
}

/** Which person in the group this browser is (a plain person id). */
export function myPersonId(groupId: string): string | null {
  try { return localStorage.getItem(`split:me:${groupId}`); } catch { return null; }
}

export function setMyPersonId(groupId: string, personId: string | null) {
  try {
    if (personId) localStorage.setItem(`split:me:${groupId}`, personId);
    else localStorage.removeItem(`split:me:${groupId}`);
  } catch { /* blocked storage: the choice lasts until the page closes */ }
}

Change history

Publish quality pass from owner chat
9ed9621744 · 5 hours ago
Bind agent address in policy constants
7effc1cbbd · 5 hours ago
Quality pass: cleaner group page, phone polish, fuller API, sourced comparison
5345219781 · 5 hours ago
Bounded source sync
277fb9ad96 · 1 day ago
Bounded source sync
e944552325 · 1 day ago