From 48be5f5acbcdb5865a970fa13d0da4e404c0d1bf Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Fri, 11 Jul 2025 21:06:28 +0800 Subject: [PATCH] Notify users --- src/chsrc-main.c | 37 ++++++++++++++++++++++++++++++++++- src/recipe/lang/Go.c | 10 +++++----- src/recipe/lang/Rust/Cargo.c | 9 +++++++++ src/recipe/lang/Rust/rustup.c | 18 ++++++++--------- 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index cfa7f88..27d9fe1 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -506,6 +506,33 @@ iterate_targets_ (const char ***array, size_t size, const char *input, const cha #define iterate_targets(ary, input, target) iterate_targets_(ary, xy_arylen(ary), input, target) + +/** + * 我们总是最后告诉用户一些维护信息 + */ +void +cli_notify_for_users () +{ + char *msg = "2025-07-11:\n\n" + + " 有时,同一镜像站对不同资源的实际服务速度差异,可能比不同镜像站之间的差异还要大。\n\n" + + " * 精准测速: 能真实反映您未来使用该资源时的速度,因为它直接测量您关注的那个资源。\n\n" + + " * 模糊测速: 仅代表该镜像站提供服务的一个可能速度。因而可能会出现测速数值较高,但实际使用体验不佳的现象。\n\n" + + " 因此,当您遇到模糊测速时,请务必向我们提交准确的测速链接,这既能帮助您,也能造福所有用户。\n\n" + + " chsrc 是一个自助和共建的项目。 维护者对于不熟悉的生态系统很难提供有价值的贡献。请您将这部分功能视为您的专属,您可以完全掌控和维护它,就像您是唯一的负责人一样。\n"; + + br();br(); + + chsrc_note2 (msg); +} + + + + typedef enum { TargetOp_Get_Source = 1, TargetOp_Set_Source, @@ -515,7 +542,7 @@ typedef enum { } TargetOp; /** - * 寻找target,并根据`code`执行相应的操作 + * 寻找target,并根据 @param:code 执行相应的操作 * * @param input 用户输入的目标 * @param code 对target要执行的操作 @@ -585,6 +612,14 @@ get_target (const char *input, TargetOp code, char *option) select_mirror_autoly (target->sources, target->sources_n, input); return true; } + + if (TargetOp_Set_Source==code + || TargetOp_Reset_Source==code + || TargetOp_Measure_Source==code) + { + cli_notify_for_users(); + } + return true; } diff --git a/src/recipe/lang/Go.c b/src/recipe/lang/Go.c index 21b3b9d..a642ae1 100644 --- a/src/recipe/lang/Go.c +++ b/src/recipe/lang/Go.c @@ -36,11 +36,11 @@ GoProxyIO = */ static Source_t pl_go_sources[] = { - {&pl_go_upstream, "https://proxy.golang.org"}, - {&GoProxyCN, "https://goproxy.cn"}, - {&Ali, "https://mirrors.aliyun.com/goproxy/"}, - {&Huawei, "https://mirrors.huaweicloud.com/goproxy/"}, - {&GoProxyIO, "https://goproxy.io"} + {&pl_go_upstream, "https://proxy.golang.org", NULL}, + {&GoProxyCN, "https://goproxy.cn", DelegateToMirror}, + {&Ali, "https://mirrors.aliyun.com/goproxy/", NULL}, + {&Huawei, "https://mirrors.huaweicloud.com/goproxy/", NULL}, + {&GoProxyIO, "https://goproxy.io", DelegateToMirror} }; def_sources_n(pl_go); diff --git a/src/recipe/lang/Rust/Cargo.c b/src/recipe/lang/Rust/Cargo.c index a0c5054..2bb743d 100644 --- a/src/recipe/lang/Rust/Cargo.c +++ b/src/recipe/lang/Rust/Cargo.c @@ -28,26 +28,35 @@ static Source_t pl_rust_cargo_sources[] = { {&pl_rust_cargo_upstream, "https://github.com/rust-lang/crates.io-index/", NULL}, + {&MirrorZ, "https://mirrors.cernet.edu.cn/crates.io-index/", NULL}, {&RsProxyCN, "https://rsproxy.cn/index/", NULL}, {&Ali, "https://mirrors.aliyun.com/crates.io-index/", "https://mirrors.aliyun.com/crates/api/v1/crates/windows/0.58.0/download"}, + {&Zju, "https://mirrors.zju.edu.cn/crates.io-index/", NULL}, + // {&Nju, "https://mirror.nju.edu.cn/git/crates.io-index.git/", // NULL}, + {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/", NULL}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/", NULL}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/", NULL}, + {&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/", "https://crates-io.proxy.ustclug.org/api/v1/crates/windows/0.58.0/download"}, + // {&Hust, "https://mirrors.hust.edu.cn/crates.io-index/", // NULL}, + {&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/", NULL} }; diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c index 96a90ed..23a3491 100644 --- a/src/recipe/lang/Rust/rustup.c +++ b/src/recipe/lang/Rust/rustup.c @@ -19,15 +19,15 @@ static SourceProvider_t pl_rust_binary_upstream = * @update 2025-06-17 */ static Source_t pl_rust_rustup_sources[] = { - {&pl_rust_binary_upstream, "https://static.rust-lang.org"}, - {&MirrorZ, "https://mirrors.cernet.edu.cn/rustup"}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup"}, - {&Ustc, "https://mirrors.ustc.edu.cn/rust-static"}, - {&Nju, "https://mirror.nju.edu.cn/rustup"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rust-static"}, - {&Zju, "https://mirrors.zju.edu.cn/rustup"}, - {&Iscas, "https://mirror.iscas.ac.cn/rustup"}, - {&Ali, "https://mirrors.aliyun.com/rustup"}, + {&pl_rust_binary_upstream, "https://static.rust-lang.org", NULL}, + {&MirrorZ, "https://mirrors.cernet.edu.cn/rustup", NULL}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup", NULL}, + {&Ustc, "https://mirrors.ustc.edu.cn/rust-static", NULL}, + {&Nju, "https://mirror.nju.edu.cn/rustup", NULL}, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/rust-static", NULL}, + {&Zju, "https://mirrors.zju.edu.cn/rustup", NULL}, + {&Iscas, "https://mirror.iscas.ac.cn/rustup", NULL}, + {&Ali, "https://mirrors.aliyun.com/rustup", NULL}, {&RsProxyCN, "https://rsproxy.cn"}}; def_sources_n(pl_rust_rustup);