Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 36 additions & 2 deletions .github/scripts/release_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class PluginSpec:
name: str
version: str
description: str
author: str
author_url: str
dir_name: str
tag: str
filename: str
Expand Down Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(
[
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"version": "1.0.0",
"kind": "sandbox",
"author": "作者",
"authorUrl": "https://github.com/作者",
"description": "一句话说明",
"platforms": ["desktop", "android"],
"apiVersion": "1.0",
Expand All @@ -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)。

Expand Down
6 changes: 6 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"version": "1.0.0",
"kind": "native",
"author": "Melodia",
"authorUrl": "https://github.com/rinchao0721",
"description": "在 Discord 上显示正在播放的歌曲",
"platforms": ["desktop"],
"apiVersion": "1.0",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -59,6 +62,7 @@
"version": "1.0.1",
"kind": "sandbox",
"author": "涷雨",
"authorUrl": "https://github.com/dongyvu",
"description": "参考QQ音乐和汽水音乐的播放页:随封面色相变化的流光背景与歌词配色,支持横竖屏独立布局和迷你播放器渐变。",
"platforms": ["android"],
"apiVersion": "1.10",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -113,6 +118,7 @@
"version": "1.6.0",
"kind": "sandbox",
"author": "leesing",
"authorUrl": "https://github.com/leesing",
"description": "官方下载链接不可用或降级时,向可配置的第三方接口再取一条直链,按所选音质回退并提示实际结果",
"platforms": ["desktop", "android"],
"apiVersion": "1.12",
Expand Down
15 changes: 15 additions & 0 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -483,6 +485,19 @@ <h1>给 Melodia 加点新东西</h1>
facts.append(dt, dd);
return { dt, dd };
};
const author = typeof plugin.author === 'string' ? plugin.author.trim() : '';
if (author) {
const authorUrl = typeof plugin.authorUrl === 'string' ? plugin.authorUrl.trim() : '';
if (isHttps(authorUrl)) {
const link = el('a', '', author);
link.href = authorUrl;
link.target = '_blank';
link.rel = 'noopener noreferrer';
add('作者', link);
} else {
add('作者', author);
}
}
add('平台', (plugin.platforms?.length ? plugin.platforms.map(key => PLATFORMS[key] ?? key) : ['全部平台']).join('、'));
if (plugin.minAppVersion) add('应用版本', `${plugin.minAppVersion} 及以上`);
const permissions = el('ul');
Expand Down
Loading