CI / lint (push) Successful in 4s
CI / extension-version (push) Successful in 5s
CI / frontend-build (push) Successful in 20s
CI / backend-lint-and-test (push) Successful in 32s
extension / lint (push) Successful in 28s
CI / integration (push) Successful in 3m52s
Build images / sign-extension (push) Successful in 4s
Build images / build-ml (push) Failing after 5s
Build images / build-agent (push) Successful in 13s
Build images / build-web (push) Successful in 2m4s
Closes the half of the ask the signing work didn't: a way to tell a dev
build from a main one. FC_CHANNEL is baked into the web image at build
time and /api/extension/manifest reports it as its own key, next to
version — the popup banner, the toolbar tooltip and the Settings card all
name it.
Beside the version, never inside it. A `1.0.3499884-dev` suffix is the
obvious shortcut and it is the exact failure this design comes from:
versionIsNewer parses each dotted segment with parseInt, so a suffixed
segment reads as 0, every dev build compares equal to every other, and
"no update available" stops being distinguishable from "I cannot read this
version". The comparator already degrades rather than discarding (rule
150), which is a reason not to NEED the suffix, not a licence to add one.
Two tests hold the line — one backend, asserting version and channel are
separate keys; one frontend, asserting the rendered version text stays the
bare derived number.
Optional on the read side, and absent rather than defaulted. An image
built before this field says nothing by not having the key; an image built
without a channel now says nothing the same way, so there is one absence
to handle instead of a second spelling of "unknown". Every reader drops
the label entirely when it is missing and reads exactly as it did before.
Reported verbatim rather than validated against {dev, main}: if an image
declares something else, showing what it claims helps whoever is debugging
more than dropping it would.
FC_CHANNEL is declared LAST in the Dockerfile. An ARG invalidates every
layer below it, and this is the one value that differs between the dev and
main builds of identical source — earlier, and the two channels could
never share a cached pip install. A tag push counts as main: a vYY.MM.DD
tag is cut from main, so that image is a main-channel artifact wearing an
immutable name.
No channel switcher, deliberately. background.js:34 already records that
Firefox's static update_url cannot apply, because every FC instance is a
different host — so the extension asks its configured backend, and the
channel IS the instance it points at. Switching is repointing apiUrl and
reinstalling from that host. A separate setting would contradict each
server build shipping its own extension.
This commit touches packaged extension files, so it moves the derived
version and will sign a new one via AMO — the first push to exercise the
extension-changed path from dev end to end.
200 lines
6.3 KiB
Vue
200 lines
6.3 KiB
Vue
<template>
|
|
<v-card class="fc-ext-card">
|
|
<CardHeading icon="mdi-puzzle" title="Browser extension">
|
|
<span v-if="manifest?.installed" class="text-caption fc-muted">
|
|
· Firefox · v{{ manifest.version }}
|
|
</span>
|
|
<!-- Which channel this instance serves, so it is visible without
|
|
installing anything. Rendered only when the image declares one: a
|
|
locally-built image, or one predating the field, says nothing rather
|
|
than guessing. Never merged into the version string beside it — see
|
|
the endpoint's note on why a `-dev` suffix breaks the comparator. -->
|
|
<v-chip
|
|
v-if="manifest?.channel"
|
|
size="x-small" variant="tonal" class="ml-2"
|
|
:color="manifest.channel === 'dev' ? 'warning' : 'info'"
|
|
>{{ manifest.channel }}</v-chip>
|
|
</CardHeading>
|
|
|
|
<v-card-text>
|
|
<p class="fc-muted text-body-2">
|
|
Pushes session cookies from supported platforms
|
|
(patreon, subscribestar, hentaifoundry, discord, pixiv)
|
|
into FabledCurator, and lets you add a creator as a source from
|
|
their page in one click.
|
|
</p>
|
|
|
|
<v-alert
|
|
v-if="manifestError"
|
|
type="warning" variant="tonal" density="compact" class="mt-3"
|
|
>
|
|
Could not load extension manifest: {{ manifestError }}
|
|
</v-alert>
|
|
|
|
<v-alert
|
|
v-else-if="manifest && !manifest.installed"
|
|
type="warning" variant="tonal" density="compact" class="mt-3"
|
|
>
|
|
No bundled extension found in this image. Push a release that
|
|
runs the extension CI workflow, or grab the XPI from the
|
|
FabledCurator Forgejo releases page.
|
|
</v-alert>
|
|
|
|
<template v-else-if="manifest?.installed">
|
|
<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-if="isFirefox"
|
|
color="accent" variant="flat" rounded="pill"
|
|
prepend-icon="mdi-firefox"
|
|
:href="manifest.latest_url"
|
|
>Install Firefox extension</v-btn>
|
|
|
|
<v-btn
|
|
variant="outlined" rounded="pill"
|
|
:href="manifest.latest_url" download
|
|
prepend-icon="mdi-download"
|
|
>Download XPI</v-btn>
|
|
|
|
<v-alert
|
|
v-if="!isFirefox"
|
|
type="info" variant="tonal" density="compact" class="mt-3"
|
|
>
|
|
Open this page in Firefox to install in one click, or use
|
|
"Download XPI" to install manually.
|
|
</v-alert>
|
|
</div>
|
|
|
|
<v-divider class="my-4" />
|
|
|
|
<div class="fc-muted text-body-2 mb-3">
|
|
After installing, open the extension's options page
|
|
(about:addons → FabledCurator → Preferences) and paste these:
|
|
</div>
|
|
|
|
<v-text-field
|
|
label="FC base URL" :model-value="apiUrl"
|
|
readonly density="compact" hide-details
|
|
append-inner-icon="mdi-content-copy"
|
|
@click:append-inner="copy(apiUrl, 'URL')"
|
|
/>
|
|
|
|
<v-text-field
|
|
label="Extension API key"
|
|
:model-value="apiKey"
|
|
:type="keyShown ? 'text' : 'password'"
|
|
readonly density="compact" hide-details class="mt-3"
|
|
>
|
|
<template #append-inner>
|
|
<v-btn
|
|
variant="text" density="compact" size="small"
|
|
:icon="keyShown ? 'mdi-eye-off' : 'mdi-eye'"
|
|
@click="keyShown = !keyShown"
|
|
/>
|
|
<v-btn
|
|
variant="text" density="compact" size="small"
|
|
icon="mdi-content-copy"
|
|
@click="copy(apiKey, 'API key')"
|
|
/>
|
|
<v-btn
|
|
variant="text" density="compact" size="small"
|
|
icon="mdi-refresh" color="warning"
|
|
:loading="rotating"
|
|
@click="rotateKey"
|
|
/>
|
|
</template>
|
|
</v-text-field>
|
|
</template>
|
|
</v-card-text>
|
|
</v-card>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { toast } from '../../utils/toast.js'
|
|
import { computed, onMounted, ref } from 'vue'
|
|
import { useApi } from '../../composables/useApi.js'
|
|
import { copyText } from '../../utils/clipboard.js'
|
|
import CardHeading from '../common/CardHeading.vue'
|
|
|
|
const api = useApi()
|
|
|
|
const manifest = ref(null)
|
|
const manifestError = ref(null)
|
|
const apiKey = ref('')
|
|
const keyShown = ref(false)
|
|
const rotating = ref(false)
|
|
|
|
const apiUrl = computed(() => `${window.location.origin}/api`)
|
|
const isFirefox = computed(() => navigator.userAgent.includes('Firefox'))
|
|
|
|
onMounted(async () => {
|
|
await Promise.all([loadManifest(), loadKey()])
|
|
})
|
|
|
|
async function loadManifest() {
|
|
try {
|
|
manifest.value = await api.get('/api/extension/manifest')
|
|
} catch (e) {
|
|
if (e.status === 404) {
|
|
// Backend says no XPI is bundled — surface the not-installed
|
|
// state, not an error.
|
|
manifest.value = { installed: false }
|
|
} else {
|
|
manifestError.value = e.message
|
|
}
|
|
}
|
|
}
|
|
|
|
async function loadKey() {
|
|
try {
|
|
const { key } = await api.get('/api/settings/extension_api_key')
|
|
apiKey.value = key
|
|
} catch (e) {
|
|
apiKey.value = ''
|
|
toast({
|
|
text: `Failed to load extension API key: ${e.message}`,
|
|
type: 'error',
|
|
})
|
|
}
|
|
}
|
|
|
|
async function rotateKey() {
|
|
rotating.value = true
|
|
try {
|
|
const { key } = await api.post('/api/settings/extension_api_key/rotate')
|
|
apiKey.value = key
|
|
keyShown.value = true
|
|
toast({ text: 'Extension API key rotated.', type: 'success' })
|
|
} catch (e) {
|
|
toast({
|
|
text: `Rotate failed: ${e.message}`,
|
|
type: 'error',
|
|
})
|
|
} finally {
|
|
rotating.value = false
|
|
}
|
|
}
|
|
|
|
async function copy(text, label) {
|
|
try {
|
|
await copyText(text)
|
|
toast({ text: `${label} copied.`, type: 'success' })
|
|
} catch (e) {
|
|
toast({ text: `Copy failed: ${e.message}`, type: 'error' })
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.fc-ext-card { border-radius: 8px; }
|
|
.fc-ext-install {
|
|
display: flex; flex-wrap: wrap; gap: 8px;
|
|
}
|
|
</style>
|