diff --git a/renovate.json b/.github/renovate.json similarity index 100% rename from renovate.json rename to .github/renovate.json diff --git a/electron-builder.yml b/electron/electron-builder.yml similarity index 100% rename from electron-builder.yml rename to electron/electron-builder.yml diff --git a/electron.d.ts b/electron/electron.d.ts similarity index 100% rename from electron.d.ts rename to electron/electron.d.ts diff --git a/package.json b/package.json index 71d20c2..b85e39f 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,11 @@ "electron:compile": "npx esbuild electron/main/index.ts electron/preload/index.ts electron/preload/settings.ts --bundle --platform=node --outdir=dist-electron --external:electron --sourcemap --packages=external && npx shx cp -r electron/settings dist-electron/", "electron:start": "npx cross-env NODE_ENV=development npx electron .", "electron:prepare": "node scripts/prepare-electron-build.mjs", - "dist": "npm run electron:build && npm run electron:prepare && npx electron-builder", - "dist:mac": "npm run electron:build && npm run electron:prepare && npx electron-builder --mac", - "dist:win": "npm run electron:build && npm run electron:prepare && npx electron-builder --win", - "dist:linux": "npm run electron:build && npm run electron:prepare && npx electron-builder --linux", - "dist:all": "npm run electron:build && npm run electron:prepare && npx electron-builder --mac --win --linux" + "dist": "npm run electron:build && npm run electron:prepare && npx electron-builder --config electron/electron-builder.yml", + "dist:mac": "npm run electron:build && npm run electron:prepare && npx electron-builder --config electron/electron-builder.yml --mac", + "dist:win": "npm run electron:build && npm run electron:prepare && npx electron-builder --config electron/electron-builder.yml --win", + "dist:linux": "npm run electron:build && npm run electron:prepare && npx electron-builder --config electron/electron-builder.yml --linux", + "dist:all": "npm run electron:build && npm run electron:prepare && npx electron-builder --config electron/electron-builder.yml --mac --win --linux" }, "dependencies": { "@ai-sdk/amazon-bedrock": "^4.0.1", diff --git a/proxy.ts b/proxy.ts deleted file mode 100644 index 1db77c6..0000000 --- a/proxy.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { match as matchLocale } from "@formatjs/intl-localematcher" -import Negotiator from "negotiator" -import type { NextRequest } from "next/server" -import { NextResponse } from "next/server" -import { i18n } from "./lib/i18n/config" - -function getLocale(request: NextRequest): string | undefined { - // Negotiator expects plain object so we need to transform headers - const negotiatorHeaders: Record = {} - request.headers.forEach((value, key) => { - negotiatorHeaders[key] = value - }) - - // @ts-expect-error locales are readonly - const locales: string[] = i18n.locales - - // Use negotiator and intl-localematcher to get best locale - const languages = new Negotiator({ headers: negotiatorHeaders }).languages( - locales, - ) - - const locale = matchLocale(languages, locales, i18n.defaultLocale) - - return locale -} - -export function proxy(request: NextRequest) { - const pathname = request.nextUrl.pathname - - // Skip API routes, static files, and Next.js internals - if ( - pathname.startsWith("/api/") || - pathname.startsWith("/_next/") || - pathname.includes("/favicon") || - /\.(.*)$/.test(pathname) - ) { - return - } - - // Check if there is any supported locale in the pathname - const pathnameIsMissingLocale = i18n.locales.every( - (locale) => - !pathname.startsWith(`/${locale}/`) && pathname !== `/${locale}`, - ) - - // Redirect if there is no locale - if (pathnameIsMissingLocale) { - const locale = getLocale(request) - - // Redirect to localized path - return NextResponse.redirect( - new URL( - `/${locale}${pathname.startsWith("/") ? "" : "/"}${pathname}`, - request.url, - ), - ) - } -} - -export const config = { - // Matcher ignoring `/_next/` and `/api/` - matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"], -} diff --git a/tsconfig.json b/tsconfig.json index 6b47dbe..dc2ec94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,7 @@ "@/*": ["./*"] } }, + "files": ["electron/electron.d.ts"], "include": [ "next-env.d.ts", "**/*.ts",