@geminilight/mindos 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ export const dynamic = 'force-dynamic';
2
+ import { NextRequest, NextResponse } from 'next/server';
3
+ import { createConnection } from 'net';
4
+
5
+ function isPortInUse(port: number): Promise<boolean> {
6
+ return new Promise(resolve => {
7
+ const sock = createConnection({ port, host: '127.0.0.1' });
8
+ const cleanup = (result: boolean) => { sock.destroy(); resolve(result); };
9
+ sock.setTimeout(500, () => cleanup(false));
10
+ sock.once('connect', () => cleanup(true));
11
+ sock.once('error', (err: NodeJS.ErrnoException) => {
12
+ // ECONNREFUSED = port open but no listener → not in use
13
+ // Other errors (EACCES, ENETUNREACH) = treat as unavailable to be safe
14
+ resolve(err.code !== 'ECONNREFUSED');
15
+ });
16
+ });
17
+ }
18
+
19
+ async function findFreePort(start: number): Promise<number | null> {
20
+ for (let p = start; p <= 65535; p++) {
21
+ if (!await isPortInUse(p)) return p;
22
+ }
23
+ return null;
24
+ }
25
+
26
+ export async function POST(req: NextRequest) {
27
+ try {
28
+ const { port } = await req.json() as { port: number };
29
+ if (!port || port < 1024 || port > 65535) {
30
+ return NextResponse.json({ error: 'Invalid port' }, { status: 400 });
31
+ }
32
+ const inUse = await isPortInUse(port);
33
+ if (!inUse) {
34
+ return NextResponse.json({ available: true });
35
+ }
36
+ const suggestion = await findFreePort(port + 1);
37
+ return NextResponse.json({ available: false, suggestion });
38
+ } catch (err) {
39
+ return NextResponse.json({ error: String(err) }, { status: 500 });
40
+ }
41
+ }
@@ -1,5 +1,5 @@
1
1
  import type { Metadata } from 'next';
2
- import { Geist, Geist_Mono, IBM_Plex_Mono, IBM_Plex_Sans, Lora } from 'next/font/google';
2
+ import { Inter, IBM_Plex_Mono, IBM_Plex_Sans, Lora } from 'next/font/google';
3
3
  import './globals.css';
4
4
  import { getFileTree } from '@/lib/fs';
5
5
  import ShellLayout from '@/components/ShellLayout';
@@ -9,13 +9,14 @@ import ErrorBoundary from '@/components/ErrorBoundary';
9
9
  import RegisterSW from './register-sw';
10
10
  import UpdateBanner from '@/components/UpdateBanner';
11
11
 
12
- const geistSans = Geist({
12
+ const geistSans = Inter({
13
13
  variable: '--font-geist-sans',
14
14
  subsets: ['latin'],
15
15
  });
16
16
 
17
- const geistMono = Geist_Mono({
17
+ const geistMono = IBM_Plex_Mono({
18
18
  variable: '--font-geist-mono',
19
+ weight: ['400', '600'],
19
20
  subsets: ['latin'],
20
21
  });
21
22
 
package/app/app/page.tsx CHANGED
@@ -5,6 +5,8 @@ import { getAllRenderers } from '@/lib/renderers/registry';
5
5
  import '@/lib/renderers/index'; // registers all renderers
6
6
  import HomeContent from '@/components/HomeContent';
7
7
 
8
+ export const dynamic = 'force-dynamic';
9
+
8
10
  function getExistingFiles(paths: string[]): string[] {
9
11
  return paths.filter(p => {
10
12
  try { getFileContent(p); return true; } catch { return false; }
@@ -2,6 +2,8 @@ import { redirect } from 'next/navigation';
2
2
  import { readSettings } from '@/lib/settings';
3
3
  import SetupWizard from '@/components/SetupWizard';
4
4
 
5
+ export const dynamic = 'force-dynamic';
6
+
5
7
  export default function SetupPage() {
6
8
  const settings = readSettings();
7
9
  if (!settings.setupPending) redirect('/');