weread-export 0.1.10 → 0.1.11
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.
- package/lib/index.js +10 -9
- package/lib/types/routes.d.ts +5 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2007,7 +2007,7 @@ async function apiFor(store) {
|
|
|
2007
2007
|
* @returns the route list.
|
|
2008
2008
|
*/
|
|
2009
2009
|
function makeRoutes(deps) {
|
|
2010
|
-
const { store,
|
|
2010
|
+
const { store, getPicker } = deps;
|
|
2011
2011
|
const guard = (req, res, method) => {
|
|
2012
2012
|
if (!isLoopbackRequest(req)) {
|
|
2013
2013
|
writeJson(res, 403, { error: "forbidden: loopback-only" });
|
|
@@ -2130,7 +2130,7 @@ function makeRoutes(deps) {
|
|
|
2130
2130
|
handler: async (req, res) => {
|
|
2131
2131
|
if (!guard(req, res, "POST")) return;
|
|
2132
2132
|
try {
|
|
2133
|
-
const capability =
|
|
2133
|
+
const capability = getPicker?.()?.capability();
|
|
2134
2134
|
if (capability === void 0) {
|
|
2135
2135
|
writeJson(res, 200, {
|
|
2136
2136
|
ok: false,
|
|
@@ -2394,15 +2394,16 @@ function apply(ctx, config) {
|
|
|
2394
2394
|
};
|
|
2395
2395
|
}, "weread-export: tools");
|
|
2396
2396
|
disposeRoutes = ctx.effect(() => {
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2397
|
+
const getPicker = () => {
|
|
2398
|
+
try {
|
|
2399
|
+
return ctx.directoryPicker;
|
|
2400
|
+
} catch {
|
|
2401
|
+
return;
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2403
2404
|
const disposers = makeRoutes({
|
|
2404
2405
|
store,
|
|
2405
|
-
|
|
2406
|
+
getPicker
|
|
2406
2407
|
}).map((route) => ctx.webServer.register(route));
|
|
2407
2408
|
return () => {
|
|
2408
2409
|
for (const dispose of disposers) dispose();
|
package/lib/types/routes.d.ts
CHANGED
|
@@ -32,8 +32,11 @@ export declare const WEREAD_API: {
|
|
|
32
32
|
/** Route handler context. */
|
|
33
33
|
export interface RouteContext {
|
|
34
34
|
store: WereadStore;
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Lazily resolve the host directory picker at request time (by then every
|
|
37
|
+
* plugin is loaded, so the picker service is guaranteed registered).
|
|
38
|
+
*/
|
|
39
|
+
getPicker?: () => NativeDirectoryPicker | undefined;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
39
42
|
* Build every /api/weread-export route (exact paths).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weread-export",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "微信读书 (WeChat Reading) integration for DeepSeek Harness: connect the official WeRead Skills Agent Gateway with a wrk- API key, then browse your bookshelf, export highlights & thoughts, query reading stats, and send highlights to flomo — agent tools plus a web settings panel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|