Skip to content

Commit 886efa2

Browse files
committed
feat: add Forgejo support as alias for Gitea
1 parent 78d3b89 commit 886efa2

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/update_info/forge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl ForgeUpdateInfo {
103103
),
104104
ForgeKind::Gitea { instance } => {
105105
let gt = Gitea::new(UreqClient, format!("https://{instance}"))
106-
.with_token_from_env(&["GITEA_TOKEN"]);
106+
.with_token_from_env(&["GITEA_TOKEN", "FORGEJO_TOKEN"]);
107107
action(&gt)
108108
}
109109
}

src/update_info/parser.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn parse(s: &str) -> Result<UpdateInfoInner> {
2424
"gh-releases-zsync" => parse_forge(ForgeKind::GitHub, &parts, "gh-releases-zsync"),
2525
"gl-releases-zsync" => parse_forge(ForgeKind::GitLab, &parts, "gl-releases-zsync"),
2626
"cb-releases-zsync" => parse_forge(ForgeKind::Codeberg, &parts, "cb-releases-zsync"),
27-
"gitea-releases-zsync" => parse_gitea(&parts),
27+
"gitea-releases-zsync" | "forgejo-releases-zsync" => parse_gitea(&parts),
2828
_ => Err(Error::InvalidUpdateInfo(format!(
2929
"Unknown update information type: {}",
3030
parts[0]
@@ -143,6 +143,22 @@ mod tests {
143143
}
144144
}
145145

146+
#[test]
147+
fn parse_forgejo_releases() {
148+
let info =
149+
parse("forgejo-releases-zsync|forgejo.example.com|owner|repo|latest|app-*.AppImage")
150+
.unwrap();
151+
match info {
152+
UpdateInfoInner::Forge(f) => {
153+
assert!(matches!(f.kind, ForgeKind::Gitea { .. }));
154+
if let ForgeKind::Gitea { instance } = f.kind {
155+
assert_eq!(instance, "forgejo.example.com");
156+
}
157+
}
158+
_ => panic!("Expected Forge variant"),
159+
}
160+
}
161+
146162
#[test]
147163
fn parse_invalid_type() {
148164
assert!(parse("invalid|params").is_err());

0 commit comments

Comments
 (0)