Nostro/docs/screenshots/take.sh
Jorijn van der Graaf 5b4037955b feat(app): add the Nostro app, a window for phones and desktops
Linux phones have no banking apps, and a command line is no answer on a
phone. The app does everything the nostro command does and, like it, only
talks to nostrod: it holds no key and no token.

- Nostro.Ui, a toolkit whose screens are functions that fill a frame, ported
  from imsd-messages ca5cd72d; Nostro.App, the app's state, forms and screens;
  Nostro.Ui.Shell, which puts them on a Wayland window with Crafter.Graphics;
  nostro-app; and Nostro.DebugCommands for the --debug-api build.
- Client: every method also in an asynchronous form for an sd-event loop,
  with DaemonMissing and OutcomeUnknown.
- nostrod's Flatpak is net.catcrafts.Nostrod now and the app takes
  net.catcrafts.Nostro; install.sh moves the state. The app's Flatpak, both
  Flatpaks cross-built for aarch64, and the licence texts they carry.
- nostro-fake-system, a made-up bus and bank with a real nostrod on them, to
  look at the app against. The README's screenshots are taken on it.
- The nostro command: an API key's environment is the key's own to say, so
  --sandbox is for bunq-oauth alone, and a virtual card is listed as VIRTUAL.

The published contract changes in three places, before any release (design
rule 10):
- Transactions' query takes `stored`: answered from what nostrod has stored,
  without asking the bank. The app searches with it; before, every search was
  a call to bunq.
- AddBunq's `environment` no longer chooses over what the key says of itself:
  a key of the other environment is refused.
- SetCardStatus refuses to freeze or unfreeze a virtual card. bunq reports one
  as DEACTIVATED however well it pays, and leaves it as it is when asked,
  without an error.

The app is GPL-3.0-only, the library stays LGPL-3.0-only, and no code moved
from one to the other (design rule 13). Transaction's schema is unchanged.

Verified: the 17 tests pass with every line, function and region of what they
link run, and the five lint runs are clean. Every screen was looked at on the
made-up system, at a phone's and a desktop's sizes in the light and the dark
look, on Plasma under Wayland. What is said of bunq's cards comes from its
sandbox, with throwaway users, and from one real virtual card. Known to have
been used against production: connecting, and reading accounts, payments and
cards. Not known to have been tried: a payment from the app against bunq,
OAuth against bunq, and anything on a phone.

Building the app takes --graphics=, a Crafter.Graphics checkout on its branch
claude/nostro-app, until that branch is merged and pinned here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 12:27:14 +01:00

55 lines
3.1 KiB
Shell
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# Takes the README's screenshots again: the app on the made-up system (tests/FakeSystem), so that nobody's bank is in
# them.
#
# take.sh <nostro-fake-system> <nostro-app> [the directory to write them to; this one when left out]
#
# The two programs are what crafter-build makes of --product=fake-system and of --product=app. Run this where they run,
# in a session with a compositor: every shot shows the window for a few seconds. For a build made in crafter-build's
# Flatpak that is inside it, and kept off the real system bus:
# flatpak run --nosocket=system-bus --command=sh net.catcrafts.CrafterBuild docs/screenshots/take.sh <the two programs>
#
# What a --poke script taps is named by its place in dp, which holds at any --scale and moves with the layout: when a
# screen is laid out anew, look at what was shot and change the numbers to match. Before each shot the pointer is put on
# the bar's title, where it lights nothing up. The made-up bank dates its payments back from now, so the days and times
# in a shot are the day's it was taken on.
#
# The files kept in the repository were then made smaller, their pixels unchanged:
# magick mogrify -strip -alpha off -define png:compression-level=9 -define png:compression-filter=5 *.png
set -eu
usage='usage: take.sh <nostro-fake-system> <nostro-app> [directory]'
fake=${1:?$usage}
app=${2:?$usage}
out=$(cd "${3:-$(dirname "$0")}" && pwd)
state=$(mktemp -d)
trap 'rm -rf "$state"' EXIT
# The made-up user's current account, which has three months of payments, and a friend of theirs at the same bank.
account=NL54BUNQ2100000011
friend=NL36BUNQ2100000044
# A phone's screen, and a window wide enough for the places and the accounts down its side.
phone='--size 360x760 --scale 2'
desktop='--size 1200x750 --scale 1.5'
# shot <name> <the app's options> <the steps before the shot>: one run of the app on a made-up system of its own. The
# app ends when its script has been played.
shot() {
rm -f "$out/$1.png"
# The options are words, split here on purpose.
# shellcheck disable=SC2086
"$fake" --dir "$state/$1" --run "$app" $2 --poke "wait:3500;$3;wait:300;shot:$out/$1.png;wait:500"
[ -s "$out/$1.png" ] || { echo "take.sh: $1.png was not written" >&2; exit 1; }
}
# Four in the dark look and one in the light one.
shot phone-accounts "$phone --theme dark --route accounts" "move:180,28"
shot phone-account "$phone --theme dark --route account:$account" "move:180,28"
# The pay form, gone into by the account's Pay and filled in from its To down.
shot phone-pay "$phone --theme dark --route account:$account" "tap:95,200;wait:600;tap:180,224;text:$friend;key:Tab;text:Nora White;key:Tab;text:12.50;key:Tab;text:Dinner;move:180,28"
shot desktop-account "$desktop --theme light --route account:$account" "move:700,28"
# A payment's details: the friend's payments searched for, and the first of them opened.
shot desktop-payment-dark "$desktop --theme dark --route account:$account" "tap:740,320;text:Nora;wait:700;tap:740,470;wait:700;move:740,28"
echo "take.sh: five screenshots in $out"