Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flathub chsrc #179

Merged
merged 5 commits into from
Mar 17, 2025
Merged
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
1 change: 1 addition & 0 deletions src/chsrc-main.c
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
* | yongxiang <1926885268@qq.com>
* | YU-7 <2747046473@qq.com>
* | juzeon <skyjuzheng@gmail.com>
* | Jialin Lyu <jialinlvcn@aliyun.com>
* |
* Created On : <2023-08-28>
* Last Modified : <2025-03-14>
12 changes: 12 additions & 0 deletions src/framework/mirror.c
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
* File Authors : Aoran Zeng <ccmywish@qq.com>
* | Heng Guo <2085471348@qq.com>
* Contributors : Shengwei Chen <414685209@qq.com>
* | Jialin Lyu <jialinlvcn@aliyun.com>
* |
* Created On : <2023-08-29>
* Last Modified : <2025-03-09>
@@ -36,12 +37,23 @@ Tuna =
{NotSkip, NA, NA, "https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"}
},

/**
* @note 2025-3-17 SJTUG 共设两台服务器。思源服务器同步新镜像,致远服务器兼容原 SJTU 镜像站。
* @note 有些target(例如flathub)思源站的兼容性不好,可以考虑将两个服务器分开测试
*/

Sjtug_Zhiyuan =
{
"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan}
},

Sjtug_Siyuan =
{
"sjtu", "SJTUG-siyuan", "上海交通大学思源镜像站", "https://mirror.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/ctan" Big_File_ctan}
},

Zju =
{
"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
38 changes: 32 additions & 6 deletions src/recipe/ware/Flathub.c
Original file line number Diff line number Diff line change
@@ -2,19 +2,40 @@
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Contributors : Jialin Lyu <jialinlvcn@aliyun.com>
* Created On : <2023-09-11>
* Last Modified : <2024-08-15>
* Last Modified : <2025-03-17>
* ------------------------------------------------------------*/

/**
* @update 2023-09-11
* @note 目前只有一个源
* @update 2025-03-17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 @update 表示的是源的最后更新时间,只需要把 2023 那个时间覆盖掉即可。
@note 可以把之前的删掉

* @note 加入官方仓库
* @note SJTUG分为两个镜像站 思源站和致远站 以解决思源站可能无法访问的问题
*/
static SourceProvider_t wr_flathub_upstream =
{
"Flathub", "Flathub", "Flathub官方仓库", "https://flathub.org/repo",
// 没有找到 DaoCloud 合适的下载链接,先随便给一个,以规避 chsrc 自动测速时所有 dockerhub 镜像站都没有测速链接带来的 bug
{NotSkip, NA, NA, "https://flathub.org/repo/flathub.gpg"}
},

wr_flathub_siyuan =
{
"sjtu", "SJTUG-siyuan", "上海交通大学思源镜像站Flathub", "https://mirror.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirror.sjtu.edu.cn/flathub/flathub.gpg"}
},

wr_flathub_zhiyuan =
{
"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站Flathub", "https://mirrors.sjtug.sjtu.edu.cn/",
{NotSkip, NA, NA, "https://mirrors.sjtug.sjtu.edu.cn/flathub/flathub.gpg"}
};

static Source_t wr_flathub_sources[] =
{
{&UpstreamProvider, NULL},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/flathub"},
{&wr_flathub_upstream, "https://flathub.org/repo"},
{&wr_flathub_siyuan, "https://mirror.sjtu.edu.cn/flathub"},
{&wr_flathub_zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/flathub"},
};
def_sources_n(wr_flathub);

@@ -34,6 +55,11 @@ wr_flathub_setsrc (char *option)
);
puts (note);

char *repo_note = "Flathub 中部分软件由于重分发授权问题,需要从官方服务器下载,无法使用镜像站加速\n"
"比如 NVIDIA 驱动、JetBrains 系列软件等\n"
"尝试运行 flatpak remote-modify flathub --url=https://flathub.org/repo";
puts (repo_note);

char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
chsrc_run (cmd, RunOpt_Default);