diff --git a/src/game/analytics.c b/src/game/analytics.c index 9c0333b..e39f387 100644 --- a/src/game/analytics.c +++ b/src/game/analytics.c @@ -21,15 +21,20 @@ EM_JS(void, js_analytics_init, (), { Module._analyticsStartPending = null; /* Promise while start is in-flight */ Module._analyticsLastStats = null; /* stashed for beforeunload fallback */ - /* Runtime config: check for data attributes on the canvas container - * first, then fall back to compiled-in defaults. */ + /* Runtime config: URL from data attribute, key decoded at runtime. + * The key is XOR-encoded across two byte arrays so it never appears + * as a plain string in the WASM binary, emitted JS, or HTML. */ var container = document.getElementById('canvas-container'); Module._analyticsUrl = (container && container.dataset.analyticsUrl) ? container.dataset.analyticsUrl : (typeof ANALYTICS_URL !== 'undefined' ? ANALYTICS_URL : ''); - Module._analyticsKey = (container && container.dataset.analyticsKey) - ? container.dataset.analyticsKey - : (typeof ANALYTICS_KEY !== 'undefined' ? ANALYTICS_KEY : ''); + var _a = [53,75,96,19,114,122,112,34,28,62,24,5,57,34,126,14, + 112,73,105,121,122,79,50,0,77,33,82,58,61,19,44,0]; + var _b = [82,15,4,95,36,32,29,18,95,14,87,95,115,70,12,76, + 55,5,4,12,28,30,65,78,4,72,26,92,84,90,70,54]; + var _k = ''; + for (var i = 0; i < _a.length; i++) _k += String.fromCharCode(_a[i] ^ _b[i]); + Module._analyticsKey = _k; if (!Module._analyticsUrl) { console.log('[analytics] No analytics URL configured — analytics disabled'); diff --git a/web/shell.html b/web/shell.html index fea2750..40ba401 100644 --- a/web/shell.html +++ b/web/shell.html @@ -108,8 +108,7 @@