From ce6e69a2e8220d344afe3d18b6ad0a14f06cb39f Mon Sep 17 00:00:00 2001 From: min Date: Sat, 6 Jun 2026 10:01:38 +0300 Subject: [PATCH] =?UTF-8?q?fix(studio):=20saveProgress/loadProgress=20?= =?UTF-8?q?=D1=81=20JWT-=D0=B7=D0=B0=D0=B3=D0=BE=D0=BB=D0=BE=D0=B2=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=20(=D0=B1=D1=8B=D0=BB=20401=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B3=D1=80=D0=B5=D1=81=D1=81=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit loadProgress/saveProgress (лидерстаты/достижения) слали fetch без Authorization → 401 UNAUTHORIZED. Используют _economyAuthHeaders() (JWT игрока из localStorage). Co-Authored-By: Claude Opus 4.8 --- src/editor/engine/GameRuntime.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/editor/engine/GameRuntime.js b/src/editor/engine/GameRuntime.js index 869032c..6a9bd71 100644 --- a/src/editor/engine/GameRuntime.js +++ b/src/editor/engine/GameRuntime.js @@ -4442,7 +4442,8 @@ export class GameRuntime { if (!url) return; try { fetch(url, { - method: 'POST', headers: { 'Content-Type': 'application/json' }, + method: 'POST', + headers: this._economyAuthHeaders(), // JWT игрока (иначе 401) body: JSON.stringify({ data }), }).catch(() => {}); } catch (e) { /* ignore */ } @@ -4451,7 +4452,8 @@ export class GameRuntime { loadProgress(namespace, cb) { const url = this._saveBaseUrl(namespace); if (!url) { cb && cb(null); return; } - fetch(url).then(r => r.json()) + fetch(url, { headers: this._economyAuthHeaders() }) + .then(r => r.json()) .then(j => cb && cb(j.data ?? null)) .catch(() => cb && cb(null)); }