route.ts 806 B

123456789101112131415161718192021222324252627282930
  1. import { NextResponse } from "next/server";
  2. import { getServerSideConfig } from "../../config/server";
  3. const serverConfig = getServerSideConfig();
  4. // Danger! Do not hard code any secret value here!
  5. // 警告!不要在这里写入任何敏感信息!
  6. const DANGER_CONFIG = {
  7. needCode: serverConfig.needCode,
  8. hideUserApiKey: serverConfig.hideUserApiKey,
  9. disableGPT4: serverConfig.disableGPT4,
  10. hideBalanceQuery: serverConfig.hideBalanceQuery,
  11. disableFastLink: serverConfig.disableFastLink,
  12. customModels: serverConfig.customModels,
  13. baseApi: serverConfig.baseApi,
  14. };
  15. declare global {
  16. type DangerConfig = typeof DANGER_CONFIG;
  17. }
  18. async function handle() {
  19. return NextResponse.json(DANGER_CONFIG);
  20. }
  21. export const GET = handle;
  22. export const POST = handle;
  23. export const runtime = "edge";