Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b64ef21831 | ||
|
|
e077fa5d14 | ||
|
|
d655fd7e09 | ||
|
|
4c5cd385b7 | ||
|
|
3174b77923 | ||
|
|
226f2e781b | ||
|
|
f35595706e | ||
|
|
5d821de7f7 | ||
|
|
eb646cc0d9 | ||
|
|
46b94ebdad | ||
|
|
72780eb98f | ||
|
|
e9615cb8fe | ||
|
|
9e3e6d99cc | ||
|
|
fc673a0df9 | ||
|
|
e144c1d3fb | ||
|
|
90db1dc04c | ||
|
|
e47c8c15d4 | ||
|
|
85469dae4b |
+53
-146
@@ -1,160 +1,67 @@
|
|||||||
name: Android APK
|
name: Gitea Android APK
|
||||||
|
|
||||||
on:
|
on: [push]
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
pull_request:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
publish_release:
|
|
||||||
description: "Create or update a GitHub Release"
|
|
||||||
required: true
|
|
||||||
default: "false"
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- "false"
|
|
||||||
- "true"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
PUBLISH_RELEASE: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') || inputs.publish_release == 'true' }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
|
|
||||||
VERSION_NAME="${GITHUB_REF_NAME#v}"
|
|
||||||
else
|
|
||||||
VERSION_NAME="0.1.${GITHUB_RUN_NUMBER}"
|
|
||||||
fi
|
|
||||||
VERSION_CODE=$((1000 + GITHUB_RUN_NUMBER))
|
|
||||||
echo "VERSION_NAME=${VERSION_NAME}" >> "${GITHUB_ENV}"
|
|
||||||
echo "VERSION_CODE=${VERSION_CODE}" >> "${GITHUB_ENV}"
|
|
||||||
|
|
||||||
- name: Set up JDK
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: temurin
|
|
||||||
java-version: "17"
|
|
||||||
|
|
||||||
- name: Set up Android SDK
|
|
||||||
uses: android-actions/setup-android@v3
|
|
||||||
|
|
||||||
- name: Install Android packages
|
|
||||||
shell: bash
|
|
||||||
run: sdkmanager "platforms;android-35" "build-tools;35.0.0" "platform-tools"
|
|
||||||
|
|
||||||
- name: Set up Gradle
|
|
||||||
uses: gradle/actions/setup-gradle@v4
|
|
||||||
with:
|
|
||||||
gradle-version: "8.10.2"
|
|
||||||
|
|
||||||
- name: Configure signing
|
|
||||||
id: signing
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
||||||
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
||||||
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
||||||
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
||||||
run: |
|
|
||||||
if [[ -z "${ANDROID_KEYSTORE_BASE64}" ]]; then
|
|
||||||
echo "signed=false" >> "${GITHUB_OUTPUT}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "${ANDROID_KEYSTORE_BASE64}" | base64 -d > release.jks
|
|
||||||
{
|
|
||||||
echo "storeFile=release.jks"
|
|
||||||
echo "storePassword=${ANDROID_KEYSTORE_PASSWORD}"
|
|
||||||
echo "keyAlias=${ANDROID_KEY_ALIAS}"
|
|
||||||
echo "keyPassword=${ANDROID_KEY_PASSWORD}"
|
|
||||||
} > signing.properties
|
|
||||||
echo "signed=true" >> "${GITHUB_OUTPUT}"
|
|
||||||
|
|
||||||
- name: Build APK
|
- name: Build APK
|
||||||
shell: bash
|
env:
|
||||||
|
CLONE_TOKEN: ${{ secrets.TMUX_GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ steps.signing.outputs.signed }}" == "true" ]]; then
|
set -eu
|
||||||
BUILD_TASK=":app:assembleRelease"
|
|
||||||
else
|
if ! command -v git >/dev/null 2>&1 || ! command -v curl >/dev/null 2>&1 || ! command -v unzip >/dev/null 2>&1; then
|
||||||
BUILD_TASK=":app:assembleDebug"
|
apt-get update
|
||||||
|
apt-get install -y git curl unzip
|
||||||
fi
|
fi
|
||||||
gradle "${BUILD_TASK}" \
|
if ! command -v java >/dev/null 2>&1; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y openjdk-17-jdk-headless
|
||||||
|
fi
|
||||||
|
java -version
|
||||||
|
|
||||||
|
WORKDIR="${PWD}/source"
|
||||||
|
rm -rf "${WORKDIR}"
|
||||||
|
SERVER_URL="${GITHUB_SERVER_URL:-https://gitea.neatcn.com}"
|
||||||
|
REPOSITORY="${GITHUB_REPOSITORY:-tmux/tmux-browser-android}"
|
||||||
|
AUTH_SERVER_URL="$(printf '%s' "${SERVER_URL}" | sed "s#https://#https://gouki:${CLONE_TOKEN}@#")"
|
||||||
|
git clone "${AUTH_SERVER_URL}/${REPOSITORY}.git" "${WORKDIR}"
|
||||||
|
cd "${WORKDIR}"
|
||||||
|
git checkout "${GITHUB_SHA:-main}"
|
||||||
|
|
||||||
|
export GRADLE_HOME="${PWD}/.ci/gradle-8.10.2"
|
||||||
|
mkdir -p .ci
|
||||||
|
if [ ! -x "${GRADLE_HOME}/bin/gradle" ]; then
|
||||||
|
curl -fsSL -o .ci/gradle.zip https://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
|
unzip -q .ci/gradle.zip -d .ci
|
||||||
|
fi
|
||||||
|
export PATH="${GRADLE_HOME}/bin:${PATH}"
|
||||||
|
|
||||||
|
export ANDROID_HOME="${PWD}/.ci/android-sdk"
|
||||||
|
export ANDROID_SDK_ROOT="${ANDROID_HOME}"
|
||||||
|
export CMDLINE_TOOLS="${ANDROID_HOME}/cmdline-tools/latest"
|
||||||
|
if [ ! -x "${CMDLINE_TOOLS}/bin/sdkmanager" ]; then
|
||||||
|
mkdir -p "${ANDROID_HOME}/cmdline-tools"
|
||||||
|
curl -fsSL -o .ci/android-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||||
|
unzip -q .ci/android-tools.zip -d "${ANDROID_HOME}/cmdline-tools"
|
||||||
|
mv "${ANDROID_HOME}/cmdline-tools/cmdline-tools" "${CMDLINE_TOOLS}"
|
||||||
|
fi
|
||||||
|
export PATH="${CMDLINE_TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}"
|
||||||
|
|
||||||
|
yes | sdkmanager --licenses >/dev/null || true
|
||||||
|
sdkmanager "platforms;android-35" "build-tools;35.0.0" "platform-tools"
|
||||||
|
|
||||||
|
VERSION_NAME="0.1.${GITHUB_RUN_NUMBER:-0}"
|
||||||
|
VERSION_CODE=$((2000 + ${GITHUB_RUN_NUMBER:-0}))
|
||||||
|
gradle :app:assembleDebug \
|
||||||
-PversionCode="${VERSION_CODE}" \
|
-PversionCode="${VERSION_CODE}" \
|
||||||
-PversionName="${VERSION_NAME}" \
|
-PversionName="${VERSION_NAME}" \
|
||||||
-PrepoSlug="${GITHUB_REPOSITORY}"
|
-PrepoSlug="neatstudio/tmux-browser-android"
|
||||||
|
|
||||||
- name: Prepare artifacts
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
APK_PATH="$(find app/build/outputs/apk -name '*.apk' | sort | tail -n 1)"
|
APK_PATH="$(find app/build/outputs/apk -name '*.apk' | sort | tail -n 1)"
|
||||||
cp "${APK_PATH}" "release/tmux-android.apk"
|
cp "${APK_PATH}" release/tmux-android-gitea.apk
|
||||||
cp "${APK_PATH}" "release/tmux-android-${VERSION_NAME}.apk"
|
ls -lh release/tmux-android-gitea.apk
|
||||||
SHA256="$(sha256sum release/tmux-android.apk | awk '{print $1}')"
|
sha256sum release/tmux-android-gitea.apk
|
||||||
APK_URL="https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/tmux-android.apk"
|
|
||||||
RELEASE_PAGE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/latest"
|
|
||||||
cat > release/latest.json << JSON
|
|
||||||
{
|
|
||||||
"versionCode": ${VERSION_CODE},
|
|
||||||
"versionName": "${VERSION_NAME}",
|
|
||||||
"apkUrl": "${APK_URL}",
|
|
||||||
"sha256": "${SHA256}",
|
|
||||||
"releasePageUrl": "${RELEASE_PAGE_URL}",
|
|
||||||
"minSdk": 26
|
|
||||||
}
|
|
||||||
JSON
|
|
||||||
|
|
||||||
- name: Upload workflow artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: tmux-android-${{ env.VERSION_NAME }}
|
|
||||||
path: |
|
|
||||||
release/tmux-android.apk
|
|
||||||
release/tmux-android-${{ env.VERSION_NAME }}.apk
|
|
||||||
release/latest.json
|
|
||||||
|
|
||||||
- name: Require signing for release publishing
|
|
||||||
if: env.PUBLISH_RELEASE == 'true' && steps.signing.outputs.signed != 'true'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "Release publishing requires ANDROID_KEYSTORE_BASE64 and signing secrets." >&2
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
- name: Publish GitHub Release
|
|
||||||
if: env.PUBLISH_RELEASE == 'true'
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
|
|
||||||
TAG="${GITHUB_REF_NAME}"
|
|
||||||
else
|
|
||||||
TAG="v${VERSION_NAME}"
|
|
||||||
git config user.name "github-actions[bot]"
|
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
||||||
git tag -f "${TAG}"
|
|
||||||
git push -f origin "${TAG}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if gh release view "${TAG}" >/dev/null 2>&1; then
|
|
||||||
gh release upload "${TAG}" release/tmux-android.apk release/latest.json --clobber
|
|
||||||
else
|
|
||||||
gh release create "${TAG}" release/tmux-android.apk release/latest.json \
|
|
||||||
--latest \
|
|
||||||
--title "tmux Android ${VERSION_NAME}" \
|
|
||||||
--notes "Android APK for tmux-ui remote testing."
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ APIs directly:
|
|||||||
- server URL management for Tailscale `100.x.y.z:3000` APIs
|
- server URL management for Tailscale `100.x.y.z:3000` APIs
|
||||||
- quick server selectors for `100.89.0.2`, `100.89.0.4`, `100.89.0.9`,
|
- quick server selectors for `100.89.0.2`, `100.89.0.4`, `100.89.0.9`,
|
||||||
`100.89.0.11`, and `100.89.0.116`
|
`100.89.0.11`, and `100.89.0.116`
|
||||||
|
- one-tap probe for the preset Tailscale APIs, showing health/version and
|
||||||
|
session counts
|
||||||
- native tmux session list
|
- native tmux session list
|
||||||
- create, rename, send command, split pane, select pane, kill pane, pin, mute,
|
- create, rename, send command, split pane, select pane, kill pane, pin, mute,
|
||||||
and kill session through HTTP API
|
and kill session through HTTP API
|
||||||
@@ -18,7 +20,8 @@ APIs directly:
|
|||||||
- native API action center for health, server status, timeline, preferences,
|
- native API action center for health, server status, timeline, preferences,
|
||||||
kanban projects, group messages, hook events, image file/URL upload, image
|
kanban projects, group messages, hook events, image file/URL upload, image
|
||||||
preview info, and native image preview display
|
preview info, and native image preview display
|
||||||
- mobile soft-key row for tmux-oriented input
|
- mobile soft-key row for tmux-oriented input, including tmux prefix, detach,
|
||||||
|
new window, previous/next window, Ctrl keys, arrows, page keys, and paste
|
||||||
- automatic update checks against a GitHub Release manifest
|
- automatic update checks against a GitHub Release manifest
|
||||||
- APK download, SHA-256 verification, and installer handoff
|
- APK download, SHA-256 verification, and installer handoff
|
||||||
|
|
||||||
@@ -77,10 +80,13 @@ Publish a test build by pushing a `v*` tag. That creates a GitHub Release with:
|
|||||||
```text
|
```text
|
||||||
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/tmux-android.apk
|
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/tmux-android.apk
|
||||||
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/latest.json
|
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/latest.json
|
||||||
https://gitea.neatcn.com/tmux/tmux-browser-android/releases/latest/download/tmux-android.apk
|
|
||||||
https://gitea.neatcn.com/tmux/tmux-browser-android/releases/latest/download/latest.json
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Those GitHub links are the stable public install/update channel. Gitea releases
|
||||||
|
are mirrored for internal tracking, but the current Gitea org/repo visibility
|
||||||
|
keeps anonymous release downloads behind login, so phones should use GitHub for
|
||||||
|
no-login install and in-app updates.
|
||||||
|
|
||||||
Plain branch builds only create Actions artifacts; they are useful for CI
|
Plain branch builds only create Actions artifacts; they are useful for CI
|
||||||
verification, but releases are the stable download/update channel.
|
verification, but releases are the stable download/update channel.
|
||||||
|
|
||||||
@@ -98,6 +104,10 @@ escape filtering. It is enough for shell-oriented remote testing, but it is not
|
|||||||
yet a complete xterm-compatible renderer for full-screen TUIs such as `vim` or
|
yet a complete xterm-compatible renderer for full-screen TUIs such as `vim` or
|
||||||
`top`.
|
`top`.
|
||||||
|
|
||||||
|
The terminal toolbar and shortcut row include tmux prefix helpers. The app sends
|
||||||
|
the same control bytes a keyboard would send, for example `Ctrl+B`, `Ctrl+B d`,
|
||||||
|
`Ctrl+B c`, `Ctrl+B n`, and `Ctrl+B p`.
|
||||||
|
|
||||||
All app features are native Android controls. Complex server objects such as
|
All app features are native Android controls. Complex server objects such as
|
||||||
kanban projects, preferences, timeline events, group messages, and image metadata
|
kanban projects, preferences, timeline events, group messages, and image metadata
|
||||||
currently use native forms plus native JSON detail dialogs; image preview uses a
|
currently use native forms plus native JSON detail dialogs; image preview uses a
|
||||||
@@ -126,13 +136,26 @@ The default update manifest is:
|
|||||||
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/latest.json
|
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/latest.json
|
||||||
```
|
```
|
||||||
|
|
||||||
The Gitea mirror is:
|
The public manual APK download is:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
https://gitea.neatcn.com/tmux/tmux-browser-android/releases/latest/download/latest.json
|
https://github.com/neatstudio/tmux-browser-android/releases/latest/download/tmux-android.apk
|
||||||
```
|
```
|
||||||
|
|
||||||
The app tries the selected update source first, then falls back to the GitHub
|
The app tries the selected update source first, then falls back to the GitHub
|
||||||
and Gitea mirrors.
|
manifest and the Gitea release API. GitHub is the reliable no-login source today.
|
||||||
|
The Gitea API endpoint is:
|
||||||
|
|
||||||
The workflow uploads both the APK and `latest.json` to each release.
|
```text
|
||||||
|
https://gitea.neatcn.com/api/v1/repos/tmux/tmux-browser-android/releases/latest
|
||||||
|
```
|
||||||
|
|
||||||
|
In the app:
|
||||||
|
|
||||||
|
- Tap `Update` on the main screen to check `latest.json`, download the APK,
|
||||||
|
verify SHA-256, and open Android's installer.
|
||||||
|
- Open `More` -> `Open APK download` to download the current public APK in a
|
||||||
|
browser.
|
||||||
|
- Open `More` -> `Permissions / update status` to see the installed version,
|
||||||
|
update manifest, APK URL, install permission state, and a `Check update`
|
||||||
|
button.
|
||||||
|
|||||||
@@ -5,13 +5,17 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val repoSlug = providers.gradleProperty("repoSlug")
|
val repoSlug = providers.gradleProperty("repoSlug")
|
||||||
.orElse("neatstudio/tmux-android")
|
.orElse("neatstudio/tmux-browser-android")
|
||||||
val defaultServerUrl = providers.gradleProperty("defaultServerUrl")
|
val defaultServerUrl = providers.gradleProperty("defaultServerUrl")
|
||||||
.orElse("http://100.89.0.116:3000")
|
.orElse("http://100.89.0.116:3000")
|
||||||
val defaultUpdateUrl = providers.gradleProperty("defaultUpdateUrl")
|
val defaultUpdateUrl = providers.gradleProperty("defaultUpdateUrl")
|
||||||
.orElse("https://github.com/${repoSlug.get()}/releases/latest/download/latest.json")
|
.orElse("https://github.com/${repoSlug.get()}/releases/latest/download/latest.json")
|
||||||
val defaultGiteaUpdateUrl = providers.gradleProperty("defaultGiteaUpdateUrl")
|
val defaultGiteaUpdateUrl = providers.gradleProperty("defaultGiteaUpdateUrl")
|
||||||
.orElse("https://gitea.neatcn.com/tmux/tmux-browser-android/releases/latest/download/latest.json")
|
.orElse("https://gitea.neatcn.com/api/v1/repos/tmux/tmux-browser-android/releases/latest")
|
||||||
|
val defaultApkUrl = providers.gradleProperty("defaultApkUrl")
|
||||||
|
.orElse("https://github.com/${repoSlug.get()}/releases/latest/download/tmux-android.apk")
|
||||||
|
val defaultReleasePageUrl = providers.gradleProperty("defaultReleasePageUrl")
|
||||||
|
.orElse("https://github.com/${repoSlug.get()}/releases/latest")
|
||||||
|
|
||||||
val signingProps = Properties()
|
val signingProps = Properties()
|
||||||
val signingFile = rootProject.file("signing.properties")
|
val signingFile = rootProject.file("signing.properties")
|
||||||
@@ -33,6 +37,8 @@ android {
|
|||||||
buildConfigField("String", "DEFAULT_SERVER_URL", "\"${defaultServerUrl.get()}\"")
|
buildConfigField("String", "DEFAULT_SERVER_URL", "\"${defaultServerUrl.get()}\"")
|
||||||
buildConfigField("String", "DEFAULT_UPDATE_URL", "\"${defaultUpdateUrl.get()}\"")
|
buildConfigField("String", "DEFAULT_UPDATE_URL", "\"${defaultUpdateUrl.get()}\"")
|
||||||
buildConfigField("String", "DEFAULT_GITEA_UPDATE_URL", "\"${defaultGiteaUpdateUrl.get()}\"")
|
buildConfigField("String", "DEFAULT_GITEA_UPDATE_URL", "\"${defaultGiteaUpdateUrl.get()}\"")
|
||||||
|
buildConfigField("String", "DEFAULT_APK_URL", "\"${defaultApkUrl.get()}\"")
|
||||||
|
buildConfigField("String", "DEFAULT_RELEASE_PAGE_URL", "\"${defaultReleasePageUrl.get()}\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.neatstudio.tmuxandroid;
|
|||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -446,6 +447,7 @@ public final class MainActivity extends Activity {
|
|||||||
private void showMainActions() {
|
private void showMainActions() {
|
||||||
String[] items = {
|
String[] items = {
|
||||||
"Health",
|
"Health",
|
||||||
|
"Probe Tailscale APIs",
|
||||||
"Server status",
|
"Server status",
|
||||||
"Timeline",
|
"Timeline",
|
||||||
"Preferences",
|
"Preferences",
|
||||||
@@ -463,6 +465,7 @@ public final class MainActivity extends Activity {
|
|||||||
"Upload image URL",
|
"Upload image URL",
|
||||||
"Image preview info",
|
"Image preview info",
|
||||||
"Open image preview",
|
"Open image preview",
|
||||||
|
"Open APK download",
|
||||||
"Update source",
|
"Update source",
|
||||||
"Permissions / update status"
|
"Permissions / update status"
|
||||||
};
|
};
|
||||||
@@ -474,60 +477,66 @@ public final class MainActivity extends Activity {
|
|||||||
showRaw("Health", () -> api.health());
|
showRaw("Health", () -> api.health());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
showRaw("Server status", () -> api.serverStatus());
|
probeServerProfiles();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
showRaw("Timeline", () -> api.timeline(50));
|
showRaw("Server status", () -> api.serverStatus());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
showRaw("Preferences", () -> api.preferences());
|
showRaw("Timeline", () -> api.timeline(50));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
showRaw("All session details", () -> api.sessionsAll());
|
showRaw("Preferences", () -> api.preferences());
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
showRaw("Pane details", () -> api.sessionsPanes());
|
showRaw("All session details", () -> api.sessionsAll());
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
showRaw("Kanban projects", () -> api.kanbanProjects());
|
showRaw("Pane details", () -> api.sessionsPanes());
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
promptCreateKanbanProject();
|
showRaw("Kanban projects", () -> api.kanbanProjects());
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
promptDeleteKanbanProject();
|
promptCreateKanbanProject();
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
promptRemoveKanbanSession();
|
promptDeleteKanbanProject();
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
promptGroupMessages();
|
promptRemoveKanbanSession();
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
promptSendGroupMessage();
|
promptGroupMessages();
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
promptScanGroupMessage();
|
promptSendGroupMessage();
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
promptPostHookEvent();
|
promptScanGroupMessage();
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
promptUploadImageFile();
|
promptPostHookEvent();
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
promptUploadImageUrl();
|
promptUploadImageFile();
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
promptImagePreviewInfo();
|
promptUploadImageUrl();
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
promptOpenImagePreview();
|
promptImagePreviewInfo();
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
showUpdateSourcePicker();
|
promptOpenImagePreview();
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
|
openExternalUrl(BuildConfig.DEFAULT_APK_URL);
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
showUpdateSourcePicker();
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
showPermissionsAndUpdateStatus();
|
showPermissionsAndUpdateStatus();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -615,7 +624,12 @@ public final class MainActivity extends Activity {
|
|||||||
"Page up",
|
"Page up",
|
||||||
"Page down",
|
"Page down",
|
||||||
"Session status",
|
"Session status",
|
||||||
"Send command"
|
"Send command",
|
||||||
|
"Tmux prefix",
|
||||||
|
"Detach tmux client",
|
||||||
|
"New tmux window",
|
||||||
|
"Next tmux window",
|
||||||
|
"Previous tmux window"
|
||||||
};
|
};
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle(sessionName)
|
.setTitle(sessionName)
|
||||||
@@ -650,6 +664,21 @@ public final class MainActivity extends Activity {
|
|||||||
case 6:
|
case 6:
|
||||||
promptSendCommand(sessionName);
|
promptSendCommand(sessionName);
|
||||||
break;
|
break;
|
||||||
|
case 7:
|
||||||
|
sendTerminalInput("\u0002");
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
sendTerminalInput("\u0002d");
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
sendTerminalInput("\u0002c");
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
sendTerminalInput("\u0002n");
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
sendTerminalInput("\u0002p");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -914,12 +943,28 @@ public final class MainActivity extends Activity {
|
|||||||
|
|
||||||
private void showPermissionsAndUpdateStatus() {
|
private void showPermissionsAndUpdateStatus() {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
|
text.append("Installed app: ")
|
||||||
|
.append(BuildConfig.VERSION_NAME)
|
||||||
|
.append(" (")
|
||||||
|
.append(BuildConfig.VERSION_CODE)
|
||||||
|
.append(")\n");
|
||||||
text.append("Server: ").append(getServerUrl()).append('\n');
|
text.append("Server: ").append(getServerUrl()).append('\n');
|
||||||
text.append("Selected update manifest: ")
|
text.append('\n');
|
||||||
|
text.append("Manual APK download:\n")
|
||||||
|
.append(BuildConfig.DEFAULT_APK_URL)
|
||||||
|
.append('\n');
|
||||||
|
text.append("Release page:\n")
|
||||||
|
.append(BuildConfig.DEFAULT_RELEASE_PAGE_URL)
|
||||||
|
.append('\n');
|
||||||
|
text.append('\n');
|
||||||
|
text.append("In-app update:\n");
|
||||||
|
text.append("Tap Update. The app reads latest.json, downloads the APK, verifies SHA-256, then opens Android's installer.\n");
|
||||||
|
text.append("Selected manifest:\n")
|
||||||
.append(prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL))
|
.append(prefs.getString("update_url", BuildConfig.DEFAULT_UPDATE_URL))
|
||||||
.append('\n');
|
.append('\n');
|
||||||
text.append("GitHub mirror: ").append(BuildConfig.DEFAULT_UPDATE_URL).append('\n');
|
text.append("GitHub manifest:\n").append(BuildConfig.DEFAULT_UPDATE_URL).append('\n');
|
||||||
text.append("Gitea mirror: ").append(BuildConfig.DEFAULT_GITEA_UPDATE_URL).append('\n');
|
text.append("Gitea release API:\n").append(BuildConfig.DEFAULT_GITEA_UPDATE_URL).append('\n');
|
||||||
|
text.append('\n');
|
||||||
text.append("Network: manifest permission, no runtime grant required\n");
|
text.append("Network: manifest permission, no runtime grant required\n");
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
text.append("Install unknown apps: ")
|
text.append("Install unknown apps: ")
|
||||||
@@ -942,10 +987,18 @@ public final class MainActivity extends Activity {
|
|||||||
.setMessage(text.toString())
|
.setMessage(text.toString())
|
||||||
.setNegativeButton("Close", null)
|
.setNegativeButton("Close", null)
|
||||||
.setNeutralButton("Install permission", (dialog, which) -> openInstallPermissionSettings())
|
.setNeutralButton("Install permission", (dialog, which) -> openInstallPermissionSettings())
|
||||||
.setPositiveButton("Notify permission", (dialog, which) -> requestNotificationPermission())
|
.setPositiveButton("Check update", (dialog, which) -> updateManager.check(true))
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openExternalUrl(String url) {
|
||||||
|
try {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
|
||||||
|
} catch (ActivityNotFoundException error) {
|
||||||
|
showMessage("No app can open URL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void showUpdateSourcePicker() {
|
private void showUpdateSourcePicker() {
|
||||||
String[] items = {
|
String[] items = {
|
||||||
"GitHub: " + BuildConfig.DEFAULT_UPDATE_URL,
|
"GitHub: " + BuildConfig.DEFAULT_UPDATE_URL,
|
||||||
@@ -971,6 +1024,36 @@ public final class MainActivity extends Activity {
|
|||||||
showMessage("Update source: " + url);
|
showMessage("Update source: " + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void probeServerProfiles() {
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
setStatus("Probing Tailscale APIs...");
|
||||||
|
executor.execute(() -> {
|
||||||
|
StringBuilder text = new StringBuilder();
|
||||||
|
for (String url : SERVER_PROFILES) {
|
||||||
|
text.append(url).append('\n');
|
||||||
|
try {
|
||||||
|
SessionApiClient client = new SessionApiClient(url);
|
||||||
|
JSONObject health = new JSONObject(client.health());
|
||||||
|
List<SessionSummary> sessions = client.getSessions();
|
||||||
|
text.append(" ok: true\n");
|
||||||
|
text.append(" version: ")
|
||||||
|
.append(health.optString("version", "unknown"))
|
||||||
|
.append(" ")
|
||||||
|
.append(health.optString("commit", ""))
|
||||||
|
.append('\n');
|
||||||
|
text.append(" sessions: ").append(sessions.size()).append('\n');
|
||||||
|
} catch (Exception error) {
|
||||||
|
text.append(" failed: ").append(error.getMessage()).append('\n');
|
||||||
|
}
|
||||||
|
text.append('\n');
|
||||||
|
}
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
progressBar.setVisibility(View.GONE);
|
||||||
|
showTextDialog("Tailscale APIs", text.toString());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void openInstallPermissionSettings() {
|
private void openInstallPermissionSettings() {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||||
showMessage("Install permission is allowed on this Android version");
|
showMessage("Install permission is allowed on this Android version");
|
||||||
@@ -1140,6 +1223,13 @@ public final class MainActivity extends Activity {
|
|||||||
addSoftKey(row, "^A", "\u0001");
|
addSoftKey(row, "^A", "\u0001");
|
||||||
addSoftKey(row, "^E", "\u0005");
|
addSoftKey(row, "^E", "\u0005");
|
||||||
addSoftKey(row, "^V", "\u0016");
|
addSoftKey(row, "^V", "\u0016");
|
||||||
|
addSoftKey(row, "^Z", "\u001a");
|
||||||
|
addSoftKey(row, "^\\", "\u001c");
|
||||||
|
addSoftKey(row, "Tmux", "\u0002");
|
||||||
|
addSoftKey(row, "Detach", "\u0002d");
|
||||||
|
addSoftKey(row, "NewWin", "\u0002c");
|
||||||
|
addSoftKey(row, "NextWin", "\u0002n");
|
||||||
|
addSoftKey(row, "PrevWin", "\u0002p");
|
||||||
addSoftKey(row, "Left", "\u001b[D");
|
addSoftKey(row, "Left", "\u001b[D");
|
||||||
addSoftKey(row, "Down", "\u001b[B");
|
addSoftKey(row, "Down", "\u001b[B");
|
||||||
addSoftKey(row, "Up", "\u001b[A");
|
addSoftKey(row, "Up", "\u001b[A");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.os.Build;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -103,6 +104,9 @@ final class UpdateManager {
|
|||||||
private ReleaseInfo fetchReleaseInfo(String manifestUrl) throws Exception {
|
private ReleaseInfo fetchReleaseInfo(String manifestUrl) throws Exception {
|
||||||
String json = readText(manifestUrl);
|
String json = readText(manifestUrl);
|
||||||
JSONObject root = new JSONObject(json);
|
JSONObject root = new JSONObject(json);
|
||||||
|
if (root.has("assets") && root.has("tag_name")) {
|
||||||
|
return fetchReleaseInfoFromReleaseApi(root);
|
||||||
|
}
|
||||||
return new ReleaseInfo(
|
return new ReleaseInfo(
|
||||||
root.getInt("versionCode"),
|
root.getInt("versionCode"),
|
||||||
root.optString("versionName", ""),
|
root.optString("versionName", ""),
|
||||||
@@ -112,6 +116,40 @@ final class UpdateManager {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ReleaseInfo fetchReleaseInfoFromReleaseApi(JSONObject release) throws Exception {
|
||||||
|
JSONArray assets = release.getJSONArray("assets");
|
||||||
|
String manifestUrl = findAssetUrl(assets, "latest.json");
|
||||||
|
String apkUrl = findAssetUrl(assets, "tmux-android.apk");
|
||||||
|
if (manifestUrl.isEmpty()) {
|
||||||
|
throw new IllegalStateException("Release has no latest.json");
|
||||||
|
}
|
||||||
|
ReleaseInfo info = fetchReleaseInfo(manifestUrl);
|
||||||
|
if (apkUrl.isEmpty()) {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
return new ReleaseInfo(
|
||||||
|
info.versionCode,
|
||||||
|
info.versionName,
|
||||||
|
apkUrl,
|
||||||
|
info.sha256,
|
||||||
|
release.optString("html_url", info.releasePageUrl)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String findAssetUrl(JSONArray assets, String name) {
|
||||||
|
for (int index = 0; index < assets.length(); index++) {
|
||||||
|
JSONObject asset = assets.optJSONObject(index);
|
||||||
|
if (asset == null || !name.equals(asset.optString("name"))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String url = asset.optString("browser_download_url", "");
|
||||||
|
if (!url.isEmpty()) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
private String readText(String url) throws Exception {
|
private String readText(String url) throws Exception {
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||||
connection.setConnectTimeout(12000);
|
connection.setConnectTimeout(12000);
|
||||||
|
|||||||
@@ -68,14 +68,15 @@ not kill a tmux session.
|
|||||||
|
|
||||||
Implemented now:
|
Implemented now:
|
||||||
|
|
||||||
- configurable base URL, defaulting to `http://127.0.0.1:3000`
|
- configurable base URL, defaulting to `http://100.89.0.116:3000`
|
||||||
- support for Tailscale URLs such as `http://100.x.y.z:3000`
|
- support for Tailscale URLs such as `http://100.x.y.z:3000`
|
||||||
- native session list from `GET /api/sessions`
|
- native session list from `GET /api/sessions`
|
||||||
- create, rename, command send, split, pane select, pane kill, pin, mute, and
|
- create, rename, command send, split, pane select, pane kill, pin, mute, and
|
||||||
kill session through documented session/preference endpoints
|
kill session through documented session/preference endpoints
|
||||||
- basic live terminal through `/ws/terminal`
|
- basic live terminal through `/ws/terminal`
|
||||||
- native event stream through `/ws/events`
|
- native event stream through `/ws/events`
|
||||||
- bottom shortcut bar for `Esc`, `Tab`, `Ctrl+C`, arrows, page keys, and paste
|
- bottom shortcut bar for `Esc`, `Tab`, `Ctrl+C`, `Ctrl+V`, arrows, page keys,
|
||||||
|
tmux prefix actions, and paste
|
||||||
- shortcut delivery through the terminal WebSocket `input` message
|
- shortcut delivery through the terminal WebSocket `input` message
|
||||||
- native action center for health, server status, timeline, preferences, kanban
|
- native action center for health, server status, timeline, preferences, kanban
|
||||||
projects, group messages, hook events, image file/URL upload, image preview
|
projects, group messages, hook events, image file/URL upload, image preview
|
||||||
|
|||||||
Reference in New Issue
Block a user