fix: add x-hermes-session-token header for remote auth

This commit is contained in:
OpenCode Agent 2026-08-17 21:54:29 +00:00
parent 18628e9e36
commit 7435a418c8
1 changed files with 11 additions and 3 deletions

View File

@ -6,9 +6,16 @@
const { useState, useEffect, useCallback } = SDK.hooks;
const { Card, CardHeader, CardTitle, CardContent, Button } = SDK.components;
// Use native fetch with credentials for remote dashboard
// Use native fetch with session token header for remote dashboard
function getSessionToken() {
return window.__HERMES_SESSION_TOKEN__ || "";
}
async function apiFetch(path) {
const res = await fetch(path, { credentials: "include" });
const res = await fetch(path, {
credentials: "include",
headers: { "x-hermes-session-token": getSessionToken() }
});
if (!res.ok) {
const text = await res.text();
throw new Error("API error " + res.status + ": " + text.slice(0, 100));
@ -19,7 +26,8 @@
async function apiPost(path) {
const res = await fetch(path, {
method: "POST",
credentials: "include"
credentials: "include",
headers: { "x-hermes-session-token": getSessionToken() }
});
if (!res.ok) {
const text = await res.text();