dsh-rss 0.7.1 → 0.9.0
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/CHANGELOG.md +13 -0
- package/README.en.md +9 -0
- package/README.md +9 -0
- package/docs/CATALOG.md +15 -0
- package/docs/WORKBENCH.md +29 -0
- package/lib/client.js +869 -308
- package/lib/index.js +2 -0
- package/lib/web.js +8 -5
- package/package.json +11 -7
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerUpdates } from '@stardustlc/dsh-updates';
|
|
1
2
|
/**
|
|
2
3
|
* dsh-rss —— RSS/Atom 订阅工具插件(node 半身,配置走 cordis.patch.yml)。
|
|
3
4
|
*
|
|
@@ -20,6 +21,7 @@ export const inject = ['settings', 'tools'];
|
|
|
20
21
|
* @param config - 插件配置(可缺省)。
|
|
21
22
|
*/
|
|
22
23
|
export function apply(ctx, config) {
|
|
24
|
+
registerUpdates(ctx, { name: "dsh-rss" });
|
|
23
25
|
config = liveConfig(config ?? {});
|
|
24
26
|
const cfg = resolveConfig(config);
|
|
25
27
|
installLegacySettingsImport(ctx, config, RSS_SETTINGS_NAMESPACE, 'rss', ['feedsYaml', 'cursorsJson']);
|
package/lib/web.js
CHANGED
|
@@ -111,12 +111,15 @@ export function createRssSettingsBackend(config, scope, options = {}) {
|
|
|
111
111
|
return { opml: buildOpml(subscriptionSnapshot(scope).feeds) };
|
|
112
112
|
if (action === 'preview')
|
|
113
113
|
return { preview: preview(args) };
|
|
114
|
-
if (action === 'previewSource') {
|
|
115
|
-
const source = recommendedSources.find(source => source.id === text(args, 'sourceId'));
|
|
116
|
-
if (!source)
|
|
114
|
+
if (action === 'previewSource' || action === 'previewFeed') {
|
|
115
|
+
const source = action === 'previewSource' ? recommendedSources.find(source => source.id === text(args, 'sourceId')) : undefined;
|
|
116
|
+
if (action === 'previewSource' && !source)
|
|
117
117
|
throw new SubscriptionError('这个推荐源不存在,请刷新目录。');
|
|
118
|
-
const
|
|
119
|
-
|
|
118
|
+
const feed = action === 'previewFeed' ? find(subscriptionSnapshot(scope).feeds, text(args, 'id')) : undefined;
|
|
119
|
+
// Resolve the saved/catalog ID, never a URL supplied alongside it. Preview
|
|
120
|
+
// shares the existing SSRF, redirect, size, timeout and cancellation gates.
|
|
121
|
+
const { parsed, finalUrl } = await check(source?.url ?? feed.url, signal);
|
|
122
|
+
return { [action === 'previewSource' ? 'sourcePreview' : 'feedPreview']: { ...(source ? { sourceId: source.id } : { feedId: feedId(feed.url) }), checkedAt: new Date().toISOString(), title: parsed.feed.title,
|
|
120
123
|
entryCount: parsed.entries.length, entries: parsed.entries.slice(0, 5).map(entry => ({
|
|
121
124
|
title: entry.title.slice(0, 400), link: articleLink(entry.link, finalUrl), pubDate: entry.pubDate.slice(0, 64),
|
|
122
125
|
})) } };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-rss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "订阅和阅读 RSS / Atom,在 DSH 中查看与管理更新。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,17 +23,19 @@
|
|
|
23
23
|
"CHANGELOG.md"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "tsc -p tsconfig.json",
|
|
26
|
+
"build": "tsc -p tsconfig.json && node scripts/build-client.mjs && node scripts/build-updates.mjs",
|
|
27
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
28
|
"test": "pnpm run build && node --test \"test/*.test.mjs\"",
|
|
29
29
|
"prepublishOnly": "pnpm run build"
|
|
30
30
|
},
|
|
31
31
|
"dsh": {
|
|
32
32
|
"client": {
|
|
33
|
+
"platform": "web",
|
|
33
34
|
"inject": [
|
|
34
|
-
"@deepseek-ai/dsh-client-ui-settings"
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-sidebar"
|
|
38
|
+
]
|
|
37
39
|
},
|
|
38
40
|
"bundle": {
|
|
39
41
|
"patch": "./cordis.patch.yml"
|
|
@@ -49,14 +51,16 @@
|
|
|
49
51
|
],
|
|
50
52
|
"license": "MIT",
|
|
51
53
|
"engines": {
|
|
52
|
-
"node": "^22.19.0 || >=24.0.0"
|
|
54
|
+
"node": "^22.19.0 || >=24.0.0",
|
|
55
|
+
"dsh": ">=0.2.1-rc.3"
|
|
53
56
|
},
|
|
54
57
|
"dependencies": {
|
|
55
58
|
"@deepseek-ai/schemastery": "^3.18.3",
|
|
56
59
|
"fast-xml-parser": "^5.0.0",
|
|
57
60
|
"schemastery": "^3.18.0",
|
|
58
61
|
"undici": "^8.12.1",
|
|
59
|
-
"yaml": "^2.9.0"
|
|
62
|
+
"yaml": "^2.9.0",
|
|
63
|
+
"@stardustlc/dsh-updates": "0.1.0"
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
62
66
|
"@types/node": "^24.0.0",
|