diff --git a/.github/scripts/release_plugins.py b/.github/scripts/release_plugins.py index c9460cc..4e3f6cb 100644 --- a/.github/scripts/release_plugins.py +++ b/.github/scripts/release_plugins.py @@ -26,6 +26,8 @@ class PluginSpec: name: str version: str description: str + author: str + author_url: str dir_name: str tag: str filename: str @@ -96,6 +98,29 @@ def parse_plugin_entry( else: required_strings[field] = value.strip() + author = "" + if "author" in entry: + raw_author = entry.get("author") + if not isinstance(raw_author, str) or not raw_author.strip(): + errors.append(f"{label}: 字段 'author' 必须是非空字符串") + else: + author = raw_author.strip() + + author_url = "" + if "authorUrl" in entry: + raw_author_url = entry.get("authorUrl") + if not isinstance(raw_author_url, str) or not raw_author_url.strip(): + errors.append(f"{label}: 'authorUrl' 必须是合法的 https URL") + else: + candidate_url = raw_author_url.strip() + parsed_author_url = urlparse(candidate_url) + if parsed_author_url.scheme != "https" or not parsed_author_url.netloc: + errors.append(f"{label}: 'authorUrl' 必须是合法的 https URL") + else: + author_url = candidate_url + if not author: + errors.append(f"{label}: 存在 'authorUrl' 时必须提供 'author'") + download = entry.get("download") dl_url = "" expected_sha256 = "" @@ -160,6 +185,8 @@ def parse_plugin_entry( name=required_strings["name"], version=required_strings["version"], description=required_strings["description"], + author=author, + author_url=author_url, dir_name=dir_name, tag=tag, filename=filename, @@ -233,10 +260,17 @@ def verify_artifact(plugin: PluginSpec) -> list[str]: def create_release(plugin: PluginSpec, repo: str, target_sha: str) -> str | None: title = f"{plugin.name} {plugin.version}" - notes = ( - f"{plugin.description}\n\n" + lines = [plugin.description, ""] + if plugin.author: + escaped_author = plugin.author.replace("[", "\\[").replace("]", "\\]") + if plugin.author_url: + lines.append(f"作者:[{escaped_author}]({plugin.author_url})") + else: + lines.append(f"作者:{escaped_author}") + lines.append( f"源码:[{plugin.dir_name}](https://github.com/{repo}/tree/{plugin.tag}/{plugin.dir_name})" ) + notes = "\n".join(lines) try: code, stdout, stderr = run_gh( [ diff --git a/README.md b/README.md index d5b09ce..634bd5e 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ "version": "1.0.0", "kind": "sandbox", "author": "作者", + "authorUrl": "https://github.com/作者", "description": "一句话说明", "platforms": ["desktop", "android"], "apiVersion": "1.0", @@ -33,7 +34,7 @@ } ``` -`id`、`version`、`kind` 要和包内 `plugin.json` 一致,否则应用会拒绝安装。`download.url` 只能是 https,`size` 是插件包的字节数;沙盒插件不超过 10MB,原生插件不超过 200MB。`screenshots` 可选,用于在目录网页展示预览图(仅限 https,可填图片地址字符串或 `{ "url": "...", "label": "说明" }`)。 +`id`、`version`、`kind` 要和包内 `plugin.json` 一致,否则应用会拒绝安装。`download.url` 只能是 https,`size` 是插件包的字节数;沙盒插件不超过 10MB,原生插件不超过 200MB。`authorUrl` 可选,仅限 https,用于在目录网页和 Release 页把作者名做成链接。`screenshots` 可选,用于在目录网页展示预览图(仅限 https,可填图片地址字符串或 `{ "url": "...", "label": "说明" }`)。 字段说明见 [plugin-catalog.md](https://github.com/rinchao0721/Melodia/blob/dev/docs/plugin-catalog.md)。 diff --git a/index.json b/index.json index 282a75e..6e95e7d 100644 --- a/index.json +++ b/index.json @@ -8,6 +8,7 @@ "version": "1.0.0", "kind": "native", "author": "Melodia", + "authorUrl": "https://github.com/rinchao0721", "description": "在 Discord 上显示正在播放的歌曲", "platforms": ["desktop"], "apiVersion": "1.0", @@ -25,6 +26,7 @@ "version": "1.0.0", "kind": "sandbox", "author": "Melodia", + "authorUrl": "https://github.com/rinchao0721", "description": "把听歌记录同步到 Last.fm:正在播放与 scrobble,断网时先存起来稍后补交", "platforms": ["desktop", "android"], "apiVersion": "1.4", @@ -42,6 +44,7 @@ "version": "0.5.2", "kind": "sandbox", "author": "Melodia", + "authorUrl": "https://github.com/rinchao0721", "description": "仿 LX Music 移动版的播放页:封面与歌词左右分页、无底色控制键、跟随主题强调色的进度与当前歌词", "platforms": ["android"], "apiVersion": "1.9", @@ -59,6 +62,7 @@ "version": "1.0.1", "kind": "sandbox", "author": "涷雨", + "authorUrl": "https://github.com/dongyvu", "description": "参考QQ音乐和汽水音乐的播放页:随封面色相变化的流光背景与歌词配色,支持横竖屏独立布局和迷你播放器渐变。", "platforms": ["android"], "apiVersion": "1.10", @@ -86,6 +90,7 @@ "version": "1.1.0", "kind": "sandbox", "author": "Melodia", + "authorUrl": "https://github.com/rinchao0721", "description": "模糊封面叠调色板光晕背景,大圆角封面带彩色投影,歌词左对齐、当前行放大、其余行模糊;平板宽屏、竖屏、歌词页与迷你播放器统一风格。需要 API 1.12 宿主。", "platforms": ["android"], "apiVersion": "1.12", @@ -113,6 +118,7 @@ "version": "1.6.0", "kind": "sandbox", "author": "leesing", + "authorUrl": "https://github.com/leesing", "description": "官方下载链接不可用或降级时,向可配置的第三方接口再取一条直链,按所选音质回退并提示实际结果", "platforms": ["desktop", "android"], "apiVersion": "1.12", diff --git a/site/index.html b/site/index.html index 700c32a..6f8867e 100644 --- a/site/index.html +++ b/site/index.html @@ -183,6 +183,7 @@ .facts { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 12px; margin: 0 0 12px; } .facts dt { color: var(--text-3); } .facts dd { margin: 0; overflow-wrap: anywhere; } +.facts dd a { color: var(--text-2); text-underline-offset: 3px; } .facts ul { margin: 0; padding: 0; list-style: none; } .shots { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 4px; } .shot { @@ -254,6 +255,7 @@ .get:hover { background: var(--accent); color: var(--on-accent); } .get:hover .arrow { transform: translateY(2px); } .theme-toggle:hover { background: var(--surface-strong); color: var(--text); } + .facts dd a:hover { color: var(--text); } } @media (max-width: 640px) { .pane { padding: 18px 14px; } @@ -483,6 +485,19 @@