From 03a89e06d565fbb8554fc093fc9aecb35da135d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=E7=82=B3?= <15163222+cbing2002@user.noreply.gitee.com> Date: Mon, 3 Mar 2025 13:49:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=E5=A4=9A=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将所有架构集合到一起,去除冗余结构并增强扩展性。也可为 all 架构支持做准备。 --- README.md | 8 ++- aarch64-store/chat/github.json | 16 ----- aarch64-store/development/data/github.json | 37 ----------- aarch64-store/image_graphics/data/github.json | 15 ----- aarch64-store/music/data/github.json | 15 ----- aarch64-store/network/data/github.json | 39 ----------- aarch64-store/office/data/github.json | 41 ------------ aarch64-store/tools/data/github.json | 64 ------------------- aarch64-store/xrea/data/github.json | 12 ---- loong64-store/reading/data/github.json | 13 ---- store/chat/github.json | 7 +- store/development/{data => }/github.json | 23 +++++-- .../games/data => store/games}/github.json | 4 +- store/image_graphics/{data => }/github.json | 5 +- store/music/{data => }/github.json | 7 +- store/network/{data => }/github.json | 19 ++++-- store/office/{data => }/github.json | 19 ++++-- store/reading/data/github.json | 24 ------- .../data => store/reading}/github.json | 11 +++- store/tools/{data => }/github.json | 39 ++++++++--- store/video/{data => }/github.json | 4 +- store/xrea/{data => }/github.json | 18 ++++-- 22 files changed, 126 insertions(+), 314 deletions(-) delete mode 100644 aarch64-store/chat/github.json delete mode 100644 aarch64-store/development/data/github.json delete mode 100644 aarch64-store/image_graphics/data/github.json delete mode 100644 aarch64-store/music/data/github.json delete mode 100644 aarch64-store/network/data/github.json delete mode 100644 aarch64-store/office/data/github.json delete mode 100644 aarch64-store/tools/data/github.json delete mode 100644 aarch64-store/xrea/data/github.json delete mode 100644 loong64-store/reading/data/github.json rename store/development/{data => }/github.json (81%) rename {loong64-store/games/data => store/games}/github.json (78%) rename store/image_graphics/{data => }/github.json (82%) rename store/music/{data => }/github.json (84%) rename store/network/{data => }/github.json (80%) rename store/office/{data => }/github.json (82%) delete mode 100644 store/reading/data/github.json rename {aarch64-store/reading/data => store/reading}/github.json (68%) rename store/tools/{data => }/github.json (87%) rename store/video/{data => }/github.json (94%) rename store/xrea/{data => }/github.json (41%) diff --git a/README.md b/README.md index 5d2381f..adcf022 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,9 @@ github-downloader -d store/tools/data -o store/tools { "软件包名1": { "repo": "<用户>/<仓库>", - "file_template": "文件名", + "file_list": { + "arch": "文件名" + }, "app.json": { "Name": "软件名称", "Author": "软件作者", @@ -33,8 +35,8 @@ github-downloader -d store/tools/data -o store/tools } ``` -- `file_template` -文件名模板,可包含以下变量。 +- `file_list` +各架构文件名模板列表。文件名可包含以下变量。 - `{version_tag}` 用于代替文件名中和 Releases Tag 相同的部分。 - `{stripped_version}` diff --git a/aarch64-store/chat/github.json b/aarch64-store/chat/github.json deleted file mode 100644 index 16cbe67..0000000 --- a/aarch64-store/chat/github.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "icalingua": { - "repo": "Icalingua-plus-plus/Icalingua-plus-plus", - "file_template": "icalingua_{stripped_version}_arm64.deb", - "app.json": { - "Name": "Icalingua++(第三方QQ)", - "Pkgname": "icalingua", - "Author": "The Icalingua++ Authors ", - "Website": "https://github.com/Icalingua-plus-plus/Icalingua-plus-plus", - "More": "Icalingua++ 是 Icalingua 的分支,為已經刪除的 Icalingua 提供有限的更新,同時歡迎社區提交PR。\nIcalingua 这个名字是日语中「光」和拉丁语中「语言」的组合。\n本项目希望为 Linux 打造一个会话前端框架,通过实现 Adapter 后端接口来适配各种聊天平台。目前已经拥有基于 oicq 以及 Icalingua 自有协议的后端。\n\n----------------------------------------\n此应用存在已知的不稳定问题, 如出现会自动崩溃现象,可使用 'Icalingua++ 用户服务'", - "Tags": "a2d;community;debian;deepin;ubuntu;uos", - "img_urls": "[\"https://spk-json.spark-app.store/images/2024/12/31/48feff5701294f6db8f6cac33b6a4864.png\",\"https://spk-json.spark-app.store/images/2024/12/31/ad69192d8f8c4d50b3ca93179b2dcd77.png\"]", - "icons": "https://spk-json.spark-app.store/icons/2024/12/31/92aaa646b10746ada98c8e699db9ff74.png" - } - } -} diff --git a/aarch64-store/development/data/github.json b/aarch64-store/development/data/github.json deleted file mode 100644 index 0b0c602..0000000 --- a/aarch64-store/development/data/github.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "tabby-terminal": { - "repo": "Eugeny/tabby", - "file_template": "tabby-{stripped_version}-linux-arm64.deb", - "app.json": { - "Name": "Tabby", - "Author": "Eugene Pankov ", - "Website": "https://github.com/Eugeny/tabby#readme", - "More": "A terminal for a modern age", - "Tags": "debian;community;ubuntu;deepin", - "img_urls": "[\"https://spk-json.spark-app.store/store/development/tabby-terminal/screen_1.png\",\"https://spk-json.spark-app.store/store/development/tabby-terminal/screen_2.png\",\"https://spk-json.spark-app.store/store/development/tabby-terminal/screen_3.png\"]", - "icons": "https://spk-json.spark-app.store/store/development/tabby-terminal/icon.png" - } - }, - "lazydocker": { - "repo": "wcbing-build/lazydocker-debs", - "file_template": "lazydocker_{stripped_version}-1_arm64.deb", - "app.json": { - "Name": "Lazydocker", - "Author": "wcbing ", - "Website": "https://github.com/jesseduffield/lazydocker", - "More": "一个简单的终端 UI 程序,用于 docker 和 docker-compose,用 Go 语言编写,使用 gocui 库。", - "Tags": "debian;community;ubuntu;deepin" - } - }, - "lazygit": { - "repo": "wcbing-build/lazygit-debs", - "file_template": "lazygit_{stripped_version}-1_arm64.deb", - "app.json": { - "Name": "Lazygit", - "Author": "wcbing ", - "Website": "https://github.com/jesseduffield/lazygit", - "More": "用于 git 命令的简单终端 UI 程序", - "Tags": "debian;community;ubuntu;deepin" - } - } -} \ No newline at end of file diff --git a/aarch64-store/image_graphics/data/github.json b/aarch64-store/image_graphics/data/github.json deleted file mode 100644 index b7e6f4f..0000000 --- a/aarch64-store/image_graphics/data/github.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "draw.io": { - "repo": "jgraph/drawio-desktop", - "file_template": "drawio-arm64-{stripped_version}.deb", - "app.json": { - "Name": "draw.io", - "Author": "JGraph ", - "Website": "https://github.com/jgraph/drawio", - "More": "draw.io 是一个强大简洁的绘图软件,支持流程图,UML图,架构图,原型图等图标。支持Github,Google Drive, One drive等网盘同步,并且永久免费。", - "Tags": "debian;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/store/image_graphics/draw.io/screen_1.png\"]", - "icons": "https://spk-json.spark-app.store/store/image_graphics/draw.io/icon.png" - } - } -} \ No newline at end of file diff --git a/aarch64-store/music/data/github.json b/aarch64-store/music/data/github.json deleted file mode 100644 index 93029fe..0000000 --- a/aarch64-store/music/data/github.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "lx-music-desktop": { - "repo": "lyswhut/lx-music-desktop", - "file_template": "lx-music-desktop_{stripped_version}_arm64.deb", - "app.json": { - "Name": "洛雪音乐助手", - "Author": "lyswhut ", - "Website": "https://github.com/lyswhut/lx-music-desktop", - "More": "一个基于electron的音乐软件,全网搜音乐", - "Tags": "debian;community;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/store/music/lx-music-desktop/screen_1.png\",\"https://spk-json.spark-app.store/store/music/lx-music-desktop/screen_2.png\",\"https://spk-json.spark-app.store/store/music/lx-music-desktop/screen_3.png\",\"https://spk-json.spark-app.store/store/music/lx-music-desktop/screen_4.png\",\"https://spk-json.spark-app.store/store/music/lx-music-desktop/screen_5.png\"]", - "icons": "https://spk-json.spark-app.store/store/music/lx-music-desktop/icon.png" - } - } -} diff --git a/aarch64-store/network/data/github.json b/aarch64-store/network/data/github.json deleted file mode 100644 index eefe328..0000000 --- a/aarch64-store/network/data/github.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "motrix": { - "repo": "agalwood/Motrix", - "file_template": "Motrix_{stripped_version}_arm64.deb", - "app.json": { - "Name": "Motrix", - "Author": "Dr_rOot ", - "Website": "https://motrix.app", - "More": "Motrix 是一款全能的下载工具,支持下载 HTTP、FTP、BT、磁力链等资源。", - "Tags": "debian;community;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/store/network/motrix/screen_1.png\",\"https://spk-json.spark-app.store/store/network/motrix/screen_2.png\",\"https://spk-json.spark-app.store/store/network/motrix/screen_3.png\"]", - "icons": "https://spk-json.spark-app.store/store/network/motrix/icon.png" - } - }, - "dufs": { - "repo": "wcbing-build/dufs-debs", - "file_template": "dufs_{stripped_version}-1_arm64.deb", - "app.json": { - "Name": "Dufs", - "Author": "wcbing ", - "Website": "https://github.com/sigoden/dufs", - "More": "Dufs 是一款独特的实用文件服务器,支持静态服务、上传、搜索、访问控制、webdav。", - "Tags": "debian;community;ubuntu;deepin" - } - }, - "downkyi": { - "repo": "yaobiao131/downkyicore", - "file_template": "downkyi_{stripped_version}_linux_self-contained_arm64.deb", - "app.json": { - "Name": "哔哩下载姬(跨平台版)", - "Author": "28655758+yaobiao131@users.noreply.github.com", - "Website": "https://github.com/yaobiao131/downkyicore", - "More": "基于哔哩下载姬Windows版和AvaloniaUI制作的跨平台版本", - "Tags": "debian;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/images/2025/01/01/7359ae967f0c4545a838d373e310588c.png\",\"https://spk-json.spark-app.store/images/2025/01/01/e682ac754e6d47a893d7b00ef48e20b1.png\",\"https://spk-json.spark-app.store/images/2025/01/01/f184269c37e548cbb101b3e1a811bcf9.png\"]", - "icons": "https://spk-json.spark-app.store/icons/2025/01/01/5c598e4d3a4f43be8f240b9ed130fe53.png" - } - } -} \ No newline at end of file diff --git a/aarch64-store/office/data/github.json b/aarch64-store/office/data/github.json deleted file mode 100644 index a51ed0f..0000000 --- a/aarch64-store/office/data/github.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "hugo": { - "repo": "gohugoio/hugo", - "file_template": "hugo_extended_{stripped_version}_linux-arm64.deb", - "app.json": { - "Name": "hugo-extended 博客程序", - "Author": "Bjørn Erik Pedersen ", - "Website": "https://github.com/gohugoio/hugo", - "More": "The world’s fastest framework for building websites", - "Tags": "debian;ubuntu;deepin", - "img_urls": "[\"https://spk-json.spark-app.store/store/office/hugo/screen_1.png\"]", - "icons": "https://spk-json.spark-app.store/store/office/hugo/icon.png" - } - }, - "pandoc": { - "repo": "jgm/pandoc", - "file_template": "pandoc-{version_tag}-1-arm64.deb", - "app.json": { - "Name": "Pandoc", - "Author": "John MacFarlane ", - "Website": "https://github.com/jgm/pandoc", - "More": " Universal markup converter. 通用标记转换器\nPandoc是一个用于将一种标记格式转换为另一种标记格式的Haskell库,以及使用该库的命令行工具。", - "Tags": "debian;ubuntu;deepin;uos", - "img_urls": "[]", - "icons": "" - } - }, - "siyuan": { - "repo": "siyuan-note/siyuan", - "file_template": "siyuan-{stripped_version}-linux-arm64.deb", - "app.json": { - "Name": "思源笔记", - "Author": "云南链滴科技有限公司 <845765@qq.com>", - "Website": "https://b3log.org/siyuan/", - "More": "思源笔记是一款本地优先的个人知识管理系统,支持完全离线使用,同时也支持端到端加密同步。", - "Tags": "debian;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/store/office/siyuan/screen_1.png\",\"https://spk-json.spark-app.store/store/office/siyuan/screen_2.png\",\"https://spk-json.spark-app.store/store/office/siyuan/screen_3.png\",\"https://spk-json.spark-app.store/store/office/siyuan/screen_4.png\"]", - "icons": "https://spk-json.spark-app.store/store/office/siyuan/icon.png" - } - } -} \ No newline at end of file diff --git a/aarch64-store/tools/data/github.json b/aarch64-store/tools/data/github.json deleted file mode 100644 index 7a2dda3..0000000 --- a/aarch64-store/tools/data/github.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "rustdesk": { - "repo": "rustdesk/rustdesk", - "file_template": "rustdesk-{version_tag}-aarch64.deb", - "app.json": { - "Name": "RustDesk", - "Author": "rustdesk ", - "Website": "https://rustdesk.com", - "More": "RustDesk是开源远程桌面软件,开箱即用,无需任何配置,而且有实验性Wayland支持(但是高度依赖XWayland)。", - "Tags": "debian;community;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/store/tools/rustdesk/screen_1.png\",\"https://spk-json.spark-app.store/store/tools/rustdesk/screen_2.png\",\"https://spk-json.spark-app.store/store/tools/rustdesk/screen_3.png\"]", - "icons": "https://spk-json.spark-app.store/store/tools/rustdesk/icon.png" - } - }, - "localsend": { - "repo": "localsend/localsend", - "file_template": "LocalSend-{stripped_version}-linux-arm-64.deb", - "app.json": { - "Name": "LocalSend", - "Author": "Tienisto ", - "Website": "https://localsend.org/", - "More": "LocalSend是一个跨平台的应用程序,可以使用REST API和HTTPS加密实现设备之间的安全通信。与其他依赖外部服务器的消息传递应用程序不同,LocalSend 不需要互联网连接或第三方服务器,使其成为快速可靠的本地通信解决方案。\nLocalSend 使用安全通信协议,允许设备使用 REST API 相互通信。所有数据都通过HTTPS安全发送,并在每台设备上动态生成TLS / SSL证书,确保最大的安全性。", - "Tags": "debian;community;ubuntu;deepin;uos;a2d", - "img_urls": "[\"https://spk-json.spark-app.store/store/tools/localsend/screen_1.png\"]", - "icons": "https://spk-json.spark-app.store/store/tools/localsend/icon.png" - } - }, - "linglong-store": { - "repo": "GershonWang/linglong-store", - "file_template": "linglong-store_{stripped_version}_arm64.deb", - "app.json": { - "Name": "玲珑应用商店", - "Author": "Jokul <986432015@qq.com>", - "Website": "https://github.com/GershonWang/linglong-store", - "More": "Jokul自制简易式玲珑商店客户端,是玲珑官方SIG项目之一,使用过程中出现BUG,请在商店关于内问题反馈,或者在作者得github或者gitee上留issue,谢谢!", - "Tags": "debian;community;ubuntu;deepin" - } - }, - "cloudflared": { - "repo": "cloudflare/cloudflared", - "file_template": "cloudflared-linux-arm64.deb", - "app.json": { - "Name": "Cloudflare Tunnel client", - "Version": "2024.12.2", - "Author": "Cloudflare ", - "Website": "https://github.com/cloudflare/cloudflared", - "More": "Contains the command-line client for Cloudflare Tunnel, a tunneling daemon that proxies traffic from the Cloudflare network to your origins. This daemon sits between Cloudflare network and your origin (e.g. a webserver). Cloudflare attracts client requests and sends them to you via this daemon, without requiring you to poke holes on your firewall --- your origin can remain as closed as possible. Extensive documentation can be found in the Cloudflare Tunnel section of the Cloudflare Docs. All usages related with proxying to your origins are available under cloudflared tunnel help.\nYou can also use cloudflared to access Tunnel origins (that are protected with cloudflared tunnel) for TCP traffic at Layer 4 (i.e., not HTTP/websocket), which is relevant for use cases such as SSH, RDP, etc. Such usages are available under cloudflared access help.\nYou can instead use WARP client to access private origins behind Tunnels for Layer 4 traffic without requiring cloudflared access commands on the client side.", - "Tags": "debian;ubuntu;deepin;uos", - "img_urls": "[\"https://spk-json.spark-app.store/images/2025/01/01/0ec1daa5df0f4f9597c0440c39e69116.png\",\"https://spk-json.spark-app.store/images/2025/01/01/f50bab7804504b66a266b027c29c0adc.png\"]", - "icons": "https://spk-json.spark-app.store/icons/2025/01/01/5db109ad0dd9452b81b87088b512a512.png" - } - }, - "pot":{ - "repo": "pot-app/pot-desktop", - "file_template": "pot_{version_tag}_arm64.deb", - "app.json": { - "Name": "Pot (派了个萌的翻译器)", - "Author": "pot-app", - "Website": "https://pot-app.com", - "More": "一个跨平台的划词翻译和OCR软件 | A cross-platform software for text translation and recognize.", - "Tags": "community;debian;deepin;ubuntu;uos" - } - } -} \ No newline at end of file diff --git a/aarch64-store/xrea/data/github.json b/aarch64-store/xrea/data/github.json deleted file mode 100644 index 1a3a34b..0000000 --- a/aarch64-store/xrea/data/github.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "mihomo": { - "repo": "MetaCubeX/mihomo", - "file_template": "mihomo-linux-arm64-{version_tag}.deb", - "app.json": {} - }, - "clash-verge": { - "repo": "clash-verge-rev/clash-verge-rev", - "file_template": "Clash.Verge_{stripped_version}_arm64.deb", - "app.json": {} - } -} \ No newline at end of file diff --git a/loong64-store/reading/data/github.json b/loong64-store/reading/data/github.json deleted file mode 100644 index 107092b..0000000 --- a/loong64-store/reading/data/github.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "foliate": { - "repo": "johnfactotum/foliate", - "file_template": "foliate_{version_tag}_all.deb", - "app.json": { - "Name": "Foliate", - "Author": "John Factotum", - "Website": "https://johnfactotum.github.io/foliate/", - "More": "Foliate是一个使用GJS和 Epub.js构建的开源GTK电子书阅读器,具有简单而现代的用户界面", - "Tags": "debian;deepin;ubuntu;uos" - } - } -} \ No newline at end of file diff --git a/store/chat/github.json b/store/chat/github.json index 7f6ab49..1fa520d 100644 --- a/store/chat/github.json +++ b/store/chat/github.json @@ -1,7 +1,10 @@ { "icalingua": { "repo": "Icalingua-plus-plus/Icalingua-plus-plus", - "file_template": "icalingua_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "icalingua_{stripped_version}_amd64.deb", + "arm64": "icalingua_{stripped_version}_arm64.deb" + }, "app.json": { "Name": "Icalingua++(第三方QQ)", "Pkgname": "icalingua", @@ -13,4 +16,4 @@ "icons": "https://spk-json.spark-app.store/icons/2024/12/31/92aaa646b10746ada98c8e699db9ff74.png" } } -} +} \ No newline at end of file diff --git a/store/development/data/github.json b/store/development/github.json similarity index 81% rename from store/development/data/github.json rename to store/development/github.json index d04c34b..91cc328 100644 --- a/store/development/data/github.json +++ b/store/development/github.json @@ -1,7 +1,9 @@ { "neovim": { "repo": "neovim/neovim-releases", - "file_template": "nvim-linux-x86_64.deb", + "file_list": { + "amd64": "nvim-linux-x86_64.deb" + }, "app.json": { "Name": "Neovim", "Author": "Neovim.io", @@ -14,7 +16,10 @@ }, "tabby-terminal": { "repo": "Eugeny/tabby", - "file_template": "tabby-{stripped_version}-linux-x64.deb", + "file_list": { + "amd64": "tabby-{stripped_version}-linux-x64.deb", + "arm64": "tabby-{stripped_version}-linux-arm64.deb" + }, "app.json": { "Name": "Tabby", "Author": "Eugene Pankov ", @@ -27,7 +32,10 @@ }, "lazydocker": { "repo": "wcbing-build/lazydocker-debs", - "file_template": "lazydocker_{stripped_version}-1_amd64.deb", + "file_list": { + "amd64": "lazydocker_{stripped_version}-1_amd64.deb", + "arm64": "lazydocker_{stripped_version}-1_arm64.deb" + }, "app.json": { "Name": "Lazydocker", "Author": "wcbing ", @@ -38,7 +46,10 @@ }, "lazygit": { "repo": "wcbing-build/lazygit-debs", - "file_template": "lazygit_{stripped_version}-1_amd64.deb", + "file_list": { + "amd64": "lazygit_{stripped_version}-1_amd64.deb", + "arm64": "lazygit_{stripped_version}-1_arm64.deb" + }, "app.json": { "Name": "Lazygit", "Author": "wcbing ", @@ -49,7 +60,9 @@ }, "io.github.msojocs.wechat-devtools-linux": { "repo": "msojocs/wechat-web-devtools-linux", - "file_template": "io.github.msojocs.wechat-devtools-linux_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "io.github.msojocs.wechat-devtools-linux_{stripped_version}_amd64.deb" + }, "app.json": { "Name": "微信开发者工具 Linux版", "Author": "msojocs", diff --git a/loong64-store/games/data/github.json b/store/games/github.json similarity index 78% rename from loong64-store/games/data/github.json rename to store/games/github.json index 734dfe9..2a77f87 100644 --- a/loong64-store/games/data/github.json +++ b/store/games/github.json @@ -1,7 +1,9 @@ { "osu-lazer": { "repo": "Catty2014/osu-lazer-loongarch", - "file_template": "osu-lazer_{version_tag}_loong64.deb", + "file_list": { + "loong64": "osu-lazer_{version_tag}_loong64.deb" + }, "app.json": { "Name": "osu!", "Author": "Catty Steve", diff --git a/store/image_graphics/data/github.json b/store/image_graphics/github.json similarity index 82% rename from store/image_graphics/data/github.json rename to store/image_graphics/github.json index 6c641c3..6da1377 100644 --- a/store/image_graphics/data/github.json +++ b/store/image_graphics/github.json @@ -1,7 +1,10 @@ { "draw.io": { "repo": "jgraph/drawio-desktop", - "file_template": "drawio-amd64-{stripped_version}.deb", + "file_list": { + "amd64": "drawio-amd64-{stripped_version}.deb", + "arm64": "drawio-arm64-{stripped_version}.deb" + }, "app.json": { "Name": "draw.io", "Author": "JGraph ", diff --git a/store/music/data/github.json b/store/music/github.json similarity index 84% rename from store/music/data/github.json rename to store/music/github.json index 4fdfafa..453a2cf 100644 --- a/store/music/data/github.json +++ b/store/music/github.json @@ -1,7 +1,10 @@ { "lx-music-desktop": { "repo": "lyswhut/lx-music-desktop", - "file_template": "lx-music-desktop_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "lx-music-desktop_{stripped_version}_amd64.deb", + "arm64": "lx-music-desktop_{stripped_version}_arm64.deb" + }, "app.json": { "Name": "洛雪音乐助手", "Author": "lyswhut ", @@ -12,4 +15,4 @@ "icons": "https://spk-json.spark-app.store/store/music/lx-music-desktop/icon.png" } } -} +} \ No newline at end of file diff --git a/store/network/data/github.json b/store/network/github.json similarity index 80% rename from store/network/data/github.json rename to store/network/github.json index 1202b4c..66e3630 100644 --- a/store/network/data/github.json +++ b/store/network/github.json @@ -1,7 +1,10 @@ { "motrix": { "repo": "agalwood/Motrix", - "file_template": "Motrix_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "Motrix_{stripped_version}_amd64.deb", + "arm64": "Motrix_{stripped_version}_arm64.deb" + }, "app.json": { "Name": "Motrix", "Author": "Dr_rOot ", @@ -14,7 +17,10 @@ }, "dufs": { "repo": "wcbing-build/dufs-debs", - "file_template": "dufs_{stripped_version}-1_amd64.deb", + "file_list": { + "amd64": "dufs_{stripped_version}-1_amd64.deb", + "arm64": "dufs_{stripped_version}-1_arm64.deb" + }, "app.json": { "Name": "Dufs", "Author": "wcbing ", @@ -25,7 +31,10 @@ }, "downkyi": { "repo": "yaobiao131/downkyicore", - "file_template": "downkyi_{stripped_version}_linux_self-contained_amd64.deb", + "file_list": { + "amd64": "downkyi_{stripped_version}_linux_self-contained_amd64.deb", + "arm64": "downkyi_{stripped_version}_linux_self-contained_arm64.deb" + }, "app.json": { "Name": "哔哩下载姬(跨平台版)", "Author": "28655758+yaobiao131@users.noreply.github.com", @@ -37,7 +46,9 @@ }, "abdownloadmanager": { "repo": "amir1376/ab-download-manager", - "file_template": "ABDownloadManager_{stripped_version}_linux_x64.deb", + "file_list": { + "amd64": "ABDownloadManager_{stripped_version}_linux_x64.deb" + }, "app.json": { "Name": "AB Download Manager", "Author": "abdownloadmanager.com", diff --git a/store/office/data/github.json b/store/office/github.json similarity index 82% rename from store/office/data/github.json rename to store/office/github.json index 7e64a49..0d882c0 100644 --- a/store/office/data/github.json +++ b/store/office/github.json @@ -1,7 +1,10 @@ { "hugo": { "repo": "gohugoio/hugo", - "file_template": "hugo_extended_{stripped_version}_linux-amd64.deb", + "file_list": { + "amd64": "hugo_extended_{stripped_version}_linux-amd64.deb", + "arm64": "hugo_extended_{stripped_version}_linux-arm64.deb" + }, "app.json": { "Name": "hugo-extended 博客程序", "Author": "Bjørn Erik Pedersen ", @@ -14,7 +17,9 @@ }, "obsidian": { "repo": "obsidianmd/obsidian-releases", - "file_template": "obsidian_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "obsidian_{stripped_version}_amd64.deb" + }, "app.json": { "Name": "Obsidian", "Author": "Dynalist Inc.", @@ -27,7 +32,10 @@ }, "pandoc": { "repo": "jgm/pandoc", - "file_template": "pandoc-{version_tag}-1-amd64.deb", + "file_list": { + "amd64": "pandoc-{version_tag}-1-amd64.deb", + "arm64": "pandoc-{version_tag}-1-arm64.deb" + }, "app.json": { "Name": "Pandoc", "Author": "John MacFarlane ", @@ -40,7 +48,10 @@ }, "siyuan": { "repo": "siyuan-note/siyuan", - "file_template": "siyuan-{stripped_version}-linux.deb", + "file_list": { + "amd64": "siyuan-{stripped_version}-linux.deb", + "arm64": "siyuan-{stripped_version}-linux-arm64.deb" + }, "app.json": { "Name": "思源笔记", "Author": "云南链滴科技有限公司 <845765@qq.com>", diff --git a/store/reading/data/github.json b/store/reading/data/github.json deleted file mode 100644 index 3244056..0000000 --- a/store/reading/data/github.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "foliate": { - "repo": "johnfactotum/foliate", - "file_template": "foliate_{version_tag}_all.deb", - "app.json": { - "Name": "Foliate", - "Author": "John Factotum", - "Website": "https://johnfactotum.github.io/foliate/", - "More": "Foliate是一个使用GJS和 Epub.js构建的开源GTK电子书阅读器,具有简单而现代的用户界面", - "Tags": "debian;deepin;ubuntu;uos" - } - }, - "venera": { - "repo": "venera-app/venera", - "file_template": "venera_{stripped_version}_amd64.deb", - "app.json": { - "Name": "Venera", - "Author": "wgh136", - "Website": "https://github.com/venera-app/venera", - "More": "Venera 支持阅读本地和多个源的网络漫画的漫画阅读器", - "Tags": "debian;ubuntu;deepin;uos" - } - } -} \ No newline at end of file diff --git a/aarch64-store/reading/data/github.json b/store/reading/github.json similarity index 68% rename from aarch64-store/reading/data/github.json rename to store/reading/github.json index efe7795..b298064 100644 --- a/aarch64-store/reading/data/github.json +++ b/store/reading/github.json @@ -1,7 +1,11 @@ { "foliate": { "repo": "johnfactotum/foliate", - "file_template": "foliate_{version_tag}_all.deb", + "file_list": { + "amd64": "foliate_{version_tag}_all.deb", + "arm64": "foliate_{version_tag}_all.deb", + "loong64": "foliate_{version_tag}_all.deb" + }, "app.json": { "Name": "Foliate", "Author": "John Factotum", @@ -12,7 +16,10 @@ }, "venera": { "repo": "venera-app/venera", - "file_template": "venera_{stripped_version}_arm64.deb", + "file_list": { + "amd64": "venera_{stripped_version}_amd64.deb", + "arm64": "venera_{stripped_version}_arm64.deb" + }, "app.json": { "Name": "Venera", "Author": "wgh136", diff --git a/store/tools/data/github.json b/store/tools/github.json similarity index 87% rename from store/tools/data/github.json rename to store/tools/github.json index 0261f35..8d4c9a3 100644 --- a/store/tools/data/github.json +++ b/store/tools/github.json @@ -1,7 +1,10 @@ { "rustdesk": { "repo": "rustdesk/rustdesk", - "file_template": "rustdesk-{version_tag}-x86_64.deb", + "file_list": { + "amd64": "rustdesk-{version_tag}-x86_64.deb", + "arm64": "rustdesk-{version_tag}-aarch64.deb" + }, "app.json": { "Name": "RustDesk", "Author": "rustdesk ", @@ -14,7 +17,10 @@ }, "localsend": { "repo": "localsend/localsend", - "file_template": "LocalSend-{stripped_version}-linux-x86-64.deb", + "file_list": { + "amd64": "LocalSend-{stripped_version}-linux-x86-64.deb", + "arm64": "LocalSend-{stripped_version}-linux-arm-64.deb" + }, "app.json": { "Name": "LocalSend", "Author": "Tienisto ", @@ -27,7 +33,10 @@ }, "linglong-store": { "repo": "GershonWang/linglong-store", - "file_template": "linglong-store_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "linglong-store_{stripped_version}_amd64.deb", + "arm64": "linglong-store_{stripped_version}_arm64.deb" + }, "app.json": { "Name": "玲珑应用商店", "Author": "Jokul <986432015@qq.com>", @@ -38,7 +47,9 @@ }, "peazip": { "repo": "peazip/PeaZip", - "file_template": "peazip_{version_tag}.LINUX.Qt6-1_amd64.deb", + "file_list": { + "amd64": "peazip_{version_tag}.LINUX.Qt6-1_amd64.deb" + }, "app.json": { "Name": "PeaZip", "Author": "Giorgio Tani ", @@ -51,7 +62,9 @@ }, "ollama": { "repo": "lingfish/ollama-deb", - "file_template": "ollama_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "ollama_{stripped_version}_amd64.deb" + }, "app.json": { "Name": "Ollama", "Author": "ollama ", @@ -64,7 +77,10 @@ }, "cloudflared": { "repo": "cloudflare/cloudflared", - "file_template": "cloudflared-linux-amd64.deb", + "file_list": { + "amd64": "cloudflared-linux-amd64.deb", + "arm64": "cloudflared-linux-arm64.deb" + }, "app.json": { "Name": "Cloudflare Tunnel client", "Author": "Cloudflare ", @@ -77,7 +93,9 @@ }, "cloudflared-fips": { "repo": "cloudflare/cloudflared", - "file_template": "cloudflared-fips-linux-amd64.deb", + "file_list": { + "amd64": "cloudflared-fips-linux-amd64.deb" + }, "app.json": { "Name": "Cloudflare Tunnel client (fips)", "Author": "Cloudflare ", @@ -88,9 +106,12 @@ "icons": "https://spk-json.spark-app.store/icons/2025/01/01/b76df8b0e9824a6094b5faefef0fbc36.png" } }, - "pot":{ + "pot": { "repo": "pot-app/pot-desktop", - "file_template": "pot_{version_tag}_amd64.deb", + "file_list": { + "amd64": "pot_{version_tag}_amd64.deb", + "arm64": "pot_{version_tag}_arm64.deb" + }, "app.json": { "Name": "Pot (派了个萌的翻译器)", "Author": "pot-app", diff --git a/store/video/data/github.json b/store/video/github.json similarity index 94% rename from store/video/data/github.json rename to store/video/github.json index 80d5387..efafaf6 100644 --- a/store/video/data/github.json +++ b/store/video/github.json @@ -1,7 +1,9 @@ { "biliup-app": { "repo": "biliup/biliup-app", - "file_template": "biliup-app_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "biliup-app_{stripped_version}_amd64.deb" + }, "app.json": { "Name": "biliup-app(开源 bilibili投稿客户端)", "Author": "you", diff --git a/store/xrea/data/github.json b/store/xrea/github.json similarity index 41% rename from store/xrea/data/github.json rename to store/xrea/github.json index d7a6239..2313ca8 100644 --- a/store/xrea/data/github.json +++ b/store/xrea/github.json @@ -1,22 +1,32 @@ { "mihomo": { "repo": "MetaCubeX/mihomo", - "file_template": "mihomo-linux-amd64-compatible-{version_tag}.deb", + "file_list": { + "amd64": "mihomo-linux-amd64-compatible-{version_tag}.deb", + "arm64": "mihomo-linux-arm64-{version_tag}.deb" + }, "app.json": {} }, "clash-verge": { "repo": "clash-verge-rev/clash-verge-rev", - "file_template": "Clash.Verge_{stripped_version}_amd64.deb", + "file_list": { + "amd64": "Clash.Verge_{stripped_version}_amd64.deb", + "arm64": "Clash.Verge_{stripped_version}_arm64.deb" + }, "app.json": {} }, "flclash": { "repo": "chen08209/FlClash", - "file_template": "FlClash-{stripped_version}-linux-amd64.deb", + "file_list": { + "amd64": "FlClash-{stripped_version}-linux-amd64.deb" + }, "app.json": {} }, "hiddify": { "repo": "hiddify/hiddify-app", - "file_template": "Hiddify-Debian-x64.deb", + "file_list": { + "amd64": "Hiddify-Debian-x64.deb" + }, "app.json": {} } } \ No newline at end of file -- Gitee From 48c3418277088354d0b4e7680bd4a4a7ce3d14f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=E7=82=B3?= <15163222+cbing2002@user.noreply.gitee.com> Date: Sun, 30 Mar 2025 14:18:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E5=B0=86=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E5=90=88=E5=B9=B6=E5=88=B0=E6=9C=AC=E4=BB=93?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 25 ++++++- github-downloader | 182 ++++++++++++++++++++++++++++++++++++++++++++++ run.sh | 9 +++ 3 files changed, 214 insertions(+), 2 deletions(-) create mode 100755 github-downloader create mode 100755 run.sh diff --git a/README.md b/README.md index adcf022..95e9547 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,25 @@ -本仓库为星火商店自动更新来自 Github Releases 的软件包提供配置,需要配合同组织的 github-downloader 下载工具使用。 +本仓库为星火商店自动更新来自 Github Releases 的软件包。 + +# Github Releases 更新下载 + +一个 Github Releases 更新下载器,依据 `github.json` 里预先定义的内容,自动检查 Github Releases 的更新情况,并按需下载指定文件。 + +此版本专用于星火商店 SBS(Spark Building Service),用于其他用途可以查看 [Github](https://github.com/wcbing/github-downloader) 版本。 + +## 用法 +``` +用法: github-downloader [-h] [-c CATEGORY] [-d DATA] [-o OUTPUT] [-p PROXY] [-t THREAD] [--dry-run] + +选项: + -h, --help 显示帮助信息 + -c, --category + 分类,用于包的保存路径 + -d, --data 读取仓库配置 + -o, --output 将文件保存到 ,默认为当前文件夹 + -p, --proxy Github 代理, 必须以 / 结尾 + -t, --thread 并发下载线程数量,默认为 5 + --dry-run 运行但不下载文件 +``` 运行样例: ```sh @@ -7,7 +28,7 @@ github-downloader ``` 或 ```sh -github-downloader -d store/tools/data -o store/tools +github-downloader -d store/tools/ -c tools ``` ## 配置说明 diff --git a/github-downloader b/github-downloader new file mode 100755 index 0000000..5369c2e --- /dev/null +++ b/github-downloader @@ -0,0 +1,182 @@ +#!/usr/bin/env python3 + +import argparse +import json +import logging +import os +import requests +import re +import threading +from datetime import datetime +from concurrent.futures import ThreadPoolExecutor, wait + + +# 全局配置变量 +CONFIG = { + "data_dir": "data", + "output_dir": ".", + "proxy": "", + "thread": 5, + "category": "", + "dry_run": False, +} +version_lock = threading.Lock() +# 日志等级,若需要展示每次请求结果请使用 INFO 等级 +logging.basicConfig(level=logging.INFO) + + +# 读取命令行参数 +def read_args() -> None: + parser = argparse.ArgumentParser( + description="Github Downloader - Github Releases 更新下载器" + ) + parser.add_argument("-c", "--category", default="", help="分类,用于包的保存路径") + parser.add_argument("-d", "--data", default="data", help="从 读取仓库配置") + parser.add_argument( + "-o", "--output", default=".", help="将文件保存到 ,默认为当前文件夹" + ) + parser.add_argument( + "-p", "--proxy", default="", help="Github 代理, 必须以 / 结尾" + ) + parser.add_argument( + "-t", "--thread", type=int, default=5, help="并发下载线程数量,默认为 5" + ) + parser.add_argument("--dry-run", action="store_true", help="运行但不下载文件") + args = parser.parse_args() + + CONFIG.update( + { + "category": args.category, + "data_dir": args.data, + "output_dir": args.output, + "proxy": args.proxy, + "thread": args.thread, + "dry_run": args.dry_run, + } + ) + + +# 读取 JSON 文件 +def read_json(filename: str) -> dict: + try: + with open(os.path.join(CONFIG["data_dir"], filename), "r") as f: + return json.load(f) + except (FileNotFoundError, json.JSONDecodeError) as e: + logging.error(e) + return {} + + +# 获取最新版本标签 +def latest_version_tag(repo_url: str) -> str: + url = f"{repo_url}/releases/latest" + try: + location = requests.head(url).headers.get("Location", "") + match = re.search(r".*releases/tag/([^/]+)", location) + return match.group(1) if match else "" + except requests.RequestException as e: + logging.error(e) + return "" + + +# 下载文件 +def download(url: str, file_path: str) -> tuple[bool, str]: + # 检查是否为 dry-run 模式 + method = requests.head if CONFIG["dry_run"] else requests.get + response = method(url, stream=True, allow_redirects=True) + if response.status_code != 200: + logging.error(f"Can't download {url} because received {response.status_code}") + return False, "" + + # 记录文件大小,size_str 使用 kB/MB 而不是 KiB/MiB + len = int(response.headers.get("Content-Length", 0)) + size_str = f"{len / 10**3:.2f}kB" if len < 10**6 else f"{len / 10**6:.2f}MB" + + if CONFIG["dry_run"]: + logging.info(f"Dry-run download: {url}") + else: + logging.info(f"Downloading: {url}") + with open(file_path, "wb") as f: + for chunk in response.iter_content(chunk_size=8192): + f.write(chunk) + return True, size_str + + +# 检查版本并下载新版本文件 +def check(name: str, repo: dict, version_list: dict) -> None: + repo_url = f"{CONFIG['proxy']}https://github.com/{repo['repo']}" + version_tag = latest_version_tag(repo_url) + if not version_tag: + logging.error(f"Can't get latest version tag of {name}") + return + logging.info(f"{name} = {version_tag}") + + # https://www.debian.org/doc/manuals/debmake-doc/ch06.zh-cn.html#name-version + # 参考文档中 Upstream version 正则表达式获取版本号,即从第一个数字开始。 + vpattern = "[0-9][-+.:~a-z0-9A-Z]*" + version = match.group() if (match := re.search(vpattern, version_tag)) else "" + + # 判断是否需要更新 + local_version = version_list.get(name, "") + if not version or local_version == version: + return + + for arch, file_template in repo["file_list"].items(): + # 确定本地文件目录并确保目录存在 + app_dir = os.path.join( + CONFIG["output_dir"], f"{arch}-store", CONFIG["category"], name + ) + os.makedirs(app_dir, exist_ok=True) + # 拼接得到 Releases 中的文件名 + release_filename = file_template.format( + version_tag=version_tag, # 若存在则用完整 tag 替换 + stripped_version=version, # 若存在则用 version 替换 + ) + file_url = f"{repo_url}/releases/download/{version_tag}/{release_filename}" + filename = f"{name}_{version}_{arch}.deb" # 格式化后的文件名 + file_path = os.path.join(app_dir, filename) + + downloaded, size = download(file_url, file_path) + if downloaded: + # 判断是否是新添加应用 + if local_version == "": + print(f"AddNew: {name}:{arch} ({version})") + else: + print(f"Update: {name}:{arch} ({local_version} -> {version})") + # 删除旧版本文件 + old_file_path = os.path.join( + app_dir, f"{name}_{local_version}_{arch}.deb" + ) + if os.path.exists(old_file_path): + os.remove(old_file_path) + # 更新 app.json + repo["app.json"].update( + { + "Pkgname": name, + "Version": version, + "Filename": filename, + "Update": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + "Size": size, + "Contributor": "https://gitee.com/spark-building-service/github", + } + ) + # 保存 app.json + with open(os.path.join(app_dir, "app.json.update"), "w") as f: + json.dump(repo["app.json"], f, indent=4, ensure_ascii=False) + # 更新版本号 + with version_lock: + version_list[name] = version + + +if __name__ == "__main__": + read_args() + repo_list = read_json("github.json") + version_list = read_json("github-local.json") + with ThreadPoolExecutor(max_workers=CONFIG["thread"]) as executor: + tasks = [ + executor.submit(check, name, repo, version_list) + for name, repo in repo_list.items() + ] + wait(tasks) + # 保存到 github-local.json + with open(os.path.join(CONFIG["data_dir"], "github-local.json"), "w") as f: + json.dump(version_list, f, indent=4) diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..4d2cd3e --- /dev/null +++ b/run.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +store_dir="$HOME/store-dir" + +category=$(ls store) + +for i in $category; do + ./github-downloader -o $store_dir -d store/$i/ -c $i +done \ No newline at end of file -- Gitee