fix: add x-panel-version header (#4855)

This commit is contained in:
Calum H.
2025-12-04 14:15:03 +00:00
committed by GitHub
parent c421249767
commit a558064f9d
5 changed files with 25 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
import { AbstractFeature } from '../core/abstract-feature'
import type { RequestContext } from '../types/request'
export const PANEL_VERSION = 1
export class PanelVersionFeature extends AbstractFeature {
async execute<T>(next: () => Promise<T>, context: RequestContext): Promise<T> {
context.options.headers = {
...context.options.headers,
'X-Panel-Version': String(PANEL_VERSION),
}
return next()
}
shouldApply(_: RequestContext): boolean {
return true
}
}