MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / isModelVisible

Function isModelVisible

renderer.js:11445–11490  ·  view source on GitHub ↗
(model)

Source from the content-addressed store, hash-verified

11443
11444 function flashButtonCopied(btn) {
11445 if (!btn) return;
11446 const original = btn.textContent;
11447 btn.textContent = 'Copied';
11448 setTimeout(() => {
11449 if (btn.textContent === 'Copied') btn.textContent = original;
11450 }, 1200);
11451 }
11452
11453 function mcpClientConfigJson(url) {
11454 return JSON.stringify({
11455 mcpServers: {
11456 printventory: { url }
11457 }
11458 }, null, 2);
11459 }
11460
11461 function getMcpDialogPort() {
11462 return Math.min(65535, Math.max(1024, parseInt(document.getElementById('mcp-server-port')?.value || '5000', 10) || 5000));
11463 }
11464
11465 function updateMcpDialogPreview(info, serverMode) {
11466 const check = document.getElementById('enable-mcp-server');
11467 const port = getMcpDialogPort();
11468 const scheme = (info && info.url && String(info.url).startsWith('https:')) ? 'https' : 'http';
11469 let url = `${scheme}://127.0.0.1:${port}/mcp`;
11470 if (serverMode && window.location && window.location.origin) {
11471 url = String(window.location.origin).replace(/\/$/, '') + '/mcp';
11472 } else if (!serverMode && info && info.url) {
11473 url = String(info.url).replace(/:\d+(\/mcp)?$/, ':' + port + '/mcp');
11474 }
11475 const urlInput = document.getElementById('mcp-server-url');
11476 if (urlInput) urlInput.value = url;
11477 const configEl = document.getElementById('mcp-server-config');
11478 if (configEl) configEl.textContent = mcpClientConfigJson(url);
11479
11480 const statusEl = document.getElementById('mcp-server-status');
11481 if (statusEl) {
11482 if (serverMode) {
11483 statusEl.textContent = 'Status: MCP endpoint is available on this server.';
11484 } else if (check?.checked && info && info.running) {
11485 statusEl.textContent = 'Status: Listening at ' + url;
11486 } else if (check?.checked) {
11487 statusEl.textContent = 'Status: Enabled. Click Save to start the listener.';
11488 } else {
11489 statusEl.textContent = 'Status: Disabled. Enable and Save to start the listener while Printventory is running.';
11490 }
11491 }
11492 const extra = document.getElementById('mcp-server-extra-urls');
11493 if (extra) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected