06 plugin.js (3/4)

  try {
    const status = await (await fetch('/api/status')).json();
    const have = String(status.pluginCapabilities || '').split(',');
    const missing = REQUIRED_CAPS.filter((c) => !have.includes(c));
    if (missing.length) {
      $('[data-warn]').hidden = false;
      $('[data-warn]').textContent = 'This firmware lacks ' + missing.join(', ') + '. Update CrossPoint for this plugin to work.';
    }
  } catch (e) { /* older firmware without /api/status: just try */ }

  const cfg = await readConfig();
  $('[data-k=server]').value = cfg.server || '';
  $('[data-k=session]').value = cfg.session || newSession();

  $('[data-act=new]').onclick = () => {
    if (cfg.session && !confirm('Start with a new player id? Your saved games stay on the server under the old id.')) return;
    $('[data-k=session]').value = newSession();
    out('New id. Press Test & save to keep it.');
  };
‹ PreviousReader file (.txt)Next ›