Skip to content
Open
Show file tree
Hide file tree
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
89 changes: 71 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion generate-assets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ url = "2.2.2"
anyhow = "1.0.58"
base64 = "0.22.1"
cratesio-dbdump-csvtab = "0.2.2"
ureq = { version = "2.5.0", features = ["json"] }
ureq = { version = "3.1.4", features = ["json"] }
dotenv = "0.15.0"
semver = "1.0.23"

Expand Down
25 changes: 15 additions & 10 deletions generate-assets/src/github_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ pub struct GithubClient {

impl GithubClient {
pub fn new(token: String) -> Self {
let agent: ureq::Agent = ureq::AgentBuilder::new()
let config = ureq::Agent::config_builder()
.user_agent("bevy-website-generate-assets")
.build();

let agent: ureq::Agent = config.into();

Self { agent, token }
}

Expand All @@ -57,10 +59,11 @@ impl GithubClient {
.get(&format!(
"{BASE_URL}/repos/{username}/{repository_name}/contents/{content_path}"
))
.set("Accept", "application/json")
.set("Authorization", &format!("Bearer {}", self.token))
.header("Accept", "application/json")
.header("Authorization", &format!("Bearer {}", self.token))
.call()?
.into_json()?;
.body_mut()
.read_json()?;

if response.encoding == "base64" {
use base64::Engine;
Expand All @@ -82,10 +85,11 @@ impl GithubClient {
.get(&format!(
"{BASE_URL}/repos/{username}/{repository_name}/license"
))
.set("Accept", "application/json")
.set("Authorization", &format!("Bearer {}", self.token))
.header("Accept", "application/json")
.header("Authorization", &format!("Bearer {}", self.token))
.call()?
.into_json()?;
.body_mut()
.read_json()?;

let license = response.license.spdx_id;

Expand All @@ -108,10 +112,11 @@ impl GithubClient {
.get(&format!(
"{BASE_URL}/search/code?q=repo:{username}/{repository_name}+filename:{file_name}"
))
.set("Accept", "application/json")
.set("Authorization", &format!("Bearer {}", self.token))
.header("Accept", "application/json")
.header("Authorization", &format!("Bearer {}", self.token))
.call()?
.into_json()?;
.body_mut()
.read_json()?;

if response.incomplete_results {
println!(
Expand Down
16 changes: 10 additions & 6 deletions generate-assets/src/gitlab_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ pub struct GitlabClient {

impl GitlabClient {
pub fn new(token: String) -> Self {
let agent: ureq::Agent = ureq::AgentBuilder::new()
let config = ureq::Agent::config_builder()
.user_agent("bevy-website-generate-assets")
.build();

let agent: ureq::Agent = config.into();

Self {
agent,
_token: token,
Expand All @@ -42,10 +44,11 @@ impl GitlabClient {
let response: Vec<GitlabProjectSearchResponse> = self
.agent
.get(&format!("{BASE_URL}?search={repository_name}"))
.set("Accept", "application/json")
// .set("Authorization", &format!("Bearer {}", self.token))
.header("Accept", "application/json")
// .header("Authorization", &format!("Bearer {}", self.token))
.call()?
.into_json()?;
.body_mut()
.read_json()?;
Ok(response)
}

Expand All @@ -61,10 +64,11 @@ impl GitlabClient {
.get(&format!(
"{BASE_URL}/{id}/repository/files/{content_path}?ref={default_branch}"
))
.set("Accept", "application/json")
.header("Accept", "application/json")
// .set("Authorization", &format!("Bearer {}", self.token))
.call()?
.into_json()?;
.body_mut()
.read_json()?;

if response.encoding == "base64" {
use base64::Engine;
Expand Down
2 changes: 1 addition & 1 deletion generate-release/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
publish = false

[dependencies]
ureq = { version = "2.5.0", features = ["json"] }
ureq = { version = "3.1.4", features = ["json"] }
serde = { version = "1", features = ["derive"] }
anyhow = "1.0.58"
pulldown-cmark = "0.9.2"
Expand Down
Loading