aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-predictor.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/module-predictor.js')
-rw-r--r--modules/core/module-predictor.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/core/module-predictor.js b/modules/core/module-predictor.js
index b534d34..416b06b 100644
--- a/modules/core/module-predictor.js
+++ b/modules/core/module-predictor.js
@@ -444,6 +444,10 @@ class PredictorModule {
async _pushToServer() {
const cfg = this._wdConfig();
if (!cfg) { this._storeMode = 'cache-only (no WebDAV config)'; return false; }
+ // The store is a /spaces/<user>/_data path, i.e. auth-gated. A config without credentials
+ // produces a guaranteed 401 on every boot (measured: 107 × 401 on predictor.json in one day)
+ // and that 401 is what the console reports as an error. No credentials, no request.
+ if (!cfg.user || !cfg.pass) { this._storeMode = 'cache-only (no credentials)'; return false; }
try {
const body = this.terminal.fs.readFile('/system/metrics/predictor.json') || '{}';
const put = () => fetch(this._storeUrl(cfg), { method: 'PUT', headers: this._storeHeaders(cfg), body: body });
@@ -466,6 +470,9 @@ class PredictorModule {
async _pullFromServer(force) {
const cfg = this._wdConfig();
if (!cfg) { this._storeMode = 'cache-only (no WebDAV config)'; return false; }
+ // Same rule as the push: an auth-gated path read without credentials is a 401, not a
+ // "server (empty)" answer, and it costs a console error on every page load.
+ if (!cfg.user || !cfg.pass) { this._storeMode = 'cache-only (no credentials)'; return false; }
if (!force && this._cacheStamp && (Date.now() - this._cacheStamp) < this._STORE_TTL_MS) return false;
try {
const resp = await fetch(this._storeUrl(cfg), { headers: this._storeHeaders(cfg) });