mirror of
https://github.com/RubyMetric/chsrc
synced 2025-08-14 00:20:47 +08:00
Update struct
This commit is contained in:
parent
a7001636c9
commit
23ba6b8419
@ -47,7 +47,7 @@ chef_ensure_trailing_slash (char *str)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_add_contributors (Target_t *target, uint32_t count, ...)
|
chef_set_contributors (Target_t *target, uint32_t count, ...)
|
||||||
{
|
{
|
||||||
if (!target || count==0)
|
if (!target || count==0)
|
||||||
return;
|
return;
|
||||||
@ -70,7 +70,7 @@ chef_add_contributors (Target_t *target, uint32_t count, ...)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chef_add_recipe_authors (Target_t *target, size_t count, ...)
|
chef_set_recipe_authors (Target_t *target, size_t count, ...)
|
||||||
{
|
{
|
||||||
if (!target || count == 0)
|
if (!target || count == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* | Yangmoooo <yangmoooo@outlook.com>
|
* | Yangmoooo <yangmoooo@outlook.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-29>
|
* Created On : <2023-08-29>
|
||||||
* Last Modified : <2025-07-28>
|
* Last Modified : <2025-08-09>
|
||||||
*
|
*
|
||||||
* chsrc framework
|
* chsrc framework
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
@ -1080,6 +1080,29 @@ confirm_source (Source_t *source)
|
|||||||
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source()
|
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 修改 Provider 的测速地址
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
chsrc_set_provider_speed_measure_url (SourceProvider_t *provider, char *url)
|
||||||
|
{
|
||||||
|
provider->psmi.skip = NotSkip;
|
||||||
|
provider->psmi.url = xy_strdup (url);
|
||||||
|
chsrc_debug ("m", xy_strjoin (4, "recipe 重新为 ", provider->code, " 设置测速链接: ", url));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 修改 Provider 的测速精度
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
chsrc_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accuracy)
|
||||||
|
{
|
||||||
|
provider->psmi.accurate = accuracy;
|
||||||
|
chsrc_debug ("m", xy_strjoin (4, "recipe 重新为 ", provider->code, " 设置测速精度: ", accuracy ? "精准" : "粗略"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
chsrc_determine_chgtype (ChgType_t type)
|
chsrc_determine_chgtype (ChgType_t type)
|
||||||
{
|
{
|
||||||
|
@ -94,16 +94,19 @@ Source_t;
|
|||||||
#define NeedContribute NULL
|
#define NeedContribute NULL
|
||||||
/* 由 _sources_prepare 填充 */
|
/* 由 _sources_prepare 填充 */
|
||||||
#define FeedBySourcesPrepare NULL
|
#define FeedBySourcesPrepare NULL
|
||||||
|
/* 由 prelude() 修改 */
|
||||||
|
#define ChangedByPrelude NULL
|
||||||
|
|
||||||
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
|
||||||
|
|
||||||
|
|
||||||
enum Capability_t
|
typedef enum Capability_t
|
||||||
{
|
{
|
||||||
CanNot,
|
CanNot,
|
||||||
FullyCan,
|
FullyCan,
|
||||||
PartiallyCan
|
PartiallyCan
|
||||||
};
|
}
|
||||||
|
Capability_t;
|
||||||
|
|
||||||
|
|
||||||
/* Target Feature */
|
/* Target Feature */
|
||||||
@ -114,9 +117,9 @@ typedef struct Feature_t
|
|||||||
|
|
||||||
bool can_english;
|
bool can_english;
|
||||||
|
|
||||||
bool can_user_define; /* 用户自定义换源URL */
|
bool can_user_define;
|
||||||
|
|
||||||
enum Capability_t cap_locally;
|
Capability_t cap_locally;
|
||||||
char *cap_locally_explain;
|
char *cap_locally_explain;
|
||||||
|
|
||||||
char *note;
|
char *note;
|
||||||
@ -124,6 +127,14 @@ typedef struct Feature_t
|
|||||||
Feature_t;
|
Feature_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct Contributor_t
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
char *email;
|
||||||
|
}
|
||||||
|
Contributor_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct Target_t
|
typedef struct Target_t
|
||||||
{
|
{
|
||||||
void (*getfn) (char *option);
|
void (*getfn) (char *option);
|
||||||
@ -134,6 +145,26 @@ typedef struct Target_t
|
|||||||
|
|
||||||
Source_t *sources;
|
Source_t *sources;
|
||||||
size_t sources_n;
|
size_t sources_n;
|
||||||
|
|
||||||
|
bool can_english; /* 是否支持英文输出 */
|
||||||
|
bool can_user_define; /* 是否支持用户自定义URL来换源 */
|
||||||
|
Capability_t cap_local; /* 是否支持 local mode */
|
||||||
|
char *cap_local_explain; /* local mode 的说明 */
|
||||||
|
char *note; /* 备注 */
|
||||||
|
|
||||||
|
Contributor_t *recipe_authors;
|
||||||
|
size_t recipe_authors_n;
|
||||||
|
|
||||||
|
Contributor_t *contributors;
|
||||||
|
size_t contributors_n;
|
||||||
|
|
||||||
|
Contributor_t *current_chef; // 只有一个主维护者
|
||||||
|
Contributor_t *current_sous_chefs; // 可以有多个副维护者
|
||||||
|
size_t current_sous_chefs_n;
|
||||||
|
|
||||||
|
char *recipe_created_on;
|
||||||
|
char *recipe_last_updated;
|
||||||
|
char *sources_last_updated;
|
||||||
}
|
}
|
||||||
Target_t;
|
Target_t;
|
||||||
|
|
||||||
@ -174,7 +205,7 @@ TargetRegisterInfo_t;
|
|||||||
/* 以下宏仅能放在 prelude() 中使用 */
|
/* 以下宏仅能放在 prelude() 中使用 */
|
||||||
#define use_this(t) Target_t *this = &t##_target;
|
#define use_this(t) Target_t *this = &t##_target;
|
||||||
|
|
||||||
#define def_sources_begin() static Source_t sources[] = {
|
#define def_sources_begin() Source_t sources[] = {
|
||||||
#define def_sources_end() }; this->sources = sources; this->sources_n = xy_arylen(sources);
|
#define def_sources_end() }; this->sources = sources; this->sources_n = xy_arylen(sources);
|
||||||
|
|
||||||
#define def_upstream_provider(url) SourceProvider_t upstream = UpstreamProvider; upstream.site = url;
|
#define def_upstream_provider(url) SourceProvider_t upstream = UpstreamProvider; upstream.site = url;
|
||||||
|
@ -13,10 +13,10 @@ wr_flathub_prelude ()
|
|||||||
chef_set_recipe_last_updated_date (this, "2025-08-09");
|
chef_set_recipe_last_updated_date (this, "2025-08-09");
|
||||||
|
|
||||||
|
|
||||||
chef_add_recipe_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
|
chef_set_recipe_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
|
||||||
chef_set_current_chef (this, NULL, NULL);
|
chef_set_current_chef (this, NULL, NULL);
|
||||||
chef_set_current_sous_chefs (this, 0);
|
chef_set_current_sous_chefs (this, 0);
|
||||||
chef_add_contributors (this, 1,
|
chef_set_contributors (this, 1,
|
||||||
"Jialin Lyu", "jialinlvcn@aliyun.com");
|
"Jialin Lyu", "jialinlvcn@aliyun.com");
|
||||||
|
|
||||||
|
|
||||||
@ -30,7 +30,9 @@ wr_flathub_prelude ()
|
|||||||
def_sources_end()
|
def_sources_end()
|
||||||
|
|
||||||
|
|
||||||
chef_debug_target(this);
|
chsrc_set_provider_speed_measure_url (&upstream, "https://flathub.org/repo/flathub.gpg");
|
||||||
|
/* upstream 默认是 ACCURATE 的,但是我们给了一个超小的文件,测速效果严重失真,所以改为 ROUGH */
|
||||||
|
chsrc_set_provider_speed_measure_accuracy (&upstream, ROUGH);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @note 下述上海交大两个镜像站都可使用,但实际使用时出现过无法访问的情况 (GitHub-#178),
|
* @note 下述上海交大两个镜像站都可使用,但实际使用时出现过无法访问的情况 (GitHub-#178),
|
||||||
@ -38,10 +40,6 @@ wr_flathub_prelude ()
|
|||||||
* 若无速度,则证明无法访问。
|
* 若无速度,则证明无法访问。
|
||||||
* 注意,这会使得测速的效果严重失真。
|
* 注意,这会使得测速的效果严重失真。
|
||||||
*/
|
*/
|
||||||
chsrc_set_provider_speed_measure_url (&upstream, "https://flathub.org/repo/flathub.gpg");
|
|
||||||
/* upstream 默认是 ACCURATE 的,但是我们给了一个超小的文件,测速效果严重失真,所以改为 ROUGH */
|
|
||||||
chsrc_set_provider_speed_measure_accuracy (&upstream, ROUGH);
|
|
||||||
|
|
||||||
chsrc_set_provider_speed_measure_url (&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/flathub/flathub.gpg");
|
chsrc_set_provider_speed_measure_url (&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/flathub/flathub.gpg");
|
||||||
chsrc_set_provider_speed_measure_url (&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/flathub/flathub.gpg");
|
chsrc_set_provider_speed_measure_url (&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/flathub/flathub.gpg");
|
||||||
/* 由于实在找不到其他可测文件,所以这也只能是 ROUGH */
|
/* 由于实在找不到其他可测文件,所以这也只能是 ROUGH */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user