Skip to content

Commit

Permalink
refactor(webserver): decouple oauth/github route and integrations/git… (
Browse files Browse the repository at this point in the history
#1798)

* refactor(webserver): decouple oauth/github route and integrations/github route

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
wsxiaoys and autofix-ci[bot] authored Apr 9, 2024
1 parent ed25f4a commit d6020e8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
25 changes: 20 additions & 5 deletions ee/tabby-webserver/src/integrations/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ use serde::Deserialize;
use tracing::error;
use url::Url;

use crate::{
oauth::github::GithubOAuthResponse,
schema::{
github_repository_provider::GithubRepositoryProviderService, setting::SettingService,
},
use crate::schema::{
github_repository_provider::GithubRepositoryProviderService, setting::SettingService,
};

#[derive(Debug, Deserialize)]
#[allow(dead_code)]
struct GithubOAuthResponse {
#[serde(default)]
access_token: String,
#[serde(default)]
scope: String,
#[serde(default)]
token_type: String,

#[serde(default)]
error: String,
#[serde(default)]
error_description: String,
#[serde(default)]
error_uri: String,
}

#[derive(Deserialize)]
struct CallbackParams {
state: ID,
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions ee/tabby-webserver/src/oauth/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ use crate::schema::auth::{AuthenticationService, OAuthCredential, OAuthProvider}

#[derive(Debug, Deserialize)]
#[allow(dead_code)]
pub struct GithubOAuthResponse {
struct GithubOAuthResponse {
#[serde(default)]
pub access_token: String,
access_token: String,
#[serde(default)]
pub scope: String,
scope: String,
#[serde(default)]
pub token_type: String,
token_type: String,

#[serde(default)]
pub error: String,
error: String,
#[serde(default)]
pub error_description: String,
error_description: String,
#[serde(default)]
pub error_uri: String,
error_uri: String,
}

#[derive(Debug, Deserialize)]
Expand Down

0 comments on commit d6020e8

Please sign in to comment.