mirror of
https://github.com/sortedcord/omnia.git
synced 2026-07-22 20:12:48 +05:30
34 lines
863 B
TypeScript
34 lines
863 B
TypeScript
import type { NextConfig } from "next";
|
|
import { networkInterfaces } from "os";
|
|
|
|
const getLocalIPs = () => {
|
|
const ips: string[] = ["localhost", "127.0.0.1"];
|
|
const nets = networkInterfaces();
|
|
for (const name of Object.keys(nets)) {
|
|
for (const net of nets[name] || []) {
|
|
if (net.family === "IPv4" && !net.internal) {
|
|
ips.push(net.address);
|
|
}
|
|
}
|
|
}
|
|
return ips;
|
|
};
|
|
|
|
const nextConfig: NextConfig = {
|
|
allowedDevOrigins: getLocalIPs(),
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: "/api/:path*",
|
|
headers: [
|
|
{ key: "Access-Control-Allow-Origin", value: "*" },
|
|
{ key: "Access-Control-Allow-Methods", value: "GET,POST,PUT,DELETE,OPTIONS" },
|
|
{ key: "Access-Control-Allow-Headers", value: "Content-Type, Authorization" },
|
|
],
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|