imdone-core 1.54.10 → 1.54.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.
|
@@ -5,21 +5,32 @@ const {
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
|
|
7
7
|
getAvailablePlugins: async function () {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
try {
|
|
9
|
+
const response = await fetch('https://raw.githubusercontent.com/imdone/imdone-plugins/main/index.json')
|
|
10
|
+
const plugins = response.body
|
|
11
|
+
for (const plugin of plugins) {
|
|
12
|
+
plugin.content = renderMarkdown(await getReadmeContent(plugin))
|
|
13
|
+
}
|
|
14
|
+
return plugins
|
|
15
|
+
} catch (error) {
|
|
16
|
+
console.error('Failed to fetch available plugins:', error.message)
|
|
17
|
+
return []
|
|
12
18
|
}
|
|
13
|
-
return plugins
|
|
14
19
|
},
|
|
15
20
|
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
async function getReadmeContent({version}) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(`https://api.github.com/repos/${version}/readme`)
|
|
26
|
+
const { content } = response.body
|
|
27
|
+
if (!content) return ''
|
|
28
|
+
const buffer = Buffer.from(content, 'base64');
|
|
29
|
+
return buffer.toString('utf-8');
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(`Failed to fetch README for ${version}:`, error.message)
|
|
32
|
+
return ''
|
|
33
|
+
}
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
const https = require('https')
|