Skip to content

Commit

Permalink
remove unnecessary hostname_ui config
Browse files Browse the repository at this point in the history
  • Loading branch information
privacyguard committed Jul 12, 2024
1 parent 32c3b76 commit af6bb9d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 22 deletions.
3 changes: 0 additions & 3 deletions config/defaults.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@
}
# the domain name of your instance (mandatory)
hostname: "unset"
# the domain name of your lemmy-ui instance used for OAUTH2 (defaults to the backend instance
# hostname)
hostname_ui: "example.com"
# Address where lemmy should listen for incoming requests
bind: "0.0.0.0"
# Port where lemmy should listen for incoming requests
Expand Down
8 changes: 1 addition & 7 deletions crates/api_crud/src/user/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,7 @@ pub async fn authenticate_with_oauth(

// validate the redirect_uri
let redirect_uri = &data.redirect_uri;
if !redirect_uri
.host_str()
.unwrap_or("")
.eq(context.settings().get_ui_hostname())
|| !redirect_uri
.scheme()
.eq(context.settings().get_protocol_string())
if redirect_uri.host_str().unwrap_or("").is_empty()
|| !redirect_uri.path().eq(&String::from("/oauth/callback"))
|| !redirect_uri.query().unwrap_or("").is_empty()
{
Expand Down
7 changes: 0 additions & 7 deletions crates/utils/src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ impl Settings {
fs::read_to_string(Self::get_config_location())
}

pub fn get_ui_hostname(&self) -> &str {
match &self.hostname_ui {
Some(domain) => domain,
_ => &self.hostname,
}
}

/// Returns either "http" or "https", depending on tls_enabled setting
pub fn get_protocol_string(&self) -> &'static str {
if self.tls_enabled {
Expand Down
5 changes: 0 additions & 5 deletions crates/utils/src/settings/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ pub struct Settings {
#[default("unset")]
#[doku(example = "example.com")]
pub hostname: String,
/// the domain name of your lemmy-ui instance used for OAUTH2 (defaults to the backend instance
/// hostname)
#[default(None)]
#[doku(example = "example.com")]
pub hostname_ui: Option<String>,
/// Address where lemmy should listen for incoming requests
#[default(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)))]
#[doku(as = "String")]
Expand Down

0 comments on commit af6bb9d

Please sign in to comment.