diff --git a/src/chsrc-main.c b/src/chsrc-main.c index e0779de13..b82f1e212 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -85,7 +85,7 @@ chsrc_register_chefs_and_sauciers () // 该注释下一行的用户 ID 为 Gitee ID chef_register_contributor ("@hezonglun", "HeZongLun", "hezonglun123456@outlook.com", NULL); chef_register_contributor ("@Young-Lord", "LY", "ly-niko@qq.com", NULL); - chef_register_contributor ("@MingriLingran", "MingriLingran", "i@linran.moe", NULL); + chef_register_contributor ("@LinRanAstra", "LinRanAstra", "i@linran.moe", NULL); chef_register_contributor ("@usernameisnull", "MaBing", "cumt_ttr@163.com", NULL); chef_register_contributor ("@AnonTokio", "Anon Tokio", "anontokio@163.com", NULL); chef_register_contributor ("@NewbieXvwu", "Mingzhe Jiang", "newbiexvwu@gmail.com", NULL); diff --git a/src/recipe/lang/Python/rawstr4c.md b/src/recipe/lang/Python/rawstr4c.md index b62b2bf95..743fdb802 100644 --- a/src/recipe/lang/Python/rawstr4c.md +++ b/src/recipe/lang/Python/rawstr4c.md @@ -4,7 +4,7 @@ ! Config Type : rawstr4c (Markdown) ! Config Authors: @ccmywish ! | @happy-game - ! | @MingriLingran + ! | @LinRanAstra ! Contributors : Nil Null ! Created On : <2025-07-14> ! Last Modified : <2025-12-29> diff --git a/src/recipe/lang/Python/uv/uv-pypi-index.c b/src/recipe/lang/Python/uv/uv-pypi-index.c index 467485028..24f5fa434 100644 --- a/src/recipe/lang/Python/uv/uv-pypi-index.c +++ b/src/recipe/lang/Python/uv/uv-pypi-index.c @@ -12,7 +12,7 @@ pl_uv_pypi_index_prepare (void) chef_set_recipe_created_on (this, "2024-12-11"); chef_set_recipe_last_updated (this, "2026-08-19"); - chef_set_chefs (this, 3, "@happy-game", "@MingriLingran", "@Mikachu2333"); + chef_set_chefs (this, 3, "@happy-game", "@LinRanAstra", "@Mikachu2333"); chef_set_sauciers (this, 2, "@ccmywish", "@Kattos"); chef_set_scope_cap (this, ProjectScope, ScopeCap_Able_And_Implemented); diff --git a/src/recipe/menu.c b/src/recipe/menu.c index b1b71de25..b453e98a6 100644 --- a/src/recipe/menu.c +++ b/src/recipe/menu.c @@ -148,7 +148,7 @@ chsrc_init_menu () add(Netease); add(Sohu); - add(Api7); add(Fit2Cloud); add(DaoCloud); + add(Api7); add(Fit2Cloud); add(DaoCloud); add(OneMs); /* ------------------------ 专用镜像站 ------------------------ */ diff --git a/src/recipe/ware/Docker/Docker.c b/src/recipe/ware/Docker/Docker.c index ae917c8f6..29d1a7644 100644 --- a/src/recipe/ware/Docker/Docker.c +++ b/src/recipe/ware/Docker/Docker.c @@ -17,6 +17,13 @@ Fit2Cloud = IS_DedicatedMirrorSite, "fit2cloud", "FIT2CLOUD", "杭州飞致云信息科技有限公司", "https://www.fit2cloud.com/", {SKIP, ToFill, ToFill, NULL, ROUGH} +}, + +OneMs = +{ + IS_DedicatedMirrorSite, + "1ms", "1ms", "毫秒镜像", "https://1ms.run/", + def_need_measure_info }; def_dish(wr_docker, "docker/dockerhub"); @@ -27,10 +34,10 @@ wr_docker_prepare () chef_prep_this_dish (wr_docker, gs); chef_set_recipe_created_on (this, "2024-06-08"); - chef_set_recipe_last_updated (this, "2025-08-09"); + chef_set_recipe_last_updated (this, "2026-11-30"); chef_set_chefs (this, 2, "@happy-game", "@ccmywish"); - chef_set_sauciers (this, 0); + chef_set_sauciers (this, 1, "@LinRanAstra"); chef_set_scope_cap (this, ProjectScope, ScopeCap_Unable); chef_set_scope_cap (this, UserScope, ScopeCap_Able_And_Implemented); @@ -43,7 +50,8 @@ wr_docker_prepare () def_sources_begin() {&UpstreamProvider, "https://hub.docker.com/", DelegateToUpstream}, {&DaoCloud, "https://docker.m.daocloud.io", DelegateToMirror}, - {&Fit2Cloud, "https://docker.1panel.live", DelegateToMirror} + {&Fit2Cloud, "https://docker.1panel.live", DelegateToMirror}, + {&OneMs, "https://docker.1ms.run", DelegateToMirror} def_sources_end() } @@ -106,9 +114,23 @@ wr_docker_setsrc (char *option) else { chsrc_alert2 ("未找到 jq 命令, 将使用 sed 换源"); + + /* sed 匹配的是字面量 "registry-mirrors":,如果配置文件中没有该键 + (也就没有该字面量), sed 一行也不会匹配到, 却仍以退出码 0 结束, + 从而错误地报告换源成功, 因此必须先确认该键存在 */ + char *config = xy_file_read (WR_Docker_ConfigFile); + if (!strstr (config, "\"registry-mirrors\":")) + { + chsrc_error2 ("配置文件中未找到 \"registry-mirrors\": 键, 无法使用 sed 换源"); + chsrc_note2 ("请确认该键存在、且冒号紧跟其后, 或手动添加以下内容后重试:"); + println (to_add); + exit (Exit_UserCause); + } + char *cmd = xy_str_gsub (RAWSTR_wr_docker_sed_command, "@1@", source.url); cmd = xy_str_gsub (cmd, "@2@", WR_Docker_ConfigFile); chsrc_run (cmd, RunOpt_Default); + chsrc_succ2 ("源已替换"); } } else diff --git a/src/recipe/ware/Docker/rawstr4c.h b/src/recipe/ware/Docker/rawstr4c.h index a87fd2448..b072759d9 100644 --- a/src/recipe/ware/Docker/rawstr4c.h +++ b/src/recipe/ware/Docker/rawstr4c.h @@ -10,5 +10,5 @@ char RAWSTR_wr_docker_check_cmd[] = "\x6a\x71\x20\x27\x2e\x5b\x22\x72\x65\x67\x6 char RAWSTR_wr_docker_insert_cmd[] = "\x6a\x71\x20\x27\x2e\x5b\x22\x72\x65\x67\x69\x73\x74\x72\x79\x2d\x6d\x69\x72\x72\x6f\x72\x73\x22\x5d\x20\x7c\x3d\x20\x5b\x22\x40\x31\x40\x22\x5d\x20\x2b\x20\x2e\x27\x20\x40\x32\x40\x2e\x62\x61\x6b\x20\x3e\x20\x20\x40\x32\x40"; -char RAWSTR_wr_docker_sed_command[] = "\x73\x65\x64\x20\x2d\x7a\x20\x2d\x69\x20\x27\x73\x2f\x22\x72\x65\x67\x69\x73\x74\x72\x79\x2d\x6d\x69\x72\x72\x6f\x72\x73\x22\x3a\x5b\x5e\x5d\x5d\x2a\x5d\x2f\x22\x72\x65\x67\x69\x73\x74\x72\x79\x2d\x6d\x69\x72\x72\x6f\x72\x73\x22\x3a\x5b\x22\x40\x31\x40\x22\x5d\x2f\x27\x20\x40\x32\x40"; +char RAWSTR_wr_docker_sed_command[] = "\x73\x65\x64\x20\x2d\x7a\x20\x2d\x69\x20\x27\x73\x7c\x22\x72\x65\x67\x69\x73\x74\x72\x79\x2d\x6d\x69\x72\x72\x6f\x72\x73\x22\x3a\x5b\x5e\x5d\x5d\x2a\x5d\x7c\x22\x72\x65\x67\x69\x73\x74\x72\x79\x2d\x6d\x69\x72\x72\x6f\x72\x73\x22\x3a\x5b\x22\x40\x31\x40\x22\x5d\x7c\x27\x20\x40\x32\x40"; diff --git a/src/recipe/ware/Docker/rawstr4c.md b/src/recipe/ware/Docker/rawstr4c.md index de6185ae2..574bfc4dd 100644 --- a/src/recipe/ware/Docker/rawstr4c.md +++ b/src/recipe/ware/Docker/rawstr4c.md @@ -6,7 +6,7 @@ ! | happy game ! Contributors : Nil Null ! Created On : <2025-07-14> - ! Last Modified : <2025-08-10> + ! Last Modified : <2026-11-30> ! ---------------------------------------------------------- --> # rawstr4c input @@ -61,7 +61,9 @@ jq '.["registry-mirrors"] |= ["@1@"] + .' @2@.bak > @2@ 没有 `jq` 时,用 `sed` 换源,写入到配置文件中 ```sh -sed -z -i 's/"registry-mirrors":[^]]*]/"registry-mirrors":["@1@"]/' @2@ +sed -z -i 's|"registry-mirrors":[^]]*]|"registry-mirrors":["@1@"]|' @2@ ``` 注释: `[^]]*` 即不是 `]` 的所有字符, 后面再跟一个 `]` 由于没有前面的 `[`,因此可被解析为普通字符 `]`,没有特殊含义 + +注释: 分隔符必须用 `|` 而不能用 `/`,因为换源链接本身就含有 `/`,会把 `s` 命令提前截断,sed 报 `unknown option to 's'`