-
Notifications
You must be signed in to change notification settings - Fork 870
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: rewind keyword search * fix: use FTS , improve request handling * fix: ai settings and date navigation * fix: type error * fix: improve the suggestion feature * feat: rtl scroll * feat: filter by apps, improve ux while search * fix: remove highlight keyword * feat: add frame url * fix: data filter broken, scroll direction, enter to search * fix: ffmpeg error * feat: add loading spinner when image are loading --------- Co-authored-by: shaikzeeshan <shaikzeeshan999@gmail.com undefined>
- Loading branch information
1 parent
d350263
commit 67f624b
Showing
40 changed files
with
3,883 additions
and
1,478 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,59 @@ | ||
// app/api/settings/route.ts | ||
import { pipe } from "@screenpipe/js"; | ||
import { NextResponse } from "next/server"; | ||
import type { Settings } from "@screenpipe/js"; | ||
import { getDefaultSettings } from "@screenpipe/browser"; | ||
// Force Node.js runtime | ||
export const runtime = "nodejs"; // Add this line | ||
export const dynamic = "force-dynamic"; | ||
|
||
export async function GET() { | ||
const defaultSettings = getDefaultSettings(); | ||
try { | ||
const settingsManager = pipe.settings; | ||
if (!settingsManager) { | ||
throw new Error("settingsManager not found"); | ||
} | ||
const rawSettings = await settingsManager.getAll(); | ||
return NextResponse.json(rawSettings); | ||
} catch (error) { | ||
console.error("failed to get settings:", error); | ||
return NextResponse.json(defaultSettings); | ||
} | ||
const defaultSettings = getDefaultSettings(); | ||
try { | ||
const settingsManager = pipe.settings; | ||
if (!settingsManager) { | ||
throw new Error("settingsManager not found"); | ||
} | ||
const rawSettings = await settingsManager.getAll(); | ||
return NextResponse.json(rawSettings); | ||
} catch (error) { | ||
console.error("failed to get settings:", error); | ||
return NextResponse.json(defaultSettings); | ||
} | ||
} | ||
|
||
export async function PUT(request: Request) { | ||
try { | ||
const settingsManager = pipe.settings; | ||
if (!settingsManager) { | ||
throw new Error("settingsManager not found"); | ||
} | ||
try { | ||
const settingsManager = pipe.settings; | ||
if (!settingsManager) { | ||
throw new Error("settingsManager not found"); | ||
} | ||
|
||
const body = await request.json(); | ||
const { key, value, isPartialUpdate, reset } = body; | ||
const body = await request.json(); | ||
const { key, value, isPartialUpdate, reset } = body; | ||
|
||
if (reset) { | ||
if (key) { | ||
await settingsManager.resetKey(key); | ||
} else { | ||
await settingsManager.reset(); | ||
} | ||
return NextResponse.json({ success: true }); | ||
} | ||
if (reset) { | ||
if (key) { | ||
await settingsManager.resetKey(key); | ||
} else { | ||
await settingsManager.reset(); | ||
} | ||
return NextResponse.json({ success: true }); | ||
} | ||
|
||
if (isPartialUpdate) { | ||
const serializedSettings = JSON.parse(JSON.stringify(value)); | ||
await settingsManager.update(serializedSettings); | ||
} else { | ||
const serializedValue = JSON.parse(JSON.stringify(value)); | ||
await settingsManager.set(key, serializedValue); | ||
} | ||
if (isPartialUpdate) { | ||
const serializedSettings = JSON.parse(JSON.stringify(value)); | ||
await settingsManager.update(serializedSettings); | ||
} else { | ||
const serializedValue = JSON.parse(JSON.stringify(value)); | ||
await settingsManager.set(key, serializedValue); | ||
} | ||
|
||
return NextResponse.json({ success: true }); | ||
} catch (error) { | ||
console.error("failed to update settings:", error); | ||
return NextResponse.json( | ||
{ error: "failed to update settings" }, | ||
{ status: 500 } | ||
); | ||
} | ||
return NextResponse.json({ success: true }); | ||
} catch (error) { | ||
console.error("failed to update settings:", error); | ||
return NextResponse.json( | ||
{ error: "failed to update settings" }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.