hatch-surf/node_modules/next/dist/esm/next-devtools/server/dev-indicator-middleware.js
Riley Zhang df378d33ef
Some checks failed
CI / go (push) Waiting to run
CI / docker (push) Waiting to run
CI / lint-go (push) Waiting to run
CI / lint-docs (push) Waiting to run
CI / check-paperclip (push) Waiting to run
Deploy static site / Deploy to GitHub Pages (push) Has been cancelled
Deploy static site / Deploy via Docker to hatch.surf (push) Has been cancelled
Merge GitHub main into Gitea repo (allow unrelated histories)
Resolved conflicts by taking GitHub versions for:
- .dockerignore, .gitignore, Dockerfile, README.md, docker-compose.yml

Kept deploy.sh updated to:
- Pull from GitHub (primary source)
- Push to Gitea (push-mirror)
- Build from site/ directory (GitHub structure)

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-25 05:20:46 +02:00

25 lines
1.2 KiB
JavaScript

import { middlewareResponse } from './middleware-response';
import * as Log from '../../build/output/log';
import { devIndicatorServerState } from '../../server/dev/dev-indicator-server-state';
const DISABLE_DEV_INDICATOR_PREFIX = '/__nextjs_disable_dev_indicator';
const COOLDOWN_TIME_MS = process.env.__NEXT_DEV_INDICATOR_COOLDOWN_MS ? parseInt(process.env.__NEXT_DEV_INDICATOR_COOLDOWN_MS) : 1000 * 60 * 60 * 24;
export function getDisableDevIndicatorMiddleware() {
return async function disableDevIndicatorMiddleware(req, res, next) {
try {
const { pathname } = new URL(`http://n${req.url}`);
if (!pathname.startsWith(DISABLE_DEV_INDICATOR_PREFIX)) {
return next();
}
if (req.method !== 'POST') {
return middlewareResponse.methodNotAllowed(res);
}
devIndicatorServerState.disabledUntil = Date.now() + COOLDOWN_TIME_MS;
return middlewareResponse.noContent(res);
} catch (err) {
Log.error('Failed to disable the dev indicator:', err instanceof Error ? err.message : err);
return middlewareResponse.internalServerError(res);
}
};
}
//# sourceMappingURL=dev-indicator-middleware.js.map