feat(karakeep): bookmark fetch client
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
11
lib/karakeep/client.js
Normal file
11
lib/karakeep/client.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export async function getBookmark(id) {
|
||||
const base = process.env.KARAKEEP_API_URL || 'https://karakeep.hynesy.com';
|
||||
const tok = process.env.KARAKEEP_API_TOKEN || '';
|
||||
const res = await fetch(`${base}/api/v1/bookmarks/${encodeURIComponent(id)}`, {
|
||||
headers: { Authorization: 'Bearer ' + tok },
|
||||
signal: AbortSignal.timeout(10_000)
|
||||
});
|
||||
if (res.status === 404) return null;
|
||||
if (!res.ok) throw new Error(`karakeep ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
Reference in New Issue
Block a user