Skip to content

Commit 5a98996

Browse files
committed
feat: 初始化插件市场
0 parents  commit 5a98996

15 files changed

Lines changed: 457 additions & 0 deletions

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 每个作者只对自己的插件目录拥有权限;首次上架仍由维护者人工审核合并。
2+
# 一个作者一行,按 @id 前缀匹配。
3+
/plugins/imsyy.* @imsyy

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: 插件开发文档
4+
url: https://splayer-next.imsyy.top/plugins/
5+
about: 编写插件前请先阅读
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 提交插件
2+
description: 提交新插件或更新已有插件
3+
title: "[插件] "
4+
labels: ["plugin-submission"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: 提交前请阅读 https://splayer-next.imsyy.top/plugins/
9+
- type: input
10+
id: plugin-id
11+
attributes:
12+
label: 插件 @id
13+
description: 与脚本头部 @id 一致,全局唯一,上架后不可更改
14+
placeholder: yourname.plugin
15+
validations:
16+
required: true
17+
- type: textarea
18+
id: source
19+
attributes:
20+
label: 脚本
21+
description: 把 .js 拖到此处上传,或粘贴脚本 raw 直链。更新插件请先提高脚本里的 @version。
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: notes
26+
attributes:
27+
label: 备注
28+
validations:
29+
required: false
30+
- type: checkboxes
31+
id: ack
32+
attributes:
33+
label: 确认
34+
options:
35+
- label: 我对脚本内容与合法性负责
36+
required: true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: build-registry
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "plugins/**"
8+
- "scripts/build-registry.mjs"
9+
10+
concurrency:
11+
group: build-registry
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
# 生成 registry.json(updateUrl 指向中央 raw)
26+
- run: REPO_RAW=https://raw.githubusercontent.com/${{ github.repository }}/main node scripts/build-registry.mjs
27+
# 回提 registry.json;它不在 plugins/ 下,不会再次触发本工作流
28+
- run: |
29+
git config user.name 'github-actions[bot]'
30+
git config user.email 'github-actions[bot]@users.noreply.github.com'
31+
git add registry.json
32+
git diff --cached --quiet || git commit -m 'chore: 重建 registry.json'
33+
git push

.github/workflows/check-submit.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: check-submit
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
issue_comment:
7+
types: [created]
8+
9+
concurrency:
10+
group: submit-${{ github.event.issue.number }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
issues: write
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
validate-submission:
20+
# 所有 issue 都视为投稿(已禁用空白 issue);issue 下 /recheck 可手动复检
21+
if: |
22+
github.event_name == 'issues' ||
23+
(github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/recheck'))
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 5
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: 20
31+
- run: node scripts/intake.mjs
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: validate
2+
3+
on:
4+
pull_request:
5+
paths: ["plugins/**"]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 20
18+
- run: node scripts/validate.mjs

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
.DS_Store

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPlayer 插件市场
2+
3+
收录 SPlayer-Next 的插件。
4+
5+
## 提交插件
6+
7+
1. 新建 Issue,选「提交插件」模板。
8+
2. 填写 `@id`,把 `.js` 拖进文本框上传,或粘贴脚本 raw 直链。
9+
3. 机器人会自动校验并回贴结果,维护者审核通过后插件进入市场。
10+
11+
更新插件:先提高脚本里的 `@version`,再走一次提交流程即可,用户端会自动检测到新版。
12+
13+
## 脚本头要求
14+
15+
```js
16+
/**
17+
* @name 插件名
18+
* @id yourname.plugin
19+
* @version 1.0.0
20+
* @type control
21+
* @apiLevel 2
22+
* @author you
23+
* @description 一句话简介
24+
*/
25+
```
26+
27+
`@id` 全局唯一、上架后不可更改。完整开发文档:https://splayer-next.imsyy.top/plugins/

package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "splayer-plugins",
3+
"private": true,
4+
"description": "SPlayer 插件市场",
5+
"scripts": {
6+
"validate": "node scripts/validate.mjs",
7+
"build": "node scripts/build-registry.mjs"
8+
}
9+
}

plugins/imsyy.classisland.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @name ClassIsland 联动
3+
* @id imsyy.classisland
4+
* @version 1.0.0
5+
* @author imsyy
6+
* @type control
7+
* @apiLevel 2
8+
* @description 把当前歌词推送到 ClassIsland 主界面
9+
* @homepage https://github.com/imsyy/SPlayer
10+
*/
11+
12+
splayer.register({ events: ["trackChange", "lineChange"] });
13+
14+
splayer.player.on("lineChange", ({ index }) => {
15+
splayer.log.info("当前歌词行", index);
16+
});

0 commit comments

Comments
 (0)