typora-community-plugin

LOW
maintainer lingdianshiren 0 votes scanned 2026-09-10 05:20:15.854591
View on AUR
Why flagged

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

PKGBUILD

1# Maintainer: lingdianshiren <ldsrwu@foxmail.com>
2# 上游是纯 JS 的 Typora 插件系统,发布 zip 内为 loader.js + loader.json + <版本>/core.js。
3# 官方安装方式(install-linux.sh)需要 root 手动改 Typora 的 window.html 并拷文件到用户目录;
4# 本包等价地做两件事:
5# 1. 运行时装到 Typora userData 的 plugins 目录(window.html 里的
6# typora://app/userData/plugins/loader.js 即指向此处,路径在构建时固化);
7# 2. 由 /usr/bin/typora-community-plugin 把同一段 loader <script> 注入
8# /usr/share/typora/resources/window.html,并用 pacman hook 在 typora
9# 升级覆盖 window.html 后重新注入(该文件属 typora 包,不能由本包拥有)。
10pkgname=typora-community-plugin
11pkgver=2.10.18
12pkgrel=1
13pkgdesc="Typora 社区插件系统:插件市场、命令面板、多标签工作区"
14url="https://github.com/typora-community-plugin/typora-community-plugin"
15arch=('any')
16license=('MIT')
17# 上游兼容表为 Typora v1.1.x - v1.14.x,这里跟随 AUR 上的 typora 版本下限
18depends=('typora>=1.14.9')
19install=typora-community-plugin.install
20source=(
21 "${pkgname}-${pkgver}.zip::${url}/releases/download/${pkgver}/typora-community-plugin.zip"
22 "LICENSE.md::https://raw.githubusercontent.com/typora-community-plugin/typora-community-plugin/${pkgver}/LICENSE.md"
23 'typora-community-plugin.sh'
24 'typora-community-plugin.hook'
25)
26sha256sums=('6a4ba75f59c265ac04a74a0ac5cab4b37fdc864f6c6b776710a3b0781f331c1a'
27 '731f5be0037576f31f566458da9817c261db3e8b8c5fc4703841005d5ac53823'
28 '09f62600fdc6c5866bad72d4c2a03ca219accef954fe4887051c318494793dea'
29 '4a4cefac90a4fdf9ce3987ddd7819c00c28b5a99812a1997ff086bea5121d680')
30noextract=("${pkgname}-${pkgver}.zip")
31
32# Typora 读取的 userData 目录(<XDG 配置目录>/Typora),loader 只能从这里加载
33_plugin_dir="${XDG_CONFIG_HOME:-$HOME/.config}/Typora/plugins"
34
35prepare() {
36 # 上游 zip 无顶层目录,单独解压,避免与包内文件混在 $srcdir 根下
37 install -d "${srcdir}/plugin"
38 bsdtar -xf "${srcdir}/${pkgname}-${pkgver}.zip" -C "${srcdir}/plugin"
39
40 # 上游打包结构调整时立即失败,而不是装出一个加载不了的包
41 local f
42 for f in loader.js loader.json "${pkgver}/core.js" "${pkgver}/core.css" \
43 "${pkgver}/locales/lang.en.json" "${pkgver}/locales/lang.zh-cn.json"; do
44 [[ -f "${srcdir}/plugin/$f" ]] || {
45 printf 'error: 上游 zip 结构变化,缺少 %s\n' "$f" >&2
46 return 1
47 }
48 done
49 grep -qF "\"coreVersion\":\"${pkgver}\"" "${srcdir}/plugin/loader.json" || {
50 printf 'error: loader.json 的 coreVersion 与 pkgver 不一致,框架目录名会错\n' >&2
51 return 1
52 }
53
54 # 控制脚本要往哪个用户目录装(pacman 以 root 安装,脚本自行推断目标用户属主)
55 sed -i "s|__PLUGIN_DIR__|${_plugin_dir}|" "${srcdir}/typora-community-plugin.sh"
56}
57
58package() {
59 install -Dm644 "${srcdir}/LICENSE.md" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.md"
60 install -Dm755 "${srcdir}/typora-community-plugin.sh" "${pkgdir}/usr/bin/typora-community-plugin"
61 install -Dm644 "${srcdir}/typora-community-plugin.hook" \
62 "${pkgdir}/usr/share/libalpm/hooks/20-typora-community-plugin.hook"
63
64 # 运行时落盘位置必须与 window.html 注入的 URL 一致
65 install -Dm644 "${srcdir}/plugin/loader.js" "${pkgdir}${_plugin_dir}/loader.js"
66 install -Dm644 "${srcdir}/plugin/loader.json" "${pkgdir}${_plugin_dir}/loader.json"
67 cp -a "${srcdir}/plugin/${pkgver}" "${pkgdir}${_plugin_dir}/${pkgver}"
68 find "${pkgdir}${_plugin_dir}" -type d -exec chmod 755 {} +
69
70 # pacman 会把包内目录权限与文件系统现状比对:家目录与 Typora 配置目录都已存在且
71 # 常为 750/700,这里按实际权限落包,避免每次安装/升级都告警"目录权限不一致"
72 local d
73 for d in "${HOME}" "$(dirname "${_plugin_dir}")"; do
74 if [[ -d "$d" ]]; then chmod --reference="$d" "${pkgdir}$d"; fi
75 done
76}
77

Scan history

Scanned at (UTC)SeverityRules
2026-09-10 05:20:15 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion