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
- const response = await fetch('https://raw.githubusercontent.com/imdone/imdone-plugins/main/index.json')
9
- const plugins = response.body
10
- for (const plugin of plugins) {
11
- plugin.content = renderMarkdown(await getReadmeContent(plugin))
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
- const response = await fetch(`https://api.github.com/repos/${version}/readme`)
20
- const { content } = response.body
21
- const buffer = Buffer.from(content, 'base64');
22
- return buffer.toString('utf-8');
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')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imdone-core",
3
- "version": "1.54.10",
3
+ "version": "1.54.11",
4
4
  "description": "imdone-core",
5
5
  "main": "index.js",
6
6
  "bin": {