| index 6404f26..6e5cc5b 100644 | ||
| --- a/Makefile | ||
| +++ b/Makefile | ||
| @@ -1,4 +1,4 @@ | ||
| 1 | -# plugin_sessionstats - ScorpioX Bot open-source session runtime & turn analytics | |
| 1 | +# plugin_sessionstats - SCORPIOX BOT open-source session runtime & turn analytics | |
| 2 | 2 | # |
| 3 | 3 | # Targets: |
| 4 | 4 | # make native build -> ./plugin_sessionstats |
| index b0b7a32..fae16e0 100644 | ||
| --- a/README.md | ||
| +++ b/README.md | ||
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | # plugin_sessionstats |
| 2 | 2 | |
| 3 | -Session runtime and turn analytics for a ScorpioX Bot node — a single clean-room | |
| 3 | +Session runtime and turn analytics for a SCORPIOX BOT node — a single clean-room | |
| 4 | 4 | C99 binary, MIT licensed, with no dependency beyond libc. |
| 5 | 5 | |
| 6 | 6 | It reads the local session store and reports how long each session ran, how much |
| index 4dcf4fd..ae1e059 100755 | ||
| --- a/release-dist.sh | ||
| +++ b/release-dist.sh | ||
| @@ -31,7 +31,7 @@ set -euo pipefail | ||
| 31 | 31 | |
| 32 | 32 | SLUG="sessionstats" |
| 33 | 33 | ID="plugin_sessionstats" |
| 34 | -VERSION="1.0.0" | |
| 34 | +VERSION="1.0.1" | |
| 35 | 35 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" |
| 36 | 36 | |
| 37 | 37 | ROOT="$(cd "$(dirname "$0")" && pwd)" |
| 1 | 1 | new file mode 100644 |
| index 0000000..0dd243b | ||
| --- /dev/null | ||
| +++ b/src/bot_theme_plugin.h | ||
| @@ -0,0 +1,129 @@ | ||
| 1 | +/* | |
| 2 | + * bot_theme_plugin.h -- SCORPIOX BOT theme tokens for node plugins. | |
| 3 | + * | |
| 4 | + * A trimmed copy of scorpiox-bot-web/bot_theme.h (the bot's single source of | |
| 5 | + * truth for its dual theme). A plugin runs inside the bot (Hub modal, Session | |
| 6 | + * Card modal, Chat floating window) or in its own tab, and in every case it | |
| 7 | + * must look like part of the bot: same tokens, same dark/light pair, same | |
| 8 | + * localStorage key, same prepaint order. | |
| 9 | + * | |
| 10 | + * Three rules, and nothing else: | |
| 11 | + * | |
| 12 | + * 1. Colours come from these tokens only. No plugin-private palette. | |
| 13 | + * 2. The theme is decided BEFORE first paint, in this order: | |
| 14 | + * ?theme=light|dark -> localStorage.bot_theme -> prefers-color-scheme | |
| 15 | + * so a plugin opened from the bot paints in the bot's theme from frame 0. | |
| 16 | + * 3. When the bot's theme changes it posts {type:'sx-theme',theme:'...'} into | |
| 17 | + * this window; the plugin follows without a reload. The plugin asks once | |
| 18 | + * with {type:'sx-theme-request'} at startup, which covers the case where | |
| 19 | + * it was already open when the bot changed theme. | |
| 20 | + * | |
| 21 | + * The bottom of :root carries aliases for the names older plugin CSS already | |
| 22 | + * uses (--surface, --surface2, --muted, --accent, --accent2, --danger, --warn, | |
| 23 | + * --ok), so adopting the bot palette is a swap, not a redesign. Because they | |
| 24 | + * are var() references, one definition covers both themes. | |
| 25 | + * | |
| 26 | + * MIT License. Copyright (c) 2026 SCORPIOX INC. | |
| 27 | + */ | |
| 28 | +#ifndef SX_BOT_THEME_PLUGIN_H | |
| 29 | +#define SX_BOT_THEME_PLUGIN_H | |
| 30 | + | |
| 31 | +/* Dark is the default; light is applied by html[data-theme=light] (chosen by | |
| 32 | + * ?theme= or the bot) or by prefers-color-scheme when nothing chose. */ | |
| 33 | +#define SX_BOT_THEME_TOKENS \ | |
| 34 | +":root{color-scheme:dark;" \ | |
| 35 | + "--bg:#000000;--bg-2:#08080a;--bg-card:#1c1c1e;" \ | |
| 36 | + "--surface-2:rgba(255,255,255,.06);--surface-hover:rgba(255,255,255,.05);" \ | |
| 37 | + "--line:rgba(255,255,255,.08);--line-2:rgba(255,255,255,.16);--border:rgba(255,255,255,.08);" \ | |
| 38 | + "--text:#f5f5f7;--text-2:#86868b;--dim:#86868b;" \ | |
| 39 | + "--blue:#0a84ff;--green:#30d158;--orange:#ff9f0a;--red:#ff453a;--gray:#8e8e93;" \ | |
| 40 | + "--indigo:#5e5ce6;--teal:#64d2ff;--purple:#bf5af2;--yellow:#ffd60a;" \ | |
| 41 | + "--input-bg:rgba(255,255,255,.04);--modal-bg:#1c1c1e;--menu-bg:#1c1c1e;--code-bg:rgba(255,255,255,.06);" \ | |
| 42 | + "--mono:'SF Mono',ui-monospace,Menlo,Consolas,'DejaVu Sans Mono',monospace;" \ | |
| 43 | + "--font:-apple-system,BlinkMacSystemFont,'SF Pro Display','SF Pro Text','Inter','Segoe UI',Roboto,Helvetica,Arial,sans-serif;" \ | |
| 44 | + "--shadow:0 1px 2px rgba(0,0,0,.35);" \ | |
| 45 | + "--shadow-lg:0 30px 80px rgba(0,0,0,.65),0 0 0 1px rgba(255,255,255,.04);" \ | |
| 46 | + "--ease:cubic-bezier(.16,1,.3,1);" \ | |
| 47 | + "--surface:var(--bg-card);--surface2:var(--surface-2);--muted:var(--text-2);" \ | |
| 48 | + "--accent:var(--blue);--accent2:var(--green);--accent-dim:#0071e3;" \ | |
| 49 | + "--danger:var(--red);--err:var(--red);--warn:var(--orange);--ok:var(--green);" \ | |
| 50 | +"}" \ | |
| 51 | +"@media (prefers-color-scheme:light){html:not([data-theme=dark]){" \ | |
| 52 | + "--bg:#f5f5f7;--bg-2:#ffffff;--bg-card:#ffffff;" \ | |
| 53 | + "--surface-2:rgba(0,0,0,.04);--surface-hover:#ffffff;" \ | |
| 54 | + "--line:rgba(0,0,0,.06);--line-2:rgba(0,0,0,.12);--border:rgba(0,0,0,.06);" \ | |
| 55 | + "--text:#1d1d1f;--text-2:#6e6e73;--dim:#6e6e73;" \ | |
| 56 | + "--blue:#007aff;--green:#34c759;--orange:#ff9500;--red:#ff3b30;--gray:#8e8e93;" \ | |
| 57 | + "--indigo:#5856d6;--teal:#32ade6;--purple:#af52de;--yellow:#b8860b;" \ | |
| 58 | + "--accent-dim:#0066d6;" \ | |
| 59 | + "--input-bg:#f5f5f7;--modal-bg:#ffffff;--menu-bg:#ffffff;--code-bg:rgba(0,0,0,.05);" \ | |
| 60 | + "--shadow:0 2px 10px rgba(0,0,0,.03);" \ | |
| 61 | + "--shadow-lg:0 30px 80px rgba(0,0,0,.18),0 0 0 1px rgba(0,0,0,.04);" \ | |
| 62 | + "color-scheme:light}}" \ | |
| 63 | +"html[data-theme=light]{" \ | |
| 64 | + "--bg:#f5f5f7;--bg-2:#ffffff;--bg-card:#ffffff;" \ | |
| 65 | + "--surface-2:rgba(0,0,0,.04);--surface-hover:#ffffff;" \ | |
| 66 | + "--line:rgba(0,0,0,.06);--line-2:rgba(0,0,0,.12);--border:rgba(0,0,0,.06);" \ | |
| 67 | + "--text:#1d1d1f;--text-2:#6e6e73;--dim:#6e6e73;" \ | |
| 68 | + "--blue:#007aff;--green:#34c759;--orange:#ff9500;--red:#ff3b30;--gray:#8e8e93;" \ | |
| 69 | + "--indigo:#5856d6;--teal:#32ade6;--purple:#af52de;--yellow:#b8860b;" \ | |
| 70 | + "--accent-dim:#0066d6;" \ | |
| 71 | + "--input-bg:#f5f5f7;--modal-bg:#ffffff;--menu-bg:#ffffff;--code-bg:rgba(0,0,0,.05);" \ | |
| 72 | + "--shadow:0 2px 10px rgba(0,0,0,.03);" \ | |
| 73 | + "--shadow-lg:0 30px 80px rgba(0,0,0,.18),0 0 0 1px rgba(0,0,0,.04);" \ | |
| 74 | + "color-scheme:light}" \ | |
| 75 | +"html{color-scheme:dark}html[data-theme=dark]{color-scheme:dark}" \ | |
| 76 | +"*{box-sizing:border-box}" \ | |
| 77 | +"body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);" \ | |
| 78 | + "-webkit-font-smoothing:antialiased}" \ | |
| 79 | +"button{font-family:inherit;letter-spacing:inherit}" \ | |
| 80 | +"button:active{transform:scale(.98)}" \ | |
| 81 | +"select option{background:var(--menu-bg);color:var(--text)}" \ | |
| 82 | +"a{color:var(--blue);text-decoration:none;font-weight:600}" \ | |
| 83 | +"/* Embed mode (?embed=1): the host owns the title and the theme, so the plugin" \ | |
| 84 | +" * hides its own back link and its own toggle. */" \ | |
| 85 | +"html.embedded .embed-hide,html.embedded #themeToggle{display:none!important}" \ | |
| 86 | +"@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}" | |
| 87 | + | |
| 88 | +/* Pre-paint: decide the theme before the first frame. Must be the first thing | |
| 89 | + * in <head> so there is no flash of the wrong theme. Also flags embed mode as | |
| 90 | + * html.embedded so the embed rules apply before first paint. */ | |
| 91 | +#define SX_BOT_THEME_PREPAINT \ | |
| 92 | +"<script>(function(){var t='';" \ | |
| 93 | +"try{var m=/[?&]theme=(light|dark)/.exec(location.search);if(m)t=m[1];}catch(e){}" \ | |
| 94 | +"if(!t){try{var s=localStorage.getItem('bot_theme');if(s==='light'||s==='dark')t=s;}catch(e){}}" \ | |
| 95 | +"if(!t){try{t=(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches)?'light':'dark';}catch(e){t='dark';}}" \ | |
| 96 | +"document.documentElement.setAttribute('data-theme',t);" \ | |
| 97 | +"try{if(/[?&]embed=(1|true)(&|$)/.test(location.search))document.documentElement.classList.add('embedded');}catch(e){}" \ | |
| 98 | +"try{localStorage.setItem('bot_theme',t);}catch(e){}" \ | |
| 99 | +"})();</script>\n" | |
| 100 | + | |
| 101 | +/* Handoff: follow the bot. The host posts {type:'sx-theme',theme}; we ask once | |
| 102 | + * at startup in case it changed while this page was already open. Fires the | |
| 103 | + * same 'bot-theme' CustomEvent the bot pages use, so canvas surfaces can | |
| 104 | + * re-skin themselves from one listener. */ | |
| 105 | +#define SX_BOT_THEME_HANDOFF \ | |
| 106 | +"<script>(function(){" \ | |
| 107 | +"function apply(t){if(t!=='light'&&t!=='dark')return;" \ | |
| 108 | +"if(document.documentElement.getAttribute('data-theme')===t)return;" \ | |
| 109 | +"document.documentElement.setAttribute('data-theme',t);" \ | |
| 110 | +"try{localStorage.setItem('bot_theme',t);}catch(e){}" \ | |
| 111 | +"try{window.dispatchEvent(new CustomEvent('bot-theme',{detail:t}));}catch(e){}}" \ | |
| 112 | +"window.sxApplyTheme=apply;" \ | |
| 113 | +"window.sxTheme=function(){var t=document.documentElement.getAttribute('data-theme');return (t==='light'||t==='dark')?t:'dark';};" \ | |
| 114 | +"window.addEventListener('message',function(e){var d=e&&e.data;if(d&&d.type==='sx-theme')apply(d.theme);});" \ | |
| 115 | +"try{if(window.parent&&window.parent!==window)window.parent.postMessage({type:'sx-theme-request'},'*');}catch(e){}" \ | |
| 116 | +"})();</script>\n" | |
| 117 | + | |
| 118 | +/* Standalone toggle (hidden in embed mode by the CSS above). Only useful when | |
| 119 | + * the plugin is opened in its own tab; inside the bot the host owns the theme. | |
| 120 | + * Give it class 'icon-btn'-free styling from the page, or use the helper JS. */ | |
| 121 | +#define SX_BOT_THEME_TOGGLE_BTN \ | |
| 122 | +"<button class='embed-hide' id='themeToggle' type='button' title='Toggle appearance'>Theme</button>" | |
| 123 | + | |
| 124 | +#define SX_BOT_THEME_TOGGLE_JS \ | |
| 125 | +"<script>(function(){var b=document.getElementById('themeToggle');if(!b)return;" \ | |
| 126 | +"b.onclick=function(){window.sxApplyTheme(window.sxTheme()==='dark'?'light':'dark');};" \ | |
| 127 | +"})();</script>\n" | |
| 128 | + | |
| 129 | +#endif /* SX_BOT_THEME_PLUGIN_H */ |
| index bcc8ffe..b7668bf 100644 | ||
| --- a/src/plugin_sessionstats.c | ||
| +++ b/src/plugin_sessionstats.c | ||
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | - * plugin_sessionstats - ScorpioX Bot open-source session runtime & turn analytics | |
| 2 | + * plugin_sessionstats - SCORPIOX BOT open-source session runtime & turn analytics | |
| 3 | 3 | * |
| 4 | 4 | * A single clean-room C99 binary that serves THREE modes: |
| 5 | 5 | * 1. --meta / SX_PLUGIN_META=1 -> JSON discovery metadata |
| @@ -56,9 +56,11 @@ | ||
| 56 | 56 | # define SX_PATHSEP '/' |
| 57 | 57 | #endif |
| 58 | 58 | |
| 59 | +#include "bot_theme_plugin.h" | |
| 60 | + | |
| 59 | 61 | #define PLUGIN_SLUG "sessionstats" |
| 60 | 62 | #define PLUGIN_ID "plugin_sessionstats" |
| 61 | -#define PLUGIN_VER "1.0.0" | |
| 63 | +#define PLUGIN_VER "1.0.1" | |
| 62 | 64 | |
| 63 | 65 | #define NAME_SZ 128 |
| 64 | 66 | #define MAX_SESSIONS 256 |
| @@ -878,20 +880,8 @@ static void html_head(int embed, const char *initial_id) | ||
| 878 | 880 | "<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'>" |
| 879 | 881 | "<meta name='viewport' content='width=device-width,initial-scale=1'>" |
| 880 | 882 | "<title>Session Analytics</title>" |
| 881 | - "<style>" | |
| 882 | - ":root{color-scheme:dark light;" | |
| 883 | - "--bg:#0d0d0f;--surface:#18181b;--surface2:#212125;--text:#f5f5f7;--muted:#8e8e93;" | |
| 884 | - "--line:rgba(255,255,255,.12);--blue:#0a84ff;--green:#30d158;--orange:#ff9f0a;" | |
| 885 | - "--purple:#bf5af2;--red:#ff453a}" | |
| 886 | - "@media(prefers-color-scheme:light){:root{--bg:#f5f5f7;--surface:#ffffff;" | |
| 887 | - "--surface2:#f0f0f4;--text:#1d1d1f;--muted:#6e6e73;--line:rgba(0,0,0,.1);" | |
| 888 | - "--blue:#0071e3;--green:#28cd41;--orange:#ff9500;--purple:#af52de;--red:#ff3b30}}" | |
| 889 | - "body.theme-light{--bg:#f5f5f7;--surface:#ffffff;--surface2:#f0f0f4;--text:#1d1d1f;" | |
| 890 | - "--muted:#6e6e73;--line:rgba(0,0,0,.1);--blue:#0071e3;--green:#28cd41;" | |
| 891 | - "--orange:#ff9500;--purple:#af52de;--red:#ff3b30}" | |
| 892 | - "body.theme-dark{--bg:#0d0d0f;--surface:#18181b;--surface2:#212125;--text:#f5f5f7;" | |
| 893 | - "--muted:#8e8e93;--line:rgba(255,255,255,.12);--blue:#0a84ff;--green:#30d158;" | |
| 894 | - "--orange:#ff9f0a;--purple:#bf5af2;--red:#ff453a}" | |
| 883 | + SX_BOT_THEME_PREPAINT | |
| 884 | + "<style>" SX_BOT_THEME_TOKENS | |
| 895 | 885 | "*{box-sizing:border-box}" |
| 896 | 886 | "body{margin:0;padding:14px;background:var(--bg);color:var(--text);" |
| 897 | 887 | "font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',Roboto,sans-serif;" |
| @@ -958,7 +948,7 @@ static void html_head(int embed, const char *initial_id) | ||
| 958 | 948 | ".tbl th:nth-child(5),.tbl td:nth-child(5){display:none}" |
| 959 | 949 | "body{padding:10px}}" |
| 960 | 950 | "@media(max-width:400px){.row{grid-template-columns:80px 1fr 54px}.grid{grid-template-columns:1fr 1fr}}" |
| 961 | - "</style></head><body><div class='wrap'>" | |
| 951 | + "</style></head>" SX_BOT_THEME_HANDOFF "<body><div class='wrap'>" | |
| 962 | 952 | "<div class='head'>" |
| 963 | 953 | "<div class='brand'>" |
| 964 | 954 | "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.8' " |
| @@ -975,7 +965,7 @@ static void html_head(int embed, const char *initial_id) | ||
| 975 | 965 | "<option value='duty'>Highest duty cycle</option>" |
| 976 | 966 | "</select>" |
| 977 | 967 | "<button id='btnReload' type='button'>Refresh</button>" |
| 978 | - "<button id='btnTheme' type='button' aria-label='Toggle theme'>Theme</button>" | |
| 968 | + "<button class='embed-hide' id='btnTheme' type='button' aria-label='Toggle theme'>Theme</button>" | |
| 979 | 969 | "</div></div>" |
| 980 | 970 | "<div id='err' class='err'></div>" |
| 981 | 971 | "<div class='grid'>" |
| @@ -1066,16 +1056,7 @@ static void html_script(const char *initial_id) | ||
| 1066 | 1056 | " return s+'s';" |
| 1067 | 1057 | "}" |
| 1068 | 1058 | |
| 1069 | - "function setTheme(t){" | |
| 1070 | - " document.body.className='theme-'+t;" | |
| 1071 | - " try{localStorage.setItem('sx_sessionstats_theme',t);}catch(e){}" | |
| 1072 | - "}" | |
| 1073 | - "document.getElementById('btnTheme').onclick=function(){" | |
| 1074 | - " setTheme(document.body.classList.contains('theme-light')?'dark':'light');" | |
| 1075 | - "};" | |
| 1076 | - "(function(){var t='';try{t=localStorage.getItem('sx_sessionstats_theme')||'';}catch(e){}" | |
| 1077 | - " if(!t)t=window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches?'light':'dark';" | |
| 1078 | - " setTheme(t);})();" | |
| 1059 | + "document.getElementById('btnTheme').onclick=function(){window.sxApplyTheme(window.sxTheme()==='dark'?'light':'dark');};" | |
| 1079 | 1060 | |
| 1080 | 1061 | "function bars(el,arr,key){" |
| 1081 | 1062 | " if(!arr||!arr.length){el.innerHTML='<div class=\"empty\">No data</div>';return;}" |
| index 6a2289f..079c22b 100755 | ||
| --- a/tests/run.sh | ||
| +++ b/tests/run.sh | ||
| @@ -149,7 +149,7 @@ check "summary has no Content-Length" "$(printf '%s' "$last" | grep -c 'Content- | ||
| 149 | 149 | printf '%s' "$last" > "$TMP/sum.body.json" |
| 150 | 150 | jsoncheck "ok" "$TMP/sum.body.json" 'd["ok"]' "True" |
| 151 | 151 | jsoncheck "plugin id" "$TMP/sum.body.json" 'd["plugin"]' "plugin_sessionstats" |
| 152 | -jsoncheck "version" "$TMP/sum.body.json" 'd["version"]' "1.0.0" | |
| 152 | +jsoncheck "version" "$TMP/sum.body.json" 'd["version"]' "1.0.1" | |
| 153 | 153 | jsoncheck "root_found" "$TMP/sum.body.json" 'd["root_found"]' "True" |
| 154 | 154 | jsoncheck "session count" "$TMP/sum.body.json" 'd["count"]' "3" |
| 155 | 155 | jsoncheck "active_now" "$TMP/sum.body.json" 'd["active_now"]' "1" |
| @@ -273,6 +273,16 @@ grep -q "id='modelBars'" "$TMP/html.txt" && ok || bad "model bars" | ||
| 273 | 273 | grep -q "id='tbody'" "$TMP/html.txt" && ok || bad "session table" |
| 274 | 274 | grep -q "btnTheme" "$TMP/html.txt" && ok || bad "theme toggle" |
| 275 | 275 | grep -q "prefers-color-scheme" "$TMP/html.txt" && ok || bad "dark/light support" |
| 276 | +grep -q 'theme=(light|dark)' "$TMP/html.txt" && ok || bad "theme: reads ?theme= before paint" | |
| 277 | +grep -q "d.type==='sx-theme'" "$TMP/html.txt" && ok || bad "theme: listens for sx-theme" | |
| 278 | +grep -q "sx-theme-request" "$TMP/html.txt" && ok || bad "theme: asks the host for the theme" | |
| 279 | +grep -q -- "--bg-card" "$TMP/html.txt" && ok || bad "theme: bot token --bg-card" | |
| 280 | +grep -q -- "--surface-2" "$TMP/html.txt" && ok || bad "theme: bot token --surface-2" | |
| 281 | +grep -q -- "--text-2" "$TMP/html.txt" && ok || bad "theme: bot token --text-2" | |
| 282 | +grep -q "embed-hide" "$TMP/html.txt" && ok || bad "theme: toggle hidden when embedded" | |
| 283 | +grep -q 'Scorpio'"X Bot" "$TMP/html.txt" && bad "theme: no retired brand casing" || ok | |
| 284 | +grep -q "0d0d0f" "$TMP/html.txt" && bad "theme: no private palette 0d0d0f" || ok | |
| 285 | +grep -q "18181b" "$TMP/html.txt" && bad "theme: no private palette 18181b" || ok | |
| 276 | 286 | grep -q "max-width:400px" "$TMP/html.txt" && ok || bad "narrow breakpoint" |
| 277 | 287 | grep -q "plugin_sessionstats?action=" "$TMP/html.txt" && ok || bad "direct plugin route" |
| 278 | 288 | grep -q "plugins?plugin=" "$TMP/html.txt" && ok || bad "hub proxy route" |
| @@ -328,7 +338,7 @@ check "no 10.x private range" "$(grep -Eco '(^|[^0-9.])10\.[0-9]{1,3}\.[0-9]{1,3 | ||
| 328 | 338 | check "no 172.16-31 range" "$(grep -Eco '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+' "$HIST" || true)" "0" |
| 329 | 339 | check "no ghp_ token" "$(grep -Eco 'ghp_[A-Za-z0-9]{20,}' "$HIST" || true)" "0" |
| 330 | 340 | check "no hf_ token" "$(grep -Eco 'hf_[A-Za-z0-9]{20,}' "$HIST" || true)" "0" |
| 331 | -check "no internal hostnames" "$(grep -Eco 'INTERNAL_HOST_A|INTERNAL_HOST_B|INTERNAL_HOST_C' "$HIST" || true)" "0" | |
| 341 | +check "no internal hostnames" "$(grep -Eco 'intel-ultra'"2"'|INTERNAL_HOST_B|INTERNAL_HOST_C' "$HIST" || true)" "0" | |
| 332 | 342 | check "no default password" "$(grep -Eco 'Xboxone'09'0'9'|TESTPW' "$HIST" || true)" "0" |
| 333 | 343 | |
| 334 | 344 | echo "== Windows artifact shape (when the cross build exists)" |
| 335 | 345 |
| index 6404f26..6e5cc5b 100644 | index 6404f26..6e5cc5b 100644 | ||
| --- a/Makefile | --- a/Makefile | ||
| +++ b/Makefile | +++ b/Makefile | ||
| @@ -1,4 +1,4 @@ | @@ -1,4 +1,4 @@ | ||
| 1 | -# plugin_sessionstats - ScorpioX Bot open-source session runtime & turn analytics | 1 | +# plugin_sessionstats - SCORPIOX BOT open-source session runtime & turn analytics |
| 2 | # | 2 | # |
| 3 | # Targets: | 3 | # Targets: |
| 4 | # make native build -> ./plugin_sessionstats | 4 | # make native build -> ./plugin_sessionstats |
| index b0b7a32..fae16e0 100644 | index b0b7a32..fae16e0 100644 | ||
| --- a/README.md | --- a/README.md | ||
| +++ b/README.md | +++ b/README.md | ||
| @@ -1,6 +1,6 @@ | @@ -1,6 +1,6 @@ | ||
| 1 | # plugin_sessionstats | 1 | # plugin_sessionstats |
| 2 | 2 | ||
| 3 | -Session runtime and turn analytics for a ScorpioX Bot node — a single clean-room | 3 | +Session runtime and turn analytics for a SCORPIOX BOT node — a single clean-room |
| 4 | C99 binary, MIT licensed, with no dependency beyond libc. | 4 | C99 binary, MIT licensed, with no dependency beyond libc. |
| 5 | 5 | ||
| 6 | It reads the local session store and reports how long each session ran, how much | 6 | It reads the local session store and reports how long each session ran, how much |
| index 4dcf4fd..ae1e059 100755 | index 4dcf4fd..ae1e059 100755 | ||
| --- a/release-dist.sh | --- a/release-dist.sh | ||
| +++ b/release-dist.sh | +++ b/release-dist.sh | ||
| @@ -31,7 +31,7 @@ set -euo pipefail | @@ -31,7 +31,7 @@ set -euo pipefail | ||
| 31 | 31 | ||
| 32 | SLUG="sessionstats" | 32 | SLUG="sessionstats" |
| 33 | ID="plugin_sessionstats" | 33 | ID="plugin_sessionstats" |
| 34 | -VERSION="1.0.0" | 34 | +VERSION="1.0.1" |
| 35 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" | 35 | DIST_BASE_URL="https://dist.scorpiox.net/bot-plugins" |
| 36 | 36 | ||
| 37 | ROOT="$(cd "$(dirname "$0")" && pwd)" | 37 | ROOT="$(cd "$(dirname "$0")" && pwd)" |
| 1 | new file mode 100644 | 1 | new file mode 100644 |
| index 0000000..0dd243b | index 0000000..0dd243b | ||
| --- /dev/null | --- /dev/null | ||
| +++ b/src/bot_theme_plugin.h | +++ b/src/bot_theme_plugin.h | ||
| @@ -0,0 +1,129 @@ | @@ -0,0 +1,129 @@ | ||
| 1 | +/* | ||
| 2 | + * bot_theme_plugin.h -- SCORPIOX BOT theme tokens for node plugins. | ||
| 3 | + * | ||
| 4 | + * A trimmed copy of scorpiox-bot-web/bot_theme.h (the bot's single source of | ||
| 5 | + * truth for its dual theme). A plugin runs inside the bot (Hub modal, Session | ||
| 6 | + * Card modal, Chat floating window) or in its own tab, and in every case it | ||
| 7 | + * must look like part of the bot: same tokens, same dark/light pair, same | ||
| 8 | + * localStorage key, same prepaint order. | ||
| 9 | + * | ||
| 10 | + * Three rules, and nothing else: | ||
| 11 | + * | ||
| 12 | + * 1. Colours come from these tokens only. No plugin-private palette. | ||
| 13 | + * 2. The theme is decided BEFORE first paint, in this order: | ||
| 14 | + * ?theme=light|dark -> localStorage.bot_theme -> prefers-color-scheme | ||
| 15 | + * so a plugin opened from the bot paints in the bot's theme from frame 0. | ||
| 16 | + * 3. When the bot's theme changes it posts {type:'sx-theme',theme:'...'} into | ||
| 17 | + * this window; the plugin follows without a reload. The plugin asks once | ||
| 18 | + * with {type:'sx-theme-request'} at startup, which covers the case where | ||
| 19 | + * it was already open when the bot changed theme. | ||
| 20 | + * | ||
| 21 | + * The bottom of :root carries aliases for the names older plugin CSS already | ||
| 22 | + * uses (--surface, --surface2, --muted, --accent, --accent2, --danger, --warn, | ||
| 23 | + * --ok), so adopting the bot palette is a swap, not a redesign. Because they | ||
| 24 | + * are var() references, one definition covers both themes. | ||
| 25 | + * | ||
| 26 | + * MIT License. Copyright (c) 2026 SCORPIOX INC. | ||
| 27 | + */ | ||
| 28 | +#ifndef SX_BOT_THEME_PLUGIN_H | ||
| 29 | +#define SX_BOT_THEME_PLUGIN_H | ||
| 30 | + | ||
| 31 | +/* Dark is the default; light is applied by html[data-theme=light] (chosen by | ||
| 32 | + * ?theme= or the bot) or by prefers-color-scheme when nothing chose. */ | ||
| 33 | +#define SX_BOT_THEME_TOKENS \ | ||
| 34 | +":root{color-scheme:dark;" \ | ||
| 35 | + "--bg:#000000;--bg-2:#08080a;--bg-card:#1c1c1e;" \ | ||
| 36 | + "--surface-2:rgba(255,255,255,.06);--surface-hover:rgba(255,255,255,.05);" \ | ||
| 37 | + "--line:rgba(255,255,255,.08);--line-2:rgba(255,255,255,.16);--border:rgba(255,255,255,.08);" \ | ||
| 38 | + "--text:#f5f5f7;--text-2:#86868b;--dim:#86868b;" \ | ||
| 39 | + "--blue:#0a84ff;--green:#30d158;--orange:#ff9f0a;--red:#ff453a;--gray:#8e8e93;" \ | ||
| 40 | + "--indigo:#5e5ce6;--teal:#64d2ff;--purple:#bf5af2;--yellow:#ffd60a;" \ | ||
| 41 | + "--input-bg:rgba(255,255,255,.04);--modal-bg:#1c1c1e;--menu-bg:#1c1c1e;--code-bg:rgba(255,255,255,.06);" \ | ||
| 42 | + "--mono:'SF Mono',ui-monospace,Menlo,Consolas,'DejaVu Sans Mono',monospace;" \ | ||
| 43 | + "--font:-apple-system,BlinkMacSystemFont,'SF Pro Display','SF Pro Text','Inter','Segoe UI',Roboto,Helvetica,Arial,sans-serif;" \ | ||
| 44 | + "--shadow:0 1px 2px rgba(0,0,0,.35);" \ | ||
| 45 | + "--shadow-lg:0 30px 80px rgba(0,0,0,.65),0 0 0 1px rgba(255,255,255,.04);" \ | ||
| 46 | + "--ease:cubic-bezier(.16,1,.3,1);" \ | ||
| 47 | + "--surface:var(--bg-card);--surface2:var(--surface-2);--muted:var(--text-2);" \ | ||
| 48 | + "--accent:var(--blue);--accent2:var(--green);--accent-dim:#0071e3;" \ | ||
| 49 | + "--danger:var(--red);--err:var(--red);--warn:var(--orange);--ok:var(--green);" \ | ||
| 50 | +"}" \ | ||
| 51 | +"@media (prefers-color-scheme:light){html:not([data-theme=dark]){" \ | ||
| 52 | + "--bg:#f5f5f7;--bg-2:#ffffff;--bg-card:#ffffff;" \ | ||
| 53 | + "--surface-2:rgba(0,0,0,.04);--surface-hover:#ffffff;" \ | ||
| 54 | + "--line:rgba(0,0,0,.06);--line-2:rgba(0,0,0,.12);--border:rgba(0,0,0,.06);" \ | ||
| 55 | + "--text:#1d1d1f;--text-2:#6e6e73;--dim:#6e6e73;" \ | ||
| 56 | + "--blue:#007aff;--green:#34c759;--orange:#ff9500;--red:#ff3b30;--gray:#8e8e93;" \ | ||
| 57 | + "--indigo:#5856d6;--teal:#32ade6;--purple:#af52de;--yellow:#b8860b;" \ | ||
| 58 | + "--accent-dim:#0066d6;" \ | ||
| 59 | + "--input-bg:#f5f5f7;--modal-bg:#ffffff;--menu-bg:#ffffff;--code-bg:rgba(0,0,0,.05);" \ | ||
| 60 | + "--shadow:0 2px 10px rgba(0,0,0,.03);" \ | ||
| 61 | + "--shadow-lg:0 30px 80px rgba(0,0,0,.18),0 0 0 1px rgba(0,0,0,.04);" \ | ||
| 62 | + "color-scheme:light}}" \ | ||
| 63 | +"html[data-theme=light]{" \ | ||
| 64 | + "--bg:#f5f5f7;--bg-2:#ffffff;--bg-card:#ffffff;" \ | ||
| 65 | + "--surface-2:rgba(0,0,0,.04);--surface-hover:#ffffff;" \ | ||
| 66 | + "--line:rgba(0,0,0,.06);--line-2:rgba(0,0,0,.12);--border:rgba(0,0,0,.06);" \ | ||
| 67 | + "--text:#1d1d1f;--text-2:#6e6e73;--dim:#6e6e73;" \ | ||
| 68 | + "--blue:#007aff;--green:#34c759;--orange:#ff9500;--red:#ff3b30;--gray:#8e8e93;" \ | ||
| 69 | + "--indigo:#5856d6;--teal:#32ade6;--purple:#af52de;--yellow:#b8860b;" \ | ||
| 70 | + "--accent-dim:#0066d6;" \ | ||
| 71 | + "--input-bg:#f5f5f7;--modal-bg:#ffffff;--menu-bg:#ffffff;--code-bg:rgba(0,0,0,.05);" \ | ||
| 72 | + "--shadow:0 2px 10px rgba(0,0,0,.03);" \ | ||
| 73 | + "--shadow-lg:0 30px 80px rgba(0,0,0,.18),0 0 0 1px rgba(0,0,0,.04);" \ | ||
| 74 | + "color-scheme:light}" \ | ||
| 75 | +"html{color-scheme:dark}html[data-theme=dark]{color-scheme:dark}" \ | ||
| 76 | +"*{box-sizing:border-box}" \ | ||
| 77 | +"body{margin:0;background:var(--bg);color:var(--text);font-family:var(--font);" \ | ||
| 78 | + "-webkit-font-smoothing:antialiased}" \ | ||
| 79 | +"button{font-family:inherit;letter-spacing:inherit}" \ | ||
| 80 | +"button:active{transform:scale(.98)}" \ | ||
| 81 | +"select option{background:var(--menu-bg);color:var(--text)}" \ | ||
| 82 | +"a{color:var(--blue);text-decoration:none;font-weight:600}" \ | ||
| 83 | +"/* Embed mode (?embed=1): the host owns the title and the theme, so the plugin" \ | ||
| 84 | +" * hides its own back link and its own toggle. */" \ | ||
| 85 | +"html.embedded .embed-hide,html.embedded #themeToggle{display:none!important}" \ | ||
| 86 | +"@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}" | ||
| 87 | + | ||
| 88 | +/* Pre-paint: decide the theme before the first frame. Must be the first thing | ||
| 89 | + * in <head> so there is no flash of the wrong theme. Also flags embed mode as | ||
| 90 | + * html.embedded so the embed rules apply before first paint. */ | ||
| 91 | +#define SX_BOT_THEME_PREPAINT \ | ||
| 92 | +"<script>(function(){var t='';" \ | ||
| 93 | +"try{var m=/[?&]theme=(light|dark)/.exec(location.search);if(m)t=m[1];}catch(e){}" \ | ||
| 94 | +"if(!t){try{var s=localStorage.getItem('bot_theme');if(s==='light'||s==='dark')t=s;}catch(e){}}" \ | ||
| 95 | +"if(!t){try{t=(window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches)?'light':'dark';}catch(e){t='dark';}}" \ | ||
| 96 | +"document.documentElement.setAttribute('data-theme',t);" \ | ||
| 97 | +"try{if(/[?&]embed=(1|true)(&|$)/.test(location.search))document.documentElement.classList.add('embedded');}catch(e){}" \ | ||
| 98 | +"try{localStorage.setItem('bot_theme',t);}catch(e){}" \ | ||
| 99 | +"})();</script>\n" | ||
| 100 | + | ||
| 101 | +/* Handoff: follow the bot. The host posts {type:'sx-theme',theme}; we ask once | ||
| 102 | + * at startup in case it changed while this page was already open. Fires the | ||
| 103 | + * same 'bot-theme' CustomEvent the bot pages use, so canvas surfaces can | ||
| 104 | + * re-skin themselves from one listener. */ | ||
| 105 | +#define SX_BOT_THEME_HANDOFF \ | ||
| 106 | +"<script>(function(){" \ | ||
| 107 | +"function apply(t){if(t!=='light'&&t!=='dark')return;" \ | ||
| 108 | +"if(document.documentElement.getAttribute('data-theme')===t)return;" \ | ||
| 109 | +"document.documentElement.setAttribute('data-theme',t);" \ | ||
| 110 | +"try{localStorage.setItem('bot_theme',t);}catch(e){}" \ | ||
| 111 | +"try{window.dispatchEvent(new CustomEvent('bot-theme',{detail:t}));}catch(e){}}" \ | ||
| 112 | +"window.sxApplyTheme=apply;" \ | ||
| 113 | +"window.sxTheme=function(){var t=document.documentElement.getAttribute('data-theme');return (t==='light'||t==='dark')?t:'dark';};" \ | ||
| 114 | +"window.addEventListener('message',function(e){var d=e&&e.data;if(d&&d.type==='sx-theme')apply(d.theme);});" \ | ||
| 115 | +"try{if(window.parent&&window.parent!==window)window.parent.postMessage({type:'sx-theme-request'},'*');}catch(e){}" \ | ||
| 116 | +"})();</script>\n" | ||
| 117 | + | ||
| 118 | +/* Standalone toggle (hidden in embed mode by the CSS above). Only useful when | ||
| 119 | + * the plugin is opened in its own tab; inside the bot the host owns the theme. | ||
| 120 | + * Give it class 'icon-btn'-free styling from the page, or use the helper JS. */ | ||
| 121 | +#define SX_BOT_THEME_TOGGLE_BTN \ | ||
| 122 | +"<button class='embed-hide' id='themeToggle' type='button' title='Toggle appearance'>Theme</button>" | ||
| 123 | + | ||
| 124 | +#define SX_BOT_THEME_TOGGLE_JS \ | ||
| 125 | +"<script>(function(){var b=document.getElementById('themeToggle');if(!b)return;" \ | ||
| 126 | +"b.onclick=function(){window.sxApplyTheme(window.sxTheme()==='dark'?'light':'dark');};" \ | ||
| 127 | +"})();</script>\n" | ||
| 128 | + | ||
| 129 | +#endif /* SX_BOT_THEME_PLUGIN_H */ |
| index bcc8ffe..b7668bf 100644 | index bcc8ffe..b7668bf 100644 | ||
| --- a/src/plugin_sessionstats.c | --- a/src/plugin_sessionstats.c | ||
| +++ b/src/plugin_sessionstats.c | +++ b/src/plugin_sessionstats.c | ||
| @@ -1,5 +1,5 @@ | @@ -1,5 +1,5 @@ | ||
| 1 | /* | 1 | /* |
| 2 | - * plugin_sessionstats - ScorpioX Bot open-source session runtime & turn analytics | 2 | + * plugin_sessionstats - SCORPIOX BOT open-source session runtime & turn analytics |
| 3 | * | 3 | * |
| 4 | * A single clean-room C99 binary that serves THREE modes: | 4 | * A single clean-room C99 binary that serves THREE modes: |
| 5 | * 1. --meta / SX_PLUGIN_META=1 -> JSON discovery metadata | 5 | * 1. --meta / SX_PLUGIN_META=1 -> JSON discovery metadata |
| @@ -56,9 +56,11 @@ | @@ -56,9 +56,11 @@ | ||
| 56 | # define SX_PATHSEP '/' | 56 | # define SX_PATHSEP '/' |
| 57 | #endif | 57 | #endif |
| 58 | 58 | ||
| 59 | +#include "bot_theme_plugin.h" | ||
| 60 | + | ||
| 59 | #define PLUGIN_SLUG "sessionstats" | 61 | #define PLUGIN_SLUG "sessionstats" |
| 60 | #define PLUGIN_ID "plugin_sessionstats" | 62 | #define PLUGIN_ID "plugin_sessionstats" |
| 61 | -#define PLUGIN_VER "1.0.0" | 63 | +#define PLUGIN_VER "1.0.1" |
| 62 | 64 | ||
| 63 | #define NAME_SZ 128 | 65 | #define NAME_SZ 128 |
| 64 | #define MAX_SESSIONS 256 | 66 | #define MAX_SESSIONS 256 |
| @@ -878,20 +880,8 @@ static void html_head(int embed, const char *initial_id) | @@ -878,20 +880,8 @@ static void html_head(int embed, const char *initial_id) | ||
| 878 | "<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'>" | 880 | "<!DOCTYPE html><html lang='en'><head><meta charset='utf-8'>" |
| 879 | "<meta name='viewport' content='width=device-width,initial-scale=1'>" | 881 | "<meta name='viewport' content='width=device-width,initial-scale=1'>" |
| 880 | "<title>Session Analytics</title>" | 882 | "<title>Session Analytics</title>" |
| 881 | - "<style>" | 883 | + SX_BOT_THEME_PREPAINT |
| 882 | - ":root{color-scheme:dark light;" | 884 | + "<style>" SX_BOT_THEME_TOKENS |
| 883 | - "--bg:#0d0d0f;--surface:#18181b;--surface2:#212125;--text:#f5f5f7;--muted:#8e8e93;" | ||
| 884 | - "--line:rgba(255,255,255,.12);--blue:#0a84ff;--green:#30d158;--orange:#ff9f0a;" | ||
| 885 | - "--purple:#bf5af2;--red:#ff453a}" | ||
| 886 | - "@media(prefers-color-scheme:light){:root{--bg:#f5f5f7;--surface:#ffffff;" | ||
| 887 | - "--surface2:#f0f0f4;--text:#1d1d1f;--muted:#6e6e73;--line:rgba(0,0,0,.1);" | ||
| 888 | - "--blue:#0071e3;--green:#28cd41;--orange:#ff9500;--purple:#af52de;--red:#ff3b30}}" | ||
| 889 | - "body.theme-light{--bg:#f5f5f7;--surface:#ffffff;--surface2:#f0f0f4;--text:#1d1d1f;" | ||
| 890 | - "--muted:#6e6e73;--line:rgba(0,0,0,.1);--blue:#0071e3;--green:#28cd41;" | ||
| 891 | - "--orange:#ff9500;--purple:#af52de;--red:#ff3b30}" | ||
| 892 | - "body.theme-dark{--bg:#0d0d0f;--surface:#18181b;--surface2:#212125;--text:#f5f5f7;" | ||
| 893 | - "--muted:#8e8e93;--line:rgba(255,255,255,.12);--blue:#0a84ff;--green:#30d158;" | ||
| 894 | - "--orange:#ff9f0a;--purple:#bf5af2;--red:#ff453a}" | ||
| 895 | "*{box-sizing:border-box}" | 885 | "*{box-sizing:border-box}" |
| 896 | "body{margin:0;padding:14px;background:var(--bg);color:var(--text);" | 886 | "body{margin:0;padding:14px;background:var(--bg);color:var(--text);" |
| 897 | "font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',Roboto,sans-serif;" | 887 | "font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',Roboto,sans-serif;" |
| @@ -958,7 +948,7 @@ static void html_head(int embed, const char *initial_id) | @@ -958,7 +948,7 @@ static void html_head(int embed, const char *initial_id) | ||
| 958 | ".tbl th:nth-child(5),.tbl td:nth-child(5){display:none}" | 948 | ".tbl th:nth-child(5),.tbl td:nth-child(5){display:none}" |
| 959 | "body{padding:10px}}" | 949 | "body{padding:10px}}" |
| 960 | "@media(max-width:400px){.row{grid-template-columns:80px 1fr 54px}.grid{grid-template-columns:1fr 1fr}}" | 950 | "@media(max-width:400px){.row{grid-template-columns:80px 1fr 54px}.grid{grid-template-columns:1fr 1fr}}" |
| 961 | - "</style></head><body><div class='wrap'>" | 951 | + "</style></head>" SX_BOT_THEME_HANDOFF "<body><div class='wrap'>" |
| 962 | "<div class='head'>" | 952 | "<div class='head'>" |
| 963 | "<div class='brand'>" | 953 | "<div class='brand'>" |
| 964 | "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.8' " | 954 | "<svg viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.8' " |
| @@ -975,7 +965,7 @@ static void html_head(int embed, const char *initial_id) | @@ -975,7 +965,7 @@ static void html_head(int embed, const char *initial_id) | ||
| 975 | "<option value='duty'>Highest duty cycle</option>" | 965 | "<option value='duty'>Highest duty cycle</option>" |
| 976 | "</select>" | 966 | "</select>" |
| 977 | "<button id='btnReload' type='button'>Refresh</button>" | 967 | "<button id='btnReload' type='button'>Refresh</button>" |
| 978 | - "<button id='btnTheme' type='button' aria-label='Toggle theme'>Theme</button>" | 968 | + "<button class='embed-hide' id='btnTheme' type='button' aria-label='Toggle theme'>Theme</button>" |
| 979 | "</div></div>" | 969 | "</div></div>" |
| 980 | "<div id='err' class='err'></div>" | 970 | "<div id='err' class='err'></div>" |
| 981 | "<div class='grid'>" | 971 | "<div class='grid'>" |
| @@ -1066,16 +1056,7 @@ static void html_script(const char *initial_id) | @@ -1066,16 +1056,7 @@ static void html_script(const char *initial_id) | ||
| 1066 | " return s+'s';" | 1056 | " return s+'s';" |
| 1067 | "}" | 1057 | "}" |
| 1068 | 1058 | ||
| 1069 | - "function setTheme(t){" | 1059 | + "document.getElementById('btnTheme').onclick=function(){window.sxApplyTheme(window.sxTheme()==='dark'?'light':'dark');};" |
| 1070 | - " document.body.className='theme-'+t;" | ||
| 1071 | - " try{localStorage.setItem('sx_sessionstats_theme',t);}catch(e){}" | ||
| 1072 | - "}" | ||
| 1073 | - "document.getElementById('btnTheme').onclick=function(){" | ||
| 1074 | - " setTheme(document.body.classList.contains('theme-light')?'dark':'light');" | ||
| 1075 | - "};" | ||
| 1076 | - "(function(){var t='';try{t=localStorage.getItem('sx_sessionstats_theme')||'';}catch(e){}" | ||
| 1077 | - " if(!t)t=window.matchMedia&&window.matchMedia('(prefers-color-scheme: light)').matches?'light':'dark';" | ||
| 1078 | - " setTheme(t);})();" | ||
| 1079 | 1060 | ||
| 1080 | "function bars(el,arr,key){" | 1061 | "function bars(el,arr,key){" |
| 1081 | " if(!arr||!arr.length){el.innerHTML='<div class=\"empty\">No data</div>';return;}" | 1062 | " if(!arr||!arr.length){el.innerHTML='<div class=\"empty\">No data</div>';return;}" |
| index 6a2289f..079c22b 100755 | index 6a2289f..079c22b 100755 | ||
| --- a/tests/run.sh | --- a/tests/run.sh | ||
| +++ b/tests/run.sh | +++ b/tests/run.sh | ||
| @@ -149,7 +149,7 @@ check "summary has no Content-Length" "$(printf '%s' "$last" | grep -c 'Content- | @@ -149,7 +149,7 @@ check "summary has no Content-Length" "$(printf '%s' "$last" | grep -c 'Content- | ||
| 149 | printf '%s' "$last" > "$TMP/sum.body.json" | 149 | printf '%s' "$last" > "$TMP/sum.body.json" |
| 150 | jsoncheck "ok" "$TMP/sum.body.json" 'd["ok"]' "True" | 150 | jsoncheck "ok" "$TMP/sum.body.json" 'd["ok"]' "True" |
| 151 | jsoncheck "plugin id" "$TMP/sum.body.json" 'd["plugin"]' "plugin_sessionstats" | 151 | jsoncheck "plugin id" "$TMP/sum.body.json" 'd["plugin"]' "plugin_sessionstats" |
| 152 | -jsoncheck "version" "$TMP/sum.body.json" 'd["version"]' "1.0.0" | 152 | +jsoncheck "version" "$TMP/sum.body.json" 'd["version"]' "1.0.1" |
| 153 | jsoncheck "root_found" "$TMP/sum.body.json" 'd["root_found"]' "True" | 153 | jsoncheck "root_found" "$TMP/sum.body.json" 'd["root_found"]' "True" |
| 154 | jsoncheck "session count" "$TMP/sum.body.json" 'd["count"]' "3" | 154 | jsoncheck "session count" "$TMP/sum.body.json" 'd["count"]' "3" |
| 155 | jsoncheck "active_now" "$TMP/sum.body.json" 'd["active_now"]' "1" | 155 | jsoncheck "active_now" "$TMP/sum.body.json" 'd["active_now"]' "1" |
| @@ -273,6 +273,16 @@ grep -q "id='modelBars'" "$TMP/html.txt" && ok || bad "model bars" | @@ -273,6 +273,16 @@ grep -q "id='modelBars'" "$TMP/html.txt" && ok || bad "model bars" | ||
| 273 | grep -q "id='tbody'" "$TMP/html.txt" && ok || bad "session table" | 273 | grep -q "id='tbody'" "$TMP/html.txt" && ok || bad "session table" |
| 274 | grep -q "btnTheme" "$TMP/html.txt" && ok || bad "theme toggle" | 274 | grep -q "btnTheme" "$TMP/html.txt" && ok || bad "theme toggle" |
| 275 | grep -q "prefers-color-scheme" "$TMP/html.txt" && ok || bad "dark/light support" | 275 | grep -q "prefers-color-scheme" "$TMP/html.txt" && ok || bad "dark/light support" |
| 276 | +grep -q 'theme=(light|dark)' "$TMP/html.txt" && ok || bad "theme: reads ?theme= before paint" | ||
| 277 | +grep -q "d.type==='sx-theme'" "$TMP/html.txt" && ok || bad "theme: listens for sx-theme" | ||
| 278 | +grep -q "sx-theme-request" "$TMP/html.txt" && ok || bad "theme: asks the host for the theme" | ||
| 279 | +grep -q -- "--bg-card" "$TMP/html.txt" && ok || bad "theme: bot token --bg-card" | ||
| 280 | +grep -q -- "--surface-2" "$TMP/html.txt" && ok || bad "theme: bot token --surface-2" | ||
| 281 | +grep -q -- "--text-2" "$TMP/html.txt" && ok || bad "theme: bot token --text-2" | ||
| 282 | +grep -q "embed-hide" "$TMP/html.txt" && ok || bad "theme: toggle hidden when embedded" | ||
| 283 | +grep -q 'Scorpio'"X Bot" "$TMP/html.txt" && bad "theme: no retired brand casing" || ok | ||
| 284 | +grep -q "0d0d0f" "$TMP/html.txt" && bad "theme: no private palette 0d0d0f" || ok | ||
| 285 | +grep -q "18181b" "$TMP/html.txt" && bad "theme: no private palette 18181b" || ok | ||
| 276 | grep -q "max-width:400px" "$TMP/html.txt" && ok || bad "narrow breakpoint" | 286 | grep -q "max-width:400px" "$TMP/html.txt" && ok || bad "narrow breakpoint" |
| 277 | grep -q "plugin_sessionstats?action=" "$TMP/html.txt" && ok || bad "direct plugin route" | 287 | grep -q "plugin_sessionstats?action=" "$TMP/html.txt" && ok || bad "direct plugin route" |
| 278 | grep -q "plugins?plugin=" "$TMP/html.txt" && ok || bad "hub proxy route" | 288 | grep -q "plugins?plugin=" "$TMP/html.txt" && ok || bad "hub proxy route" |
| @@ -328,7 +338,7 @@ check "no 10.x private range" "$(grep -Eco '(^|[^0-9.])10\.[0-9]{1,3}\.[0-9]{1,3 | @@ -328,7 +338,7 @@ check "no 10.x private range" "$(grep -Eco '(^|[^0-9.])10\.[0-9]{1,3}\.[0-9]{1,3 | ||
| 328 | check "no 172.16-31 range" "$(grep -Eco '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+' "$HIST" || true)" "0" | 338 | check "no 172.16-31 range" "$(grep -Eco '172\.(1[6-9]|2[0-9]|3[01])\.[0-9]+\.[0-9]+' "$HIST" || true)" "0" |
| 329 | check "no ghp_ token" "$(grep -Eco 'ghp_[A-Za-z0-9]{20,}' "$HIST" || true)" "0" | 339 | check "no ghp_ token" "$(grep -Eco 'ghp_[A-Za-z0-9]{20,}' "$HIST" || true)" "0" |
| 330 | check "no hf_ token" "$(grep -Eco 'hf_[A-Za-z0-9]{20,}' "$HIST" || true)" "0" | 340 | check "no hf_ token" "$(grep -Eco 'hf_[A-Za-z0-9]{20,}' "$HIST" || true)" "0" |
| 331 | -check "no internal hostnames" "$(grep -Eco 'INTERNAL_HOST_A|INTERNAL_HOST_B|INTERNAL_HOST_C' "$HIST" || true)" "0" | 341 | +check "no internal hostnames" "$(grep -Eco 'intel-ultra'"2"'|INTERNAL_HOST_B|INTERNAL_HOST_C' "$HIST" || true)" "0" |
| 332 | check "no default password" "$(grep -Eco 'Xboxone'09'0'9'|TESTPW' "$HIST" || true)" "0" | 342 | check "no default password" "$(grep -Eco 'Xboxone'09'0'9'|TESTPW' "$HIST" || true)" "0" |
| 333 | 343 | ||
| 334 | echo "== Windows artifact shape (when the cross build exists)" | 344 | echo "== Windows artifact shape (when the cross build exists)" |
| 335 | 345 |