@shiqianjiang/ceru-plugin-cli 0.1.2 → 0.2.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/README.md +6 -6
- package/assets/core-contracts.js +1 -0
- package/assets/index.html +94 -93
- package/assets/playground.js +293 -30
- package/assets/sandbox.js +50 -19
- package/assets/style.css +16 -0
- package/dist/dependencies.d.ts +6 -0
- package/dist/dependencies.js +45 -0
- package/dist/dev.js +214 -119
- package/dist/index.js +5 -3
- package/dist/project.js +41 -16
- package/dist/socket-broker.d.ts +23 -0
- package/dist/socket-broker.js +230 -0
- package/package.json +71 -67
- package/schemas/config.schema.json +347 -0
- package/templates/connected-library/js/.vscode/ceru.code-snippets +37 -9
- package/templates/connected-library/js/package.json +2 -2
- package/templates/connected-library/js/src/index.js +7 -5
- package/templates/connected-library/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/connected-library/ts/package.json +2 -2
- package/templates/connected-library/ts/src/index.ts +7 -5
- package/templates/guest-adapter/js/.vscode/ceru.code-snippets +37 -9
- package/templates/guest-adapter/js/package.json +2 -2
- package/templates/guest-adapter/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/guest-adapter/ts/package.json +2 -2
- package/templates/importer/js/.vscode/ceru.code-snippets +37 -9
- package/templates/importer/js/README.md +1 -1
- package/templates/importer/js/ceru.plugin.json +8 -24
- package/templates/importer/js/package.json +2 -2
- package/templates/importer/js/src/index.js +28 -34
- package/templates/importer/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/importer/ts/README.md +1 -1
- package/templates/importer/ts/ceru.plugin.json +8 -24
- package/templates/importer/ts/package.json +2 -2
- package/templates/importer/ts/src/index.ts +28 -34
- package/templates/react/js/.vscode/ceru.code-snippets +37 -9
- package/templates/react/js/package.json +2 -2
- package/templates/react/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/react/ts/package.json +2 -2
- package/templates/snapshot.json +4 -2
- package/templates/source/js/.vscode/ceru.code-snippets +37 -9
- package/templates/source/js/ceru.plugin.json +9 -0
- package/templates/source/js/package.json +2 -2
- package/templates/source/js/src/index.js +29 -26
- package/templates/source/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/source/ts/ceru.plugin.json +9 -0
- package/templates/source/ts/package.json +2 -2
- package/templates/source/ts/src/index.ts +29 -26
- package/templates/vue/js/.vscode/ceru.code-snippets +37 -9
- package/templates/vue/js/package.json +2 -2
- package/templates/vue/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/vue/ts/package.json +2 -2
- package/templates/vue-tsx/js/.vscode/ceru.code-snippets +37 -9
- package/templates/vue-tsx/js/package.json +2 -2
- package/templates/vue-tsx/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/vue-tsx/ts/package.json +2 -2
- package/templates/web-dist/js/.vscode/ceru.code-snippets +37 -9
- package/templates/web-dist/js/package.json +2 -2
- package/templates/web-dist/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/web-dist/ts/package.json +2 -2
- package/templates/web-surface/js/.vscode/ceru.code-snippets +37 -9
- package/templates/web-surface/js/ceru.plugin.json +9 -0
- package/templates/web-surface/js/package.json +2 -2
- package/templates/web-surface/js/src/view.js +4 -1
- package/templates/web-surface/js/ui/search-note.css +3 -0
- package/templates/web-surface/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/web-surface/ts/ceru.plugin.json +9 -0
- package/templates/web-surface/ts/package.json +2 -2
- package/templates/web-surface/ts/src/view.ts +4 -1
- package/templates/web-surface/ts/ui/search-note.css +3 -0
|
@@ -149,6 +149,339 @@
|
|
|
149
149
|
"contributes": {
|
|
150
150
|
"type": "object",
|
|
151
151
|
"properties": {
|
|
152
|
+
"menus": {
|
|
153
|
+
"type": "array",
|
|
154
|
+
"maxItems": 64,
|
|
155
|
+
"items": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"properties": {
|
|
158
|
+
"id": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
161
|
+
},
|
|
162
|
+
"title": {
|
|
163
|
+
"type": "string",
|
|
164
|
+
"minLength": 1,
|
|
165
|
+
"maxLength": 4096
|
|
166
|
+
},
|
|
167
|
+
"commandId": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
170
|
+
},
|
|
171
|
+
"slot": {
|
|
172
|
+
"enum": [
|
|
173
|
+
"playlist.import",
|
|
174
|
+
"playlist.actions",
|
|
175
|
+
"track.actions",
|
|
176
|
+
"player.actions",
|
|
177
|
+
"search.tools"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"icon": {
|
|
181
|
+
"oneOf": [
|
|
182
|
+
{
|
|
183
|
+
"type": "object",
|
|
184
|
+
"properties": {
|
|
185
|
+
"kind": {
|
|
186
|
+
"const": "host"
|
|
187
|
+
},
|
|
188
|
+
"name": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"minLength": 1,
|
|
191
|
+
"maxLength": 4096
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"required": [
|
|
195
|
+
"kind",
|
|
196
|
+
"name"
|
|
197
|
+
],
|
|
198
|
+
"additionalProperties": false
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"type": "object",
|
|
202
|
+
"properties": {
|
|
203
|
+
"kind": {
|
|
204
|
+
"const": "asset"
|
|
205
|
+
},
|
|
206
|
+
"resource": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"required": [
|
|
212
|
+
"kind",
|
|
213
|
+
"resource"
|
|
214
|
+
],
|
|
215
|
+
"additionalProperties": false
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"when": {
|
|
220
|
+
"type": "object",
|
|
221
|
+
"properties": {
|
|
222
|
+
"kinds": {
|
|
223
|
+
"type": "array",
|
|
224
|
+
"items": {
|
|
225
|
+
"enum": [
|
|
226
|
+
"track",
|
|
227
|
+
"playlist"
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"loggedIn": {
|
|
232
|
+
"type": "boolean"
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"required": [],
|
|
236
|
+
"additionalProperties": false
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"required": [
|
|
240
|
+
"id",
|
|
241
|
+
"slot",
|
|
242
|
+
"title",
|
|
243
|
+
"commandId"
|
|
244
|
+
],
|
|
245
|
+
"additionalProperties": false
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"homeSections": {
|
|
249
|
+
"type": "array",
|
|
250
|
+
"maxItems": 32,
|
|
251
|
+
"items": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"properties": {
|
|
254
|
+
"id": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
257
|
+
},
|
|
258
|
+
"title": {
|
|
259
|
+
"type": "string",
|
|
260
|
+
"minLength": 1,
|
|
261
|
+
"maxLength": 4096
|
|
262
|
+
},
|
|
263
|
+
"kind": {
|
|
264
|
+
"enum": [
|
|
265
|
+
"playlists",
|
|
266
|
+
"charts",
|
|
267
|
+
"custom"
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
"icon": {
|
|
271
|
+
"oneOf": [
|
|
272
|
+
{
|
|
273
|
+
"type": "object",
|
|
274
|
+
"properties": {
|
|
275
|
+
"kind": {
|
|
276
|
+
"const": "host"
|
|
277
|
+
},
|
|
278
|
+
"name": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"minLength": 1,
|
|
281
|
+
"maxLength": 4096
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"required": [
|
|
285
|
+
"kind",
|
|
286
|
+
"name"
|
|
287
|
+
],
|
|
288
|
+
"additionalProperties": false
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"type": "object",
|
|
292
|
+
"properties": {
|
|
293
|
+
"kind": {
|
|
294
|
+
"const": "asset"
|
|
295
|
+
},
|
|
296
|
+
"resource": {
|
|
297
|
+
"type": "string",
|
|
298
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"required": [
|
|
302
|
+
"kind",
|
|
303
|
+
"resource"
|
|
304
|
+
],
|
|
305
|
+
"additionalProperties": false
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
"view": {
|
|
310
|
+
"type": "string",
|
|
311
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
312
|
+
},
|
|
313
|
+
"providerIds": {
|
|
314
|
+
"type": "array",
|
|
315
|
+
"items": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"minLength": 1,
|
|
318
|
+
"maxLength": 4096
|
|
319
|
+
},
|
|
320
|
+
"maxItems": 128,
|
|
321
|
+
"uniqueItems": true
|
|
322
|
+
},
|
|
323
|
+
"order": {
|
|
324
|
+
"type": "integer",
|
|
325
|
+
"minimum": -1000,
|
|
326
|
+
"maximum": 1000
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"required": [
|
|
330
|
+
"id",
|
|
331
|
+
"title",
|
|
332
|
+
"kind"
|
|
333
|
+
],
|
|
334
|
+
"additionalProperties": false
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
"uiExtensions": {
|
|
338
|
+
"type": "array",
|
|
339
|
+
"maxItems": 64,
|
|
340
|
+
"items": {
|
|
341
|
+
"type": "object",
|
|
342
|
+
"properties": {
|
|
343
|
+
"id": {
|
|
344
|
+
"type": "string",
|
|
345
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
346
|
+
},
|
|
347
|
+
"slot": {
|
|
348
|
+
"enum": [
|
|
349
|
+
"home.header",
|
|
350
|
+
"home.content.before",
|
|
351
|
+
"home.content.after",
|
|
352
|
+
"search.source-selector.after",
|
|
353
|
+
"playlist.header.actions",
|
|
354
|
+
"playlist.item.actions",
|
|
355
|
+
"player.actions",
|
|
356
|
+
"settings.sections"
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
"mode": {
|
|
360
|
+
"enum": [
|
|
361
|
+
"append",
|
|
362
|
+
"prepend",
|
|
363
|
+
"wrap",
|
|
364
|
+
"replace"
|
|
365
|
+
]
|
|
366
|
+
},
|
|
367
|
+
"view": {
|
|
368
|
+
"type": "string",
|
|
369
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
370
|
+
},
|
|
371
|
+
"order": {
|
|
372
|
+
"type": "integer",
|
|
373
|
+
"minimum": -1000,
|
|
374
|
+
"maximum": 1000
|
|
375
|
+
},
|
|
376
|
+
"when": {
|
|
377
|
+
"type": "object",
|
|
378
|
+
"properties": {
|
|
379
|
+
"loggedIn": {
|
|
380
|
+
"type": "boolean"
|
|
381
|
+
},
|
|
382
|
+
"route": {
|
|
383
|
+
"type": "string",
|
|
384
|
+
"minLength": 1,
|
|
385
|
+
"maxLength": 4096
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"required": [],
|
|
389
|
+
"additionalProperties": false
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
"required": [
|
|
393
|
+
"id",
|
|
394
|
+
"slot",
|
|
395
|
+
"mode",
|
|
396
|
+
"view"
|
|
397
|
+
],
|
|
398
|
+
"additionalProperties": false
|
|
399
|
+
}
|
|
400
|
+
},
|
|
401
|
+
"styles": {
|
|
402
|
+
"type": "array",
|
|
403
|
+
"maxItems": 64,
|
|
404
|
+
"items": {
|
|
405
|
+
"type": "object",
|
|
406
|
+
"properties": {
|
|
407
|
+
"id": {
|
|
408
|
+
"type": "string",
|
|
409
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
410
|
+
},
|
|
411
|
+
"resource": {
|
|
412
|
+
"type": "string",
|
|
413
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
414
|
+
},
|
|
415
|
+
"scope": {
|
|
416
|
+
"enum": [
|
|
417
|
+
"surface",
|
|
418
|
+
"slot",
|
|
419
|
+
"application"
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
"slots": {
|
|
423
|
+
"type": "array",
|
|
424
|
+
"maxItems": 16,
|
|
425
|
+
"items": {
|
|
426
|
+
"enum": [
|
|
427
|
+
"home.header",
|
|
428
|
+
"home.content.before",
|
|
429
|
+
"home.content.after",
|
|
430
|
+
"search.source-selector.after",
|
|
431
|
+
"playlist.header.actions",
|
|
432
|
+
"playlist.item.actions",
|
|
433
|
+
"player.actions",
|
|
434
|
+
"settings.sections"
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
"order": {
|
|
439
|
+
"type": "integer",
|
|
440
|
+
"minimum": -1000,
|
|
441
|
+
"maximum": 1000
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
"required": [
|
|
445
|
+
"id",
|
|
446
|
+
"resource",
|
|
447
|
+
"scope"
|
|
448
|
+
],
|
|
449
|
+
"additionalProperties": false
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
"playlistImporters": {
|
|
453
|
+
"type": "array",
|
|
454
|
+
"maxItems": 64,
|
|
455
|
+
"items": {
|
|
456
|
+
"type": "object",
|
|
457
|
+
"properties": {
|
|
458
|
+
"id": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$"
|
|
461
|
+
},
|
|
462
|
+
"title": {
|
|
463
|
+
"type": "string",
|
|
464
|
+
"minLength": 1,
|
|
465
|
+
"maxLength": 4096
|
|
466
|
+
},
|
|
467
|
+
"description": {
|
|
468
|
+
"type": "string",
|
|
469
|
+
"minLength": 1,
|
|
470
|
+
"maxLength": 4096
|
|
471
|
+
},
|
|
472
|
+
"placeholder": {
|
|
473
|
+
"type": "string",
|
|
474
|
+
"minLength": 1,
|
|
475
|
+
"maxLength": 4096
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
"required": [
|
|
479
|
+
"id",
|
|
480
|
+
"title"
|
|
481
|
+
],
|
|
482
|
+
"additionalProperties": false
|
|
483
|
+
}
|
|
484
|
+
},
|
|
152
485
|
"providers": {
|
|
153
486
|
"type": "array",
|
|
154
487
|
"maxItems": 64,
|
|
@@ -413,7 +746,21 @@
|
|
|
413
746
|
},
|
|
414
747
|
"name": {
|
|
415
748
|
"enum": [
|
|
749
|
+
"account.profile",
|
|
750
|
+
"downloads.manage",
|
|
751
|
+
"localMusic.read",
|
|
752
|
+
"localMusic.write",
|
|
753
|
+
"settings.read",
|
|
754
|
+
"settings.write",
|
|
755
|
+
"window.control",
|
|
756
|
+
"hotkeys.register",
|
|
757
|
+
"rooms.read",
|
|
758
|
+
"rooms.control",
|
|
759
|
+
"ai.use",
|
|
760
|
+
"devices.control",
|
|
761
|
+
"ui.styles.global",
|
|
416
762
|
"network.request",
|
|
763
|
+
"network.socket",
|
|
417
764
|
"network.private",
|
|
418
765
|
"network.discovery",
|
|
419
766
|
"credentials.use",
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Host platform icon": {
|
|
3
3
|
"prefix": "ceru-icon",
|
|
4
|
-
"body": [
|
|
5
|
-
|
|
6
|
-
],
|
|
7
|
-
"description": "使用宿主平台图标,无需打入插件"
|
|
4
|
+
"body": ["{ kind: 'host', name: 'platform.${1:tx}' }"],
|
|
5
|
+
"description": "使用宿主平台图标,无需打入插件",
|
|
8
6
|
},
|
|
9
7
|
"Host lodash": {
|
|
10
8
|
"prefix": "ceru-lodash",
|
|
9
|
+
"body": ["ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"],
|
|
10
|
+
"description": "调用宿主的带类型 Lodash 工具",
|
|
11
|
+
},
|
|
12
|
+
"Host HTTP client": {
|
|
13
|
+
"prefix": "ceru-http",
|
|
14
|
+
"body": [
|
|
15
|
+
"const http = ctx.http.create({",
|
|
16
|
+
" baseURL: '${1:https://example.com}',",
|
|
17
|
+
" permissionKey: '${2:api}',",
|
|
18
|
+
" requestPermission: true,",
|
|
19
|
+
"})",
|
|
20
|
+
],
|
|
21
|
+
"description": "使用宿主 Axios 代理;无需将请求库打入插件",
|
|
22
|
+
},
|
|
23
|
+
"Permission group": {
|
|
24
|
+
"prefix": "ceru-permission-group",
|
|
11
25
|
"body": [
|
|
12
|
-
"ctx.
|
|
26
|
+
"const permission = await ctx.permissions.requestGroup({",
|
|
27
|
+
" group: '${1:libraryRead}',",
|
|
28
|
+
" intent: operation.userIntent,",
|
|
29
|
+
"})",
|
|
13
30
|
],
|
|
14
|
-
"description": "
|
|
31
|
+
"description": "一次申请一组用户可理解的能力",
|
|
32
|
+
},
|
|
33
|
+
"Grouped music provider": {
|
|
34
|
+
"prefix": "ceru-provider",
|
|
35
|
+
"body": [
|
|
36
|
+
"ctx.providers.register('${1:catalog}', {",
|
|
37
|
+
" tracks: { search: ${2:searchTracks}, resolve: ${3:resolveTrack}, lyrics: ${4:getLyrics} },",
|
|
38
|
+
" playlists: { search: ${5:searchPlaylists}, categories: ${6:getCategories}, list: ${7:listPlaylists}, get: ${8:getPlaylist} },",
|
|
39
|
+
" charts: { list: ${9:listCharts}, getTracks: ${10:getChartTracks} },",
|
|
40
|
+
"})",
|
|
41
|
+
],
|
|
42
|
+
"description": "注册分组 Provider,返回标准歌曲/歌单/歌词 JSON",
|
|
15
43
|
},
|
|
16
44
|
"Source rate limit": {
|
|
17
45
|
"prefix": "ceru-rate-limit",
|
|
@@ -20,8 +48,8 @@
|
|
|
20
48
|
" code: 'RATE_LIMITED',",
|
|
21
49
|
" message: '${1:请稍后重试}',",
|
|
22
50
|
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
-
"})"
|
|
51
|
+
"})",
|
|
24
52
|
],
|
|
25
|
-
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
-
}
|
|
53
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互",
|
|
54
|
+
},
|
|
27
55
|
}
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"preview": "ceru-plugin preview dist/plugin.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@shiqianjiang/ceru-plugin-sdk": "^0.
|
|
14
|
+
"@shiqianjiang/ceru-plugin-sdk": "^0.2.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@shiqianjiang/ceru-plugin-cli": "^0.
|
|
17
|
+
"@shiqianjiang/ceru-plugin-cli": "^0.2.0",
|
|
18
18
|
"typescript": "~5.9.3",
|
|
19
19
|
"electron": "^44.4.2",
|
|
20
20
|
"prettier": "^3.6.2"
|
|
@@ -28,11 +28,13 @@ export default definePlugin(async (ctx) => {
|
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
ctx.providers.register('catalog', {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
tracks: {
|
|
32
|
+
async search() {
|
|
33
|
+
return { items: [] }
|
|
34
|
+
},
|
|
35
|
+
async resolve() {
|
|
36
|
+
return ctx.playback.failure({ code: 'UNSUPPORTED', message: '请接入真实音乐库 API' })
|
|
37
|
+
},
|
|
36
38
|
},
|
|
37
39
|
})
|
|
38
40
|
})
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Host platform icon": {
|
|
3
3
|
"prefix": "ceru-icon",
|
|
4
|
-
"body": [
|
|
5
|
-
|
|
6
|
-
],
|
|
7
|
-
"description": "使用宿主平台图标,无需打入插件"
|
|
4
|
+
"body": ["{ kind: 'host', name: 'platform.${1:tx}' }"],
|
|
5
|
+
"description": "使用宿主平台图标,无需打入插件",
|
|
8
6
|
},
|
|
9
7
|
"Host lodash": {
|
|
10
8
|
"prefix": "ceru-lodash",
|
|
9
|
+
"body": ["ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"],
|
|
10
|
+
"description": "调用宿主的带类型 Lodash 工具",
|
|
11
|
+
},
|
|
12
|
+
"Host HTTP client": {
|
|
13
|
+
"prefix": "ceru-http",
|
|
14
|
+
"body": [
|
|
15
|
+
"const http = ctx.http.create({",
|
|
16
|
+
" baseURL: '${1:https://example.com}',",
|
|
17
|
+
" permissionKey: '${2:api}',",
|
|
18
|
+
" requestPermission: true,",
|
|
19
|
+
"})",
|
|
20
|
+
],
|
|
21
|
+
"description": "使用宿主 Axios 代理;无需将请求库打入插件",
|
|
22
|
+
},
|
|
23
|
+
"Permission group": {
|
|
24
|
+
"prefix": "ceru-permission-group",
|
|
11
25
|
"body": [
|
|
12
|
-
"ctx.
|
|
26
|
+
"const permission = await ctx.permissions.requestGroup({",
|
|
27
|
+
" group: '${1:libraryRead}',",
|
|
28
|
+
" intent: operation.userIntent,",
|
|
29
|
+
"})",
|
|
13
30
|
],
|
|
14
|
-
"description": "
|
|
31
|
+
"description": "一次申请一组用户可理解的能力",
|
|
32
|
+
},
|
|
33
|
+
"Grouped music provider": {
|
|
34
|
+
"prefix": "ceru-provider",
|
|
35
|
+
"body": [
|
|
36
|
+
"ctx.providers.register('${1:catalog}', {",
|
|
37
|
+
" tracks: { search: ${2:searchTracks}, resolve: ${3:resolveTrack}, lyrics: ${4:getLyrics} },",
|
|
38
|
+
" playlists: { search: ${5:searchPlaylists}, categories: ${6:getCategories}, list: ${7:listPlaylists}, get: ${8:getPlaylist} },",
|
|
39
|
+
" charts: { list: ${9:listCharts}, getTracks: ${10:getChartTracks} },",
|
|
40
|
+
"})",
|
|
41
|
+
],
|
|
42
|
+
"description": "注册分组 Provider,返回标准歌曲/歌单/歌词 JSON",
|
|
15
43
|
},
|
|
16
44
|
"Source rate limit": {
|
|
17
45
|
"prefix": "ceru-rate-limit",
|
|
@@ -20,8 +48,8 @@
|
|
|
20
48
|
" code: 'RATE_LIMITED',",
|
|
21
49
|
" message: '${1:请稍后重试}',",
|
|
22
50
|
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
-
"})"
|
|
51
|
+
"})",
|
|
24
52
|
],
|
|
25
|
-
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
-
}
|
|
53
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互",
|
|
54
|
+
},
|
|
27
55
|
}
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"preview": "ceru-plugin preview dist/plugin.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@shiqianjiang/ceru-plugin-sdk": "^0.
|
|
14
|
+
"@shiqianjiang/ceru-plugin-sdk": "^0.2.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@shiqianjiang/ceru-plugin-cli": "^0.
|
|
17
|
+
"@shiqianjiang/ceru-plugin-cli": "^0.2.0",
|
|
18
18
|
"typescript": "~5.9.3",
|
|
19
19
|
"electron": "^44.4.2",
|
|
20
20
|
"prettier": "^3.6.2"
|
|
@@ -28,11 +28,13 @@ export default definePlugin(async (ctx) => {
|
|
|
28
28
|
})
|
|
29
29
|
|
|
30
30
|
ctx.providers.register('catalog', {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
tracks: {
|
|
32
|
+
async search() {
|
|
33
|
+
return { items: [] }
|
|
34
|
+
},
|
|
35
|
+
async resolve() {
|
|
36
|
+
return ctx.playback.failure({ code: 'UNSUPPORTED', message: '请接入真实音乐库 API' })
|
|
37
|
+
},
|
|
36
38
|
},
|
|
37
39
|
})
|
|
38
40
|
})
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Host platform icon": {
|
|
3
3
|
"prefix": "ceru-icon",
|
|
4
|
-
"body": [
|
|
5
|
-
|
|
6
|
-
],
|
|
7
|
-
"description": "使用宿主平台图标,无需打入插件"
|
|
4
|
+
"body": ["{ kind: 'host', name: 'platform.${1:tx}' }"],
|
|
5
|
+
"description": "使用宿主平台图标,无需打入插件",
|
|
8
6
|
},
|
|
9
7
|
"Host lodash": {
|
|
10
8
|
"prefix": "ceru-lodash",
|
|
9
|
+
"body": ["ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"],
|
|
10
|
+
"description": "调用宿主的带类型 Lodash 工具",
|
|
11
|
+
},
|
|
12
|
+
"Host HTTP client": {
|
|
13
|
+
"prefix": "ceru-http",
|
|
14
|
+
"body": [
|
|
15
|
+
"const http = ctx.http.create({",
|
|
16
|
+
" baseURL: '${1:https://example.com}',",
|
|
17
|
+
" permissionKey: '${2:api}',",
|
|
18
|
+
" requestPermission: true,",
|
|
19
|
+
"})",
|
|
20
|
+
],
|
|
21
|
+
"description": "使用宿主 Axios 代理;无需将请求库打入插件",
|
|
22
|
+
},
|
|
23
|
+
"Permission group": {
|
|
24
|
+
"prefix": "ceru-permission-group",
|
|
11
25
|
"body": [
|
|
12
|
-
"ctx.
|
|
26
|
+
"const permission = await ctx.permissions.requestGroup({",
|
|
27
|
+
" group: '${1:libraryRead}',",
|
|
28
|
+
" intent: operation.userIntent,",
|
|
29
|
+
"})",
|
|
13
30
|
],
|
|
14
|
-
"description": "
|
|
31
|
+
"description": "一次申请一组用户可理解的能力",
|
|
32
|
+
},
|
|
33
|
+
"Grouped music provider": {
|
|
34
|
+
"prefix": "ceru-provider",
|
|
35
|
+
"body": [
|
|
36
|
+
"ctx.providers.register('${1:catalog}', {",
|
|
37
|
+
" tracks: { search: ${2:searchTracks}, resolve: ${3:resolveTrack}, lyrics: ${4:getLyrics} },",
|
|
38
|
+
" playlists: { search: ${5:searchPlaylists}, categories: ${6:getCategories}, list: ${7:listPlaylists}, get: ${8:getPlaylist} },",
|
|
39
|
+
" charts: { list: ${9:listCharts}, getTracks: ${10:getChartTracks} },",
|
|
40
|
+
"})",
|
|
41
|
+
],
|
|
42
|
+
"description": "注册分组 Provider,返回标准歌曲/歌单/歌词 JSON",
|
|
15
43
|
},
|
|
16
44
|
"Source rate limit": {
|
|
17
45
|
"prefix": "ceru-rate-limit",
|
|
@@ -20,8 +48,8 @@
|
|
|
20
48
|
" code: 'RATE_LIMITED',",
|
|
21
49
|
" message: '${1:请稍后重试}',",
|
|
22
50
|
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
-
"})"
|
|
51
|
+
"})",
|
|
24
52
|
],
|
|
25
|
-
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
-
}
|
|
53
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互",
|
|
54
|
+
},
|
|
27
55
|
}
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"preview": "ceru-plugin preview dist/plugin.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@shiqianjiang/ceru-plugin-sdk": "^0.
|
|
14
|
+
"@shiqianjiang/ceru-plugin-sdk": "^0.2.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@shiqianjiang/ceru-plugin-cli": "^0.
|
|
17
|
+
"@shiqianjiang/ceru-plugin-cli": "^0.2.0",
|
|
18
18
|
"typescript": "~5.9.3",
|
|
19
19
|
"electron": "^44.4.2",
|
|
20
20
|
"prettier": "^3.6.2"
|