aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--maintainers2
-rw-r--r--readme.md2
-rw-r--r--src/constants.rs1
-rw-r--r--src/utils.rs10
5 files changed, 11 insertions, 6 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 2bbc990..127ecd6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "senpy-api"
version = "0.1.0"
-authors = ["Fuwn <[email protected]>"]
+authors = ["Fuwn <[email protected]>"]
edition = "2021"
#description = ""
readme = "README.md"
diff --git a/maintainers b/maintainers
index 6fad053..15165e4 100644
--- a/maintainers
+++ b/maintainers
@@ -1 +1 @@
-Fuwn <[email protected]> (@fuwn)
+Fuwn <[email protected]> (@fuwn)
diff --git a/readme.md b/readme.md
index baf16c1..433696e 100644
--- a/readme.md
+++ b/readme.md
@@ -9,7 +9,7 @@
<a href="https://www.codefactor.io/repository/github/senpy-club/api">
<img src="https://www.codefactor.io/repository/github/senpy-club/api/badge" alt="codefactor" />
</a>
-<a href="https://saythanks.io/to/[email protected]">
+<a href="https://saythanks.io/to/[email protected]">
<img src="https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg" alt="Say Thanks" />
</a>
<a href="./license">
diff --git a/src/constants.rs b/src/constants.rs
index 67e69ab..8fd2f3b 100644
--- a/src/constants.rs
+++ b/src/constants.rs
@@ -5,4 +5,3 @@ pub const GITHUB_USER_CONTENT: &str =
"https://raw.githubusercontent.com/laynH/Anime-Girls-Holding-Programming-Books/master/";
pub const GITHUB_API_ENDPOINT: &str = "https://api.github.com/repos/laynH/Anime-Girls-Holding-Progr\
amming-Books/git/trees/master?recursive=1";
-pub const USER_AGENT: &str = env!("CARGO_PKG_NAME");
diff --git a/src/utils.rs b/src/utils.rs
index a55ddc6..09c8d49 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::{
- constants::{GITHUB_API_ENDPOINT, GITHUB_USER_CONTENT, USER_AGENT},
+ constants::{GITHUB_API_ENDPOINT, GITHUB_USER_CONTENT},
structures::GitHubAPIResponse,
};
@@ -11,7 +11,13 @@ use crate::{
pub async fn github_api() -> Result<GitHubAPIResponse, Box<dyn std::error::Error>> {
let mut client = actix_web::client::Client::new()
.get(GITHUB_API_ENDPOINT)
- .header("User-Agent", USER_AGENT);
+ .header(
+ "User-Agent",
+ format!(
+ "senpy-api - {}",
+ (0..10).map(|_| rand::random::<char>()).collect::<String>()
+ ),
+ );
if std::env::var("GITHUB_TOKEN").is_ok() {
client = client.header(