This commit is contained in:
@@ -36,10 +36,23 @@ export interface LocalTasksApiOptions {
|
||||
* without a server restart. Clamped to [1, 1000] MB. Default: 50.
|
||||
*/
|
||||
getMaxUploadMb?: () => number;
|
||||
/**
|
||||
* Whether the auth subsystem is wired. When `false` (no-auth single-user
|
||||
* deployment) requests carry no `req.user`, so new tasks/jobs are registered
|
||||
* under the stable `local` owner instead of NULL — keeping per-task
|
||||
* reflection / visibility lookups (which key on owner_id) consistent with the
|
||||
* rest of the no-auth path. Defaults to `true` (owner stays req.user.id).
|
||||
*/
|
||||
authActive?: boolean;
|
||||
}
|
||||
|
||||
export function mountLocalTasksApi(app: Application, opts: LocalTasksApiOptions): void {
|
||||
const { repo, worktreeDir, sessRepo } = opts;
|
||||
// No-auth single-user mode: register new tasks/jobs under the 'local' owner
|
||||
// (the same namespace pieces/memory/reflection use) rather than letting the
|
||||
// missing req.user fall through to a NULL owner. In auth mode this is
|
||||
// undefined, so `req.user.id ?? noAuthOwner` keeps the real owner.
|
||||
const noAuthOwner: string | undefined = (opts.authActive ?? true) ? undefined : 'local';
|
||||
|
||||
const resolveUploadLimit = (): string => {
|
||||
const raw = opts.getMaxUploadMb?.() ?? 50;
|
||||
@@ -161,7 +174,7 @@ export function mountLocalTasksApi(app: Application, opts: LocalTasksApiOptions)
|
||||
outputFormat,
|
||||
askPolicy,
|
||||
priority,
|
||||
ownerId: req.user?.id,
|
||||
ownerId: req.user?.id ?? noAuthOwner,
|
||||
visibility,
|
||||
visibilityScopeOrgId: visibility === 'org' ? visibilityScopeOrgId : null,
|
||||
browserSessionProfileId,
|
||||
|
||||
Reference in New Issue
Block a user