ework-web 0.10.28 → 0.10.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.28",
3
+ "version": "0.10.29",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ import { getActiveDaemons, listAllDaemons, getSessionDaemonMap, resolveDaemonEnd
10
10
  import { testMysqlConnection, migrateSqliteToMysql, writeMysqlEnv, migrateMysqlToSqlite, writeSqliteEnv, migrateDaemonSqliteToMysql, generateMysqlDDL } from "./db-admin";
11
11
  import type { MysqlTargetOpts } from "./db-admin";
12
12
  import { checkAuth, makeAuthCookieHeader, clearAuthCookieHeader, loginHTML, sanitizeNext, ensureBootstrapAdmin, ensureBootstrapSystem, isReservedSystemLogin } from "./auth";
13
+ import { runAuthHook } from "./auth-hook";
13
14
  import { OpencodeError, createOpencodeClient, MultiDaemonOpencodeClient, RemoteOpencodeClient, isLocalhost, type OpencodeClientInterface } from "./opencode";
14
15
  import { renderMarkdown } from "./render/markdown";
15
16
  import { log, uptimeSeconds, version } from "./logger";
@@ -495,6 +496,14 @@ async function handle(req: Request, url: URL, ip: string, ctx: { authed: boolean
495
496
  if (u) resolvedLogin = u.login;
496
497
  }
497
498
 
499
+ if (!resolvedLogin && token && cfg.userAuthHook) {
500
+ const hookReq = new Request(url, {
501
+ headers: { authorization: `Bearer ${token}` },
502
+ });
503
+ const user = await runAuthHook(cfg.userAuthHook, hookReq);
504
+ if (user) resolvedLogin = user.login;
505
+ }
506
+
498
507
  if (resolvedLogin) {
499
508
  const setCookie = await makeAuthCookieHeader(cfg, resolvedLogin);
500
509
  return new Response(null, {