Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a73aaf629 |
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"versionName": "0.5.27",
|
||||||
|
"versionCode": 47
|
||||||
|
}
|
||||||
@@ -71,6 +71,11 @@
|
|||||||
I've installed it
|
I've installed it
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Which version the Download button installs — read from the
|
||||||
|
metadata staged beside the APK; absent file, absent note -->
|
||||||
|
<p v-if="companionVersion" class="text-xs text-white/40 text-center mt-3">
|
||||||
|
Version {{ companionVersion.versionName }}<template v-if="companionVersion.versionCode"> (build {{ companionVersion.versionCode }})</template>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Screen 2: pair the app with this node -->
|
<!-- Screen 2: pair the app with this node -->
|
||||||
@@ -153,6 +158,22 @@ const DEFAULT_DOWNLOAD_URL = IS_DEMO
|
|||||||
? `${window.location.origin}/packages/archipelago-companion.apk`
|
? `${window.location.origin}/packages/archipelago-companion.apk`
|
||||||
: 'https://source.archipelago-foundation.org/packages/archipelago-companion.apk'
|
: 'https://source.archipelago-foundation.org/packages/archipelago-companion.apk'
|
||||||
|
|
||||||
|
// Version note for the download step. Read from the node's own copy of the
|
||||||
|
// metadata (ships in the frontend beside the APK at /packages/), written by
|
||||||
|
// publish-companion-apk.sh from the same gradle config that built the APK.
|
||||||
|
// Best-effort: no file, no note.
|
||||||
|
const companionVersion = ref<{ versionName: string; versionCode: number } | null>(null)
|
||||||
|
async function loadCompanionVersion() {
|
||||||
|
try {
|
||||||
|
const res = await fetch('/packages/archipelago-companion.json', { cache: 'no-store' })
|
||||||
|
if (!res.ok) return
|
||||||
|
const meta = await res.json()
|
||||||
|
if (meta && typeof meta.versionName === 'string' && meta.versionName) {
|
||||||
|
companionVersion.value = { versionName: meta.versionName, versionCode: Number(meta.versionCode) || 0 }
|
||||||
|
}
|
||||||
|
} catch { /* metadata is a nicety — the download works without it */ }
|
||||||
|
}
|
||||||
|
|
||||||
// Deep-link scheme the companion app registers; carries the server entry the
|
// Deep-link scheme the companion app registers; carries the server entry the
|
||||||
// app should create (see docs/companion-pairing-qr.md for the contract).
|
// app should create (see docs/companion-pairing-qr.md for the contract).
|
||||||
const PAIR_SCHEME = 'archipelago://pair'
|
const PAIR_SCHEME = 'archipelago://pair'
|
||||||
@@ -239,6 +260,7 @@ watch(companionIntroRequested, (requested) => {
|
|||||||
|
|
||||||
watch(visible, async (isVisible) => {
|
watch(visible, async (isVisible) => {
|
||||||
if (!isVisible) return
|
if (!isVisible) return
|
||||||
|
if (!companionVersion.value) void loadCompanionVersion()
|
||||||
// Generate large and let CSS scale down — at 112px source a ~45-module QR
|
// Generate large and let CSS scale down — at 112px source a ~45-module QR
|
||||||
// is 2.5px/module, which camera decoders (the companion app included)
|
// is 2.5px/module, which camera decoders (the companion app included)
|
||||||
// routinely fail on. 512px keeps every module crisp.
|
// routinely fail on. 512px keeps every module crisp.
|
||||||
|
|||||||
@@ -85,6 +85,20 @@ echo "publish-companion-apk: verified v1 + v2 + v3 signatures." >&2
|
|||||||
mkdir -p "$(dirname "$DEST")"
|
mkdir -p "$(dirname "$DEST")"
|
||||||
cp "$SIGNED" "$DEST"
|
cp "$SIGNED" "$DEST"
|
||||||
|
|
||||||
|
# Version metadata beside the APK: the dashboard's companion overlay reads
|
||||||
|
# this to show which version the Download button installs. Extracted from
|
||||||
|
# the gradle config that just built the APK, so it can never drift from it.
|
||||||
|
META="${DEST%.apk}.json"
|
||||||
|
V_NAME="$(sed -n 's/^[[:space:]]*versionName = "\(.*\)"/\1/p' Android/app/build.gradle.kts | head -1)"
|
||||||
|
V_CODE="$(sed -n 's/^[[:space:]]*versionCode = \([0-9]*\).*/\1/p' Android/app/build.gradle.kts | head -1)"
|
||||||
|
if [ -n "$V_NAME" ] && [ -n "$V_CODE" ]; then
|
||||||
|
printf '{\n "versionName": "%s",\n "versionCode": %s\n}\n' "$V_NAME" "$V_CODE" > "$META"
|
||||||
|
git add "$META"
|
||||||
|
echo "publish-companion-apk: staged $META (v$V_NAME, build $V_CODE)" >&2
|
||||||
|
else
|
||||||
|
echo "publish-companion-apk: WARNING could not extract version from build.gradle.kts — $META not updated" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
# Drop the legacy zipped artifact so the served download is the raw APK only.
|
# Drop the legacy zipped artifact so the served download is the raw APK only.
|
||||||
if [ -f "$OLD_ZIP" ]; then
|
if [ -f "$OLD_ZIP" ]; then
|
||||||
git rm -q --ignore-unmatch "$OLD_ZIP" 2>/dev/null || rm -f "$OLD_ZIP"
|
git rm -q --ignore-unmatch "$OLD_ZIP" 2>/dev/null || rm -f "$OLD_ZIP"
|
||||||
|
|||||||
Reference in New Issue
Block a user