Files
openseo/web/channel.ts
T
pastilhas 10378d08cc the plugin, start to finish: connection, pass-through, panels, skill
OpenSEO ships its own MCP server and its own web UI, so this plugin holds the
address, holds the credential, and is the door. There are no curated routes in
front of it and there should not be: proxy-manager's router already records
where that leads — a curated surface cannot keep up, and the plugin becomes a
worse version of the thing it wraps.

The door IS the security model, not a convenience. Upstream self-hosts with
AUTH_MODE=local_noauth, so every request reaching the instance is trusted by
design and their docs say to put it behind auth. Officer's gate is that auth.
Two things follow and neither is optional: nothing here may publish OpenSEO's
own port, and /_config is owner-only, because the address alone is enough to
bypass this plugin entirely. The iframe therefore points at /api/openseo/ — this
Officer's origin — and never at the instance, since an iframe src is a URL
anybody can read out of the page and open directly.

The probe asks /mcp for tools/list rather than fetching the home page. A web
root answers 200 for a great many things that are not this; a JSON-RPC reply
carrying tool names is the instance identifying itself.

Saving with an empty key field KEEPS the stored one — absent means keep, empty
string means clear. Without that distinction, changing the address from a form
that cannot display the credential would silently erase it, and it would surface
days later as an instance that had stopped answering.

One table, deliberately: every project, keyword and crawl lives in the instance,
so uninstalling this cannot destroy anybody's research. The skill says so too,
because the temptation to cache a project list is exactly what would break it.

The skill leads with cost. This is free software over DataForSEO, metered and
billed to the owner per lookup, so it tells the agent not to sweep and to say
what a thorough answer would spend before spending it.

Tags are `Development` and `Homelab`. `Marketing` and `Research` would both be
more accurate and neither exists in the union — extending it is a platform
change rather than a plugin's to make.
2026-08-29 18:42:43 +01:00

27 lines
1.2 KiB
TypeScript

import { useCallback, useRef } from 'react';
import { defineChannel } from 'hooks/usePanelChannel';
/**
* "The connection changed — anything reading it should read it again."
*
* A channel and not the URL, because `docs/navigation-audit.md` draws that line at ADDRESSABLE: nobody
* links to the moment after a connection was saved, and there is nothing selected. This is the second
* kind — a signal.
*
* The nonce is a module counter rather than `setSignal(n => n + 1)`, copied deliberately from
* proxy-manager's own channel, which records why: the functional setter applies against the value
* captured at render, so two bumps in one render window both compute `snapshot + 1` and the second is
* lost. `Date.now()` has the same flaw twice in a millisecond. A module counter never reads React state.
*/
const useOpenSeoChangedChannel = defineChannel<number>('openseo:changed', 0);
let nonce = 0;
export const useOpenSeoChanged = () => {
const [signal, setSignal] = useOpenSeoChangedChannel();
const setRef = useRef(setSignal);
setRef.current = setSignal;
const bump = useCallback(() => setRef.current(++nonce), []);
return [signal, bump] as const;
};