mcp 2.2: domain search in chat (tea_domains) and on the dashboard, without a second sign-in
Being signed in to teahub.xyz, or connected to Tea MCP in chat, is the gate, as the operator put it. This takes out 9fece6d's browser sign-in: GET /domains is open and bounded again (only teahub.xyz may read it, 8 searches a minute per client and 20 in all, answers kept ten minutes), and the same search is the tea_domains tool, behind the connector's sign-in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CYHXFvWMCs1GUmRmpySqQ6
This commit is contained in:
1 parent
7e524fd1df
commit
25e72f64b8
9 files changed
+160
-316
No files matched your search
@@ -1,6 +1,5 @@
|
||||
// Teahub on Gitea 28, loaded by templates/custom/footer.tmpl: the home page's title, the footer credit, and the
|
||||
// dashboard's Domains tab, which searches Cloudflare Registrar through Tea MCP (data-domain-search on the script tag)
|
||||
// once Tea MCP has signed the person in.
|
||||
// dashboard's Domains tab, which searches Cloudflare Registrar through Tea MCP (data-domain-search on the script tag).
|
||||
(() => {
|
||||
const endpoint = document.currentScript?.dataset.domainSearch || "https://mcp.teahub.xyz/domains";
|
||||
|
||||
@@ -159,21 +158,10 @@
|
||||
results.innerHTML = '<div class="teahub-domain-empty">Searching Cloudflare...</div>';
|
||||
try {
|
||||
const response = await fetch(`${endpoint}?${new URLSearchParams({q: query, limit: "24"})}`,
|
||||
{mode: "cors", credentials: "include"});
|
||||
{mode: "cors", credentials: "omit"});
|
||||
const data = await response.json().catch(() => ({}));
|
||||
if (mine !== asked) return;
|
||||
if (response.status === 401) {
|
||||
const signIn = `${endpoint}/sign-in?${new URLSearchParams({next: location.href})}`;
|
||||
results.innerHTML = '<div class="teahub-domain-empty">Domain search uses Tea MCP, which needs you to sign in ' +
|
||||
`once. <a href="${escapeHtml(signIn)}">Sign in</a></div>`;
|
||||
results.querySelector("a").addEventListener("click", () => {
|
||||
try {
|
||||
sessionStorage.setItem("teahub-domain-query", query);
|
||||
} catch {}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!response.ok) throw new Error(data.error || "Domain search is unavailable just now.");
|
||||
if (mine !== asked) return;
|
||||
exact = Array.isArray(data.exact_domains) ? data.exact_domains : [];
|
||||
suggested = Array.isArray(data.domains) ? data.domains : [];
|
||||
sort = "price-asc";
|
||||
@@ -190,17 +178,6 @@
|
||||
event.preventDefault();
|
||||
search();
|
||||
});
|
||||
|
||||
// Back from signing in: run the search that asked for it.
|
||||
let pending = "";
|
||||
try {
|
||||
pending = sessionStorage.getItem("teahub-domain-query") || "";
|
||||
sessionStorage.removeItem("teahub-domain-query");
|
||||
} catch {}
|
||||
if (pending) {
|
||||
input.value = pending;
|
||||
search();
|
||||
}
|
||||
};
|
||||
|
||||
if (!mount()) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
<script nonce="{{ctx.CspScriptNonce}}" src="{{AssetUrlPrefix}}/js/teahub.js?v=20261015b" data-domain-search="https://mcp.teahub.xyz/domains" defer></script>
|
||||
<script nonce="{{ctx.CspScriptNonce}}" src="{{AssetUrlPrefix}}/js/teahub.js?v=20261015" data-domain-search="https://mcp.teahub.xyz/domains" defer></script>
|
||||
Reference in new issue
Block a user