fix(ext-ui): direct :href install button (Firefox needs anchor click, not programmatic navigation) + manifest version detection ignores -latest.xpi alias — Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -93,10 +93,20 @@ def _read_manifest_sync() -> dict | None:
|
|||||||
asyncio.to_thread (ASYNC240: no pathlib I/O in async functions)."""
|
asyncio.to_thread (ASYNC240: no pathlib I/O in async functions)."""
|
||||||
if not XPI_DIR.is_dir():
|
if not XPI_DIR.is_dir():
|
||||||
return None
|
return None
|
||||||
xpis = sorted(XPI_DIR.glob("fabledcurator-*.xpi"), key=lambda p: p.stat().st_mtime)
|
# Exclude the `fabledcurator-latest.xpi` alias when picking the file to
|
||||||
if not xpis:
|
# extract a version from — it's a copy of the latest versioned XPI,
|
||||||
|
# written at the same mtime by build.yml, and would otherwise tie or
|
||||||
|
# win the sort (operator-flagged 2026-05-26: UI displayed "v latest"
|
||||||
|
# because `_extract_version("fabledcurator-latest.xpi")` returns
|
||||||
|
# the literal "latest"). The alias still serves as `latest_url`.
|
||||||
|
versioned = [
|
||||||
|
p for p in XPI_DIR.glob("fabledcurator-*.xpi")
|
||||||
|
if p.name != "fabledcurator-latest.xpi"
|
||||||
|
]
|
||||||
|
if not versioned:
|
||||||
return None
|
return None
|
||||||
latest = xpis[-1]
|
versioned.sort(key=lambda p: p.stat().st_mtime)
|
||||||
|
latest = versioned[-1]
|
||||||
return {
|
return {
|
||||||
"installed": True,
|
"installed": True,
|
||||||
"version": _extract_version(latest.name),
|
"version": _extract_version(latest.name),
|
||||||
|
|||||||
@@ -34,11 +34,18 @@
|
|||||||
|
|
||||||
<template v-else-if="manifest?.installed">
|
<template v-else-if="manifest?.installed">
|
||||||
<div class="fc-ext-install mt-3">
|
<div class="fc-ext-install mt-3">
|
||||||
|
<!-- Install button: direct :href anchor click (no programmatic
|
||||||
|
window.location.assign). Firefox's XPI-install gesture
|
||||||
|
requires a user-clicked anchor pointing at an
|
||||||
|
application/x-xpinstall response; programmatic navigation
|
||||||
|
sometimes triggered nothing instead of the install dialog
|
||||||
|
(operator-flagged 2026-05-26). No `download` attribute —
|
||||||
|
that would force a save dialog instead of install. -->
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="isFirefox"
|
v-if="isFirefox"
|
||||||
color="accent" variant="flat" rounded="pill"
|
color="accent" variant="flat" rounded="pill"
|
||||||
prepend-icon="mdi-firefox"
|
prepend-icon="mdi-firefox"
|
||||||
@click="installXpi"
|
:href="manifest.latest_url"
|
||||||
>Install Firefox extension</v-btn>
|
>Install Firefox extension</v-btn>
|
||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
@@ -146,11 +153,6 @@ async function loadKey() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function installXpi() {
|
|
||||||
if (!manifest.value?.latest_url) return
|
|
||||||
window.location.assign(manifest.value.latest_url)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function rotateKey() {
|
async function rotateKey() {
|
||||||
rotating.value = true
|
rotating.value = true
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user