Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions garden-common/src/main/assets/linux/flatpak
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
#!/bin/sh
# Managed by ThothTerm (rewritten on every window; do not edit).
# Debian's flatpak asks the system D-Bus about parental controls before it
# installs an app, and a PRoot guest runs no system bus by itself ("Could not
# connect: No such file or directory"). Start one when none answers, then run
# the real flatpak. Its sandboxes go to ThothDock through $FLATPAK_BWRAP.
if [ ! -x /usr/bin/flatpak ]; then
echo "flatpak is not installed. Install it with: sudo apt install flatpak" >&2
exit 127
# Runs Debian's own flatpak with what a PRoot guest lacks:
# * Its sandboxes go to ThothDock through $FLATPAK_BWRAP. sudo clears the
# environment, so it is set here as well: "sudo flatpak" would otherwise
# fall back to the stock bwrap, which needs user namespaces Android denies.
# * Debian's flatpak asks the system D-Bus about parental controls before it
# installs an app, and a PRoot guest runs no system bus by itself ("Could
# not connect: No such file or directory"). Start one when none answers.
# * On first use it installs flatpak and dbus (only Recommended by flatpak,
# but needed for that bus) and adds the Flathub remote.
BWRAP=/usr/libexec/thothdock/bwrap
if [ -z "${FLATPAK_BWRAP-}" ] && [ -x "$BWRAP" ]; then
FLATPAK_BWRAP="$BWRAP"
export FLATPAK_BWRAP
fi
if [ ! -x /usr/bin/flatpak ] || ! command -v dbus-daemon >/dev/null 2>&1; then
echo "Installing flatpak (first use)..." >&2
if ! sudo sh -c 'export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends flatpak dbus ||
{ apt-get update && apt-get install -y --no-install-recommends flatpak dbus; }' >&2; then
echo "flatpak could not be installed. Try: sudo apt install flatpak dbus" >&2
exit 127
fi
flatpak_first_use=1
fi
if ! dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply \
/org/freedesktop/DBus org.freedesktop.DBus.GetId >/dev/null 2>&1; then
# A socket and pid file left by a bus that ended with the last window.
sudo -n sh -c 'mkdir -p /run/dbus && rm -f /run/dbus/pid /run/dbus/system_bus_socket && dbus-daemon --system --fork' \
>/dev/null 2>&1 || echo "flatpak (ThothTerm): could not start the system D-Bus; app installs may fail" >&2
fi
if [ -n "${flatpak_first_use-}" ]; then
/usr/bin/flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo >&2 &&
echo "Flathub added: flatpak install flathub <app>" >&2 ||
echo "Flathub was not added: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo" >&2
fi
exec /usr/bin/flatpak "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
public final class EngineGuard {
static final String[] PROTECTED = {
"docker.io", "docker-ce", "docker-engine", "moby-engine", "containerd", "containerd.io", "runc",
// ThothDock provides the snap command; the real snapd cannot run in a PRoot guest.
"snapd",
};
static final String GUARD_PACKAGE = "thothdock-engine-guard";
private static final String ASSET_DIR = "thothdock/engine-guard";
Expand Down
4 changes: 2 additions & 2 deletions garden-common/src/main/res/values/defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<string name="pref_color_default" translatable="false">11</string>
<bool name="pref_utf8_by_default_default">true</bool>
<string name="pref_backaction_default" translatable="false">2</string>
<string name="pref_controlkey_default" translatable="false">5</string>
<string name="pref_fnkey_default" translatable="false">4</string>
<string name="pref_controlkey_default" translatable="false">7</string>
<string name="pref_fnkey_default" translatable="false">7</string>
<string name="pref_ime_default" translatable="false">0</string>
<bool name="pref_alt_sends_esc_default">false</bool>
<string name="pref_shell_default" translatable="false">/system/bin/sh -</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package jackpal.androidterm.util;

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Test;

/**
* The volume keys must not be Ctrl and Fn by default. Two presses of Volume
* Down used to lock Ctrl -- a triangle in the cursor, and every letter then
* sent as a control character -- without the volume changing, so a user
* turning the volume down found the terminal no longer typed.
*/
public class VolumeKeyDefaultsTest {
private static String defaultOf(String xml, String name) {
Matcher m = Pattern.compile("<string name=\"" + name + "\"[^>]*>([^<]*)</string>").matcher(xml);
if (!m.find()) throw new AssertionError(name + " missing");
return m.group(1);
}

@Test
public void noKeyIsAModifierByDefault() throws Exception {
File here = new File("").getAbsoluteFile();
File repo = new File(here, "third_party").isDirectory() ? here : here.getParentFile();
String xml = new String(Files.readAllBytes(
new File(repo, "garden-common/src/main/res/values/defaults.xml").toPath()), StandardCharsets.UTF_8);
assertEquals(TermSettings.CONTROL_KEY_ID_NONE, Integer.parseInt(defaultOf(xml, "pref_controlkey_default")));
assertEquals(TermSettings.FN_KEY_ID_NONE, Integer.parseInt(defaultOf(xml, "pref_fnkey_default")));
}
}
4 changes: 2 additions & 2 deletions garden-common/thothdock/thothdock.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ThothDock pins (see tools/stage-thothdock.sh). Both programs are built from
# source at exactly these commits; nothing is downloaded during the build.

# github.com/Lord1Egypt/ThothDock v0.3.0 (submodule third_party/thothdock), Apache-2.0.
# github.com/Lord1Egypt/ThothDock v0.3.1 (submodule third_party/thothdock), Apache-2.0.
# The daemon's only dependency, golang.org/x/sys, is vendored in that tree.
thothdockCommit=e4601a3
thothdockCommit=631c67f
# Lowest Go toolchain accepted (GOTOOLCHAIN=local: Go never fetches another).
goMinVersion=1.26.0

Expand Down
5 changes: 3 additions & 2 deletions garden-debian/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ android {

vectorDrawables.useSupportLibrary = true

// 0.5.3: ThothDock engine 0.3.1 (snap downloads resume, store aliases, squashfs-tools and flatpak set up on first use, snapd guarded); volume keys are no longer Ctrl/Fn by default.
// 0.5.2: swipes reach full-screen TUIs as mouse wheel events (OpenCode), SGR mouse reports.
// 0.5.1: /proc/stat and /proc/uptime stand-ins (ps -o lstart, Codex's background server).
// 0.5.0: ThothDock engine 0.3.0 (Flatpak sandboxes, snap command, Apps screen), 24-bit terminal colours.
// 0.4.2: store listing only (ThothDock icon, current screenshots, store text); same code and engine as 0.4.1.
// 0.4.1: ThothDock engine 0.2.1 (System V IPC, hostname, long Unix sockets; PRoot patches 0010-0018). (0.4.0 was 400.)
// 0.4.0: ThothTerm (bullet) ThothDock (package com.thothterm.debian), ThothDock engine 0.2.0 (NextGen). (0.3.1 was 301.)
versionCode 502
versionName '0.5.2'
versionCode 503
versionName '0.5.3'

// Device tests (the pinch gesture and garden-common's shared tests);
// run with `am instrument` against the installed app, never
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
snap: downloads show progress, survive a slow or dropped connection and continue where they stopped; store aliases such as gcloud are set up; squashfs-tools is installed by itself. flatpak installs itself and adds Flathub on first use, and sudo flatpak works. apt install snapd can no longer replace ThothDock's snap. The volume keys no longer act as Ctrl and Fn by default: pressing Volume Down twice used to lock Ctrl and stop typing.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void storeTextFitsFdroidLimits() throws Exception {
assertTrue(read(dir + "title.txt").trim().length() <= 50);
assertTrue(read(dir + "short_description.txt").trim().length() <= 80);
assertTrue(read(dir + "full_description.txt").length() <= 4000);
for (String code : new String[]{"301", "400", "401", "402", "500", "501", "502"}) {
for (String code : new String[]{"301", "400", "401", "402", "500", "501", "502", "503"}) {
assertTrue(code, read(dir + "changelogs/" + code + ".txt").length() <= 500);
}
}
Expand Down
Loading