refactor!: setup file proxy for projects
This commit is contained in:
@@ -4,13 +4,19 @@ use crate::AppState;
|
||||
use crate::error::{Error, Result};
|
||||
use crate::user::RepositorySchema;
|
||||
|
||||
pub async fn validate_repo(app_state: web::Data<AppState>, repo: &RepositorySchema) -> Result<()> {
|
||||
pub async fn validate_repo(
|
||||
app_state: web::Data<AppState>,
|
||||
repo: &RepositorySchema,
|
||||
user_id: &str,
|
||||
) -> Result<()> {
|
||||
let token = app_state.user.get_access_token(&user_id).await?;
|
||||
let response = app_state
|
||||
.reqwest_client
|
||||
.get(format!(
|
||||
"https://raw.githubusercontent.com/{}/HEAD/dist/index.html",
|
||||
repo.full_name
|
||||
))
|
||||
.bearer_auth(token)
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user