Skip to content

Trash for deleted forms and responses, fresh dashboard, in-app Android updates - #13

Merged
shatheitguy merged 3 commits into
mainfrom
fresh-dashboard
Nov 19, 2026
Merged

shatheitguy merged 3 commits into
mainfrom
fresh-dashboard

Conversation

@shatheitguy

Copy link
Copy Markdown
Owner

What changed

Dashboard shows new forms right away

  • experimental.staleTimes.dynamic = 0 in next.config.mjs. Next.js 14 re-used a page seen in the last 30 s on link navigation, so a form created in the builder was missing from the dashboard until a reload. Every page here is live data, so navigations now always ask the server (the branded loading screen covers the wait).

Trash (Settings → Trash, admins)

  • New TrashItem table. Deleting a form or responses first copies them there as JSON (a form with its responses and access list, or one response), then deletes them as before. No existing query had to learn about "deleted" rows.
  • Restore: a form comes back with its responses and access (only for users that still exist). If its slug/port/domain was taken meanwhile it gets new ones (backfillLinks). A response can be restored only when its form exists; the UI says to restore the form first.
  • Delete forever / Empty Trash, plus an hourly purge of items older than 30 days (startTrashPurge in lib/startup.ts). Uploaded files stay on disk until an item leaves the Trash; deleting a form for good also removes its trashed responses.
  • Included in system backups (trashItem table). Older backups without it still restore.
  • Delete dialogs now say items go to the Trash. Arabic and Tamil strings added.

Android app updates itself

  • AppUpdater.java: once a day on start (and on demand) it reads the latest GitHub release; if the tag is newer than the installed version and the release has FormCraft.apk, it offers Update / Later, downloads with DownloadManager and opens the installer via FileProvider. First time, Android asks to allow "Install unknown apps".
  • "Check for updates" from a long-press app-icon shortcut and a link under the connect screen (which also shows the app version).
  • New permission REQUEST_INSTALL_PACKAGES. README documents how to publish an update.

Testing

  • tsc --noEmit passes; APK builds (mobile\scripts\build-apk.ps1).
  • Locally in the browser: create form → builder → Dashboard shows it without reload; delete a response and a form, Trash list with answer preview, restore-guard for a response whose form is deleted, restore form (responses back), restore response, Delete forever through the UI.
  • Not yet tried: the updater on a real phone. It needs a release newer than 1.1.2 with FormCraft.apk to offer an update.

Notes for review

  • Schema change: new TrashItem model only (no changes to existing tables). The Docker entrypoint's prisma db push creates it on start.
  • APK updates only install over an app signed with the same key (same release keystore, or the same PC's debug key).

…t away

Trash (Settings → Trash, admins)
- Deleting a form or responses now copies them to a new TrashItem table
  (form + responses + access list, or one response) and then deletes them as
  before, so no existing query had to change
- Restore puts a form back with its responses and access; a response can be
  restored once its form exists. A form whose link/port/domain was taken
  meanwhile gets new ones
- Delete forever / Empty Trash; anything older than 30 days is removed every
  hour. Uploaded files stay until an item leaves the Trash
- Included in system backups (older backups still restore)
- Delete dialogs now say items go to the Trash; Arabic and Tamil text added

Dashboard
- experimental.staleTimes.dynamic = 0: links no longer reuse a page seen in
  the last 30 s, so a form created in the builder shows on the dashboard
  without a reload
- Once a day on start (and on demand) the app asks GitHub for the latest
  release; if it is newer and has FormCraft.apk, it offers Update / Later
- Update downloads the APK with a notification and opens Android's installer;
  the first time Android asks to allow "Install unknown apps" for FormCraft
- "Check for updates" via a long-press app-icon shortcut and a link under the
  connect screen, which now also shows the app version
- New permission: REQUEST_INSTALL_PACKAGES (nothing installs without a tap)
- README: how updates work and how to publish one (same signing key)
- Finds an existing installation before anything else: the FormCraft
  container's compose folder, then this folder, ./formcraft, ~/formcraft,
  /root/formcraft, /opt/formcraft, /srv/formcraft. Before, running the
  one-liner from another folder started a second, fresh install
- Update refreshes the compose files (old ones kept as *.bak; git checkouts
  keep theirs), pulls, restarts, removes the replaced image, waits for health
- Says whether it updated or was already the newest version
@shatheitguy
shatheitguy merged commit 4986311 into main Nov 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant