forked from github-starred/komodo
Compare commits
1 Commits
main
...
copilot/se
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a316661024 |
@@ -1,4 +1,4 @@
|
||||
use std::time::Instant;
|
||||
use std::{sync::OnceLock, time::Instant};
|
||||
|
||||
use axum::{Router, extract::Path, http::HeaderMap, routing::post};
|
||||
use derive_variants::{EnumVariants, ExtractVariant};
|
||||
@@ -108,15 +108,20 @@ async fn handler(
|
||||
res.map(|res| res.0)
|
||||
}
|
||||
|
||||
fn login_options_response() -> GetLoginOptionsResponse {
|
||||
let config = core_config();
|
||||
GetLoginOptionsResponse {
|
||||
local: config.local_auth,
|
||||
github: github_oauth_client().is_some(),
|
||||
google: google_oauth_client().is_some(),
|
||||
oidc: oidc_client().load().is_some(),
|
||||
registration_disabled: config.disable_user_registration,
|
||||
}
|
||||
fn login_options_reponse() -> &'static GetLoginOptionsResponse {
|
||||
static GET_LOGIN_OPTIONS_RESPONSE: OnceLock<
|
||||
GetLoginOptionsResponse,
|
||||
> = OnceLock::new();
|
||||
GET_LOGIN_OPTIONS_RESPONSE.get_or_init(|| {
|
||||
let config = core_config();
|
||||
GetLoginOptionsResponse {
|
||||
local: config.local_auth,
|
||||
github: github_oauth_client().is_some(),
|
||||
google: google_oauth_client().is_some(),
|
||||
oidc: oidc_client().load().is_some(),
|
||||
registration_disabled: config.disable_user_registration,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
impl Resolve<AuthArgs> for GetLoginOptions {
|
||||
@@ -125,7 +130,7 @@ impl Resolve<AuthArgs> for GetLoginOptions {
|
||||
self,
|
||||
_: &AuthArgs,
|
||||
) -> serror::Result<GetLoginOptionsResponse> {
|
||||
Ok(login_options_response())
|
||||
Ok(*login_options_reponse())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,12 @@ export const BuildConfig = ({
|
||||
|
||||
{image_registries?.map((registry, index) => (
|
||||
<ImageRegistryConfig
|
||||
key={index}
|
||||
key={
|
||||
(registry.domain ?? "") +
|
||||
(registry.organization ?? "") +
|
||||
(registry.account ?? "") +
|
||||
index
|
||||
}
|
||||
registry={registry}
|
||||
imageName={imageName}
|
||||
setRegistry={(registry) =>
|
||||
|
||||
@@ -123,7 +123,6 @@ export const useLoginOptions = () => {
|
||||
return useQuery({
|
||||
queryKey: ["GetLoginOptions"],
|
||||
queryFn: () => komodo_client().auth("GetLoginOptions", {}),
|
||||
refetchInterval: 30_000,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user