Your phone is the terminal. Stream a Linux/Mac desktop to an iPhone over WebRTC through NAT, with audio and input. Open source, single binaries.

0 downloads

Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/network-computer.git
HTTPS
https://gitstable.com/git/askrobots/network-computer.git
SSH
ssh://git@gitstable.com:2222/askrobots/network-computer.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Dan Quellhorst Firefox policy: no WebRTC mDNS (a page using WebRTC made Firefox listen on UDP 5353) a1d92f3 1 month, 3 weeks ago History
apps.sh · 6.9 KB · 113 lines
1#!/bin/sh
2# Build the dbbasic apps for Linux on a desk and install them there.
3#
4# infra/apps.sh toolchain Flutter + build tools on the desk (once)
5# infra/apps.sh build NAME... build and install (writer spreadsheet ...)
6# infra/apps.sh list the apps this knows
7#
8# The apps are Flutter and not open source: their source is copied to the
9# desk's build user (/var/lib/ncbuild, the computer's own disk, never the
10# desk volume) only to build. What is installed is the built bundle, on the
11# desk in /desk/apps/NAME/ with a manifest, so a new computer gets the apps
12# back (nc-apps install, run by provisioning). Sources are found under
13# $DBBASIC_APPS_SRC (default /Volumes/T9). Uses the same desk as droplet.sh.
14set -e
15cd "$(dirname "$0")"
16SRC=${DBBASIC_APPS_SRC:-/Volumes/T9}
17# the current stable on the desk (the apps' webview_all needs >= 3.35)
18FLUTTER_VERSION=3.47.5
19
20# name|source dir|title|linux app id|binary|categories|extensions|mime|comment
21APPS='writer|dbbasic-writer-native|DBBASIC Writer|com.dbbasic.writer|dbbasic_writer|Office;WordProcessor;|dbw|application/x-dbbasic-writer|Write documents
22spreadsheet|dbbasic-spreadsheet-native|DBBASIC Spreadsheet|com.dbbasic.spreadsheet|dbbasic_spreadsheet|Office;Spreadsheet;|dbs|application/x-dbbasic-sheet|Spreadsheets
23slides|dbbasic-slides-native|DBBASIC Slides|com.dbbasic.slides|dbbasic_slides|Office;Presentation;|dbp|application/x-dbbasic-slides|Presentations
24draw|dbbasic-draw|DBBASIC Draw|com.dbbasic.draw|dbbasic_draw|Graphics;2DGraphics;|||Draw and make images
25shell|dbbasicshell|DBBASIC Shell|com.dbbasic.shell|basicshell|System;TerminalEmulator;|||A terminal with AI
26webmaster|dbbasic-webmaster|DBBASIC Webmaster|com.dbbasic.webmaster|dbbasic_webmaster|Development;WebDevelopment;|||Build websites
27porter|dbbasic-porter/porter_app|DBBASIC Porter|com.dbbasic.porter|porter|Utility;|||Convert between formats
28cabinet|dbbasic-cabinet|DBBASIC Cabinet|com.dbbasic.cabinet|dbbasic_cabinet|Office;Scanning;OCR;|||The paperless office: scan, read, file
29dove|dbbasic-dove|DBBASIC Dove|com.dbbasic.dove|dove|Network;Email;|||Mail: any mail server, triage first'
30
31row() { echo "$APPS" | awk -F'|' -v n="$1" '$1==n'; }
32IP=$(doctl compute droplet list --format Name,PublicIPv4 --no-header 2>/dev/null | awk -v n="${NC_HOST_NAME:-nc}" '$1==n{print $2}')
33
34case "$1" in
35 list) echo "$APPS" | awk -F'|' '{printf "%-12s %-24s %s\n", $1, $3, $2}' ;;
36 toolchain)
37 [ -n "$IP" ] || { echo "no desk is up"; exit 1; }
38 ssh root@"$IP" FLUTTER_VERSION=$FLUTTER_VERSION sh -s <<'EOF'
39set -e
40export DEBIAN_FRONTEND=noninteractive
41apt-get -o DPkg::Lock::Timeout=600 install -y -q clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev \
42 libstdc++-14-dev xz-utils unzip rsync libwebkit2gtk-4.1-dev \
43 libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev >/dev/null
44id ncbuild >/dev/null 2>&1 || useradd -r -m -d /var/lib/ncbuild -s /bin/bash ncbuild
45have=$(cat /opt/flutter/version 2>/dev/null || runuser -u ncbuild -- /opt/flutter/bin/flutter --version 2>/dev/null | awk 'NR==1{print $2}')
46if [ "$have" != "$FLUTTER_VERSION" ]; then
47 rm -rf /opt/flutter
48 curl -sSfL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" -o /tmp/flutter.tar.xz
49 tar -xJf /tmp/flutter.tar.xz -C /opt && rm /tmp/flutter.tar.xz
50 chown -R ncbuild:ncbuild /opt/flutter
51fi
52runuser -u ncbuild -- sh -c 'export PATH=/opt/flutter/bin:$PATH; git config --global --add safe.directory /opt/flutter
53 flutter config --no-analytics --enable-linux-desktop >/dev/null; flutter precache --linux >/dev/null; flutter --version | head -1'
54EOF
55 ;;
56 build)
57 shift; [ $# -gt 0 ] || { echo "usage: apps.sh build NAME..."; exit 2; }
58 [ -n "$IP" ] || { echo "no desk is up"; exit 1; }
59 for name in "$@"; do
60 r=$(row "$name"); [ -n "$r" ] || { echo "unknown app: $name"; exit 2; }
61 IFS='|' read -r n dir title appid bin cats exts mime comment <<EOF
62$r
63EOF
64 [ -f "$SRC/$dir/pubspec.yaml" ] || { echo "no source at $SRC/$dir"; exit 1; }
65 echo ">> $title: copying the source to the build user"
66 # the same layout as $SRC, so path dependencies (../dbbasic-app-kit) resolve
67 ssh root@"$IP" "install -d -o ncbuild -g ncbuild /var/lib/ncbuild/src/$dir /var/lib/ncbuild/src/dbbasic-app-kit"
68 X="--exclude .git/ --exclude build/ --exclude .dart_tool/ --exclude Pods/ --exclude .DS_Store --exclude .env --exclude *.env"
69 [ -f "$SRC/dbbasic-app-kit/pubspec.yaml" ] &&
70 rsync -a --delete $X "$SRC/dbbasic-app-kit/" root@"$IP":/var/lib/ncbuild/src/dbbasic-app-kit/
71 rsync -a --delete $X "$SRC/$dir/" root@"$IP":/var/lib/ncbuild/src/$dir/
72 echo ">> $title: building (flutter build linux)"
73 ssh root@"$IP" N="$n" DIR="$dir" APPID="$appid" BIN="$bin" TITLE="\"$title\"" CATS="\"$cats\"" EXTS="\"$exts\"" \
74 MIME="\"$mime\"" COMMENT="\"$comment\"" sh -s <<'EOF'
75set -e
76S=/var/lib/ncbuild/src/$DIR; chown -R ncbuild:ncbuild /var/lib/ncbuild/src; cd "$S"
77[ -d linux ] || runuser -u ncbuild -- sh -c 'PATH=/opt/flutter/bin:$PATH flutter create --platforms=linux . >/dev/null'
78# its own identity on Linux: apps copied from Writer still carry Writer's,
79# and GTK would hand a second app with the same id to the first one's window
80sed -i "s|^set(BINARY_NAME .*|set(BINARY_NAME \"$BIN\")|; s|^set(APPLICATION_ID .*|set(APPLICATION_ID \"$APPID\")|" linux/CMakeLists.txt
81# and its name on the window, not the Dart project name
82sed -i -E "s/(gtk_header_bar_set_title\(header_bar, |gtk_window_set_title\(window, )\"[^\"]*\"/\1\"$TITLE\"/" linux/runner/my_application.cc
83# the whole icon font: an incremental build kept the first build's cut-down
84# font, so icons added later drew as blanks (2026-09-25)
85# in a box: lowest CPU priority and capped memory, so a build never starves
86# the person using the desk (one froze it, 2026-09-25); too big = it fails, not the desk
87systemd-run --quiet --wait --pipe --collect --uid=ncbuild --working-directory="$PWD" \
88 -p MemoryHigh=1400M -p MemoryMax=2G -p CPUWeight=10 -p Nice=19 -p IOWeight=10 \
89 --setenv=HOME=/var/lib/ncbuild --setenv=PATH=/opt/flutter/bin:/usr/local/bin:/usr/bin:/bin \
90 sh -c 'flutter pub get >/dev/null && flutter build linux --release --no-tree-shake-icons 2>&1 | tail -15'
91B=$S/build/linux/x64/release/bundle
92[ -x "$B/$BIN" ] || { echo "!! build produced no $BIN"; exit 1; }
93ROOT=/desk/apps; [ -d /desk/nc ] || ROOT=/opt/dbbasic
94install -d "$ROOT/$N"; rsync -a --delete "$B/" "$ROOT/$N/"
95icon=$(ls "$S"/macos/Runner/Assets.xcassets/AppIcon.appiconset/*512*.png 2>/dev/null | head -1)
96[ -n "$icon" ] && cp "$icon" "$ROOT/$N/icon.png"
97cat > "$ROOT/$N/nc-app.env" <<M
98NAME=$N
99TITLE="$TITLE"
100BINARY=$BIN
101COMMENT="$COMMENT"
102CATEGORIES="$CATS"
103EXTENSIONS="$EXTS"
104MIME="$MIME"
105ICON=icon.png
106M
107chown -R root:root "$ROOT/$N"; chmod -R a+rX "$ROOT/$N"
108nc-apps install
109echo " installed $(du -sh "$ROOT/$N" | cut -f1) in $ROOT/$N"
110EOF
111 done ;;
112 *) echo "usage: apps.sh toolchain | build NAME... | list"; exit 2 ;;
113esac