mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-29 05:05:42 +00:00
Compare commits
4 Commits
cbe31d442d
...
v4.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
287c6f975f | ||
|
|
0255e954f7 | ||
|
|
c5d70d7c93 | ||
|
|
adffb4ac0a |
@@ -8,7 +8,7 @@
|
|||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Tinyauth" />
|
<meta name="apple-mobile-web-app-title" content="Tinyauth" />
|
||||||
<meta name="robots" content="none" />
|
<meta name="robots" content="nofollow, noindex" />
|
||||||
<link rel="manifest" href="/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
<title>Tinyauth</title>
|
<title>Tinyauth</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
import { useAppContext } from "@/context/app-context";
|
import { useAppContext } from "@/context/app-context";
|
||||||
import { LanguageSelector } from "../language/language";
|
import { LanguageSelector } from "../language/language";
|
||||||
import { Outlet } from "react-router";
|
import { Outlet } from "react-router";
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { DomainWarning } from "../domain-warning/domain-warning";
|
import { DomainWarning } from "../domain-warning/domain-warning";
|
||||||
|
|
||||||
const BaseLayout = ({ children }: { children: React.ReactNode }) => {
|
const BaseLayout = ({ children }: { children: React.ReactNode }) => {
|
||||||
const { backgroundImage } = useAppContext();
|
const { backgroundImage, title } = useAppContext();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (title !== "Tinyauth") {
|
||||||
|
document.title = title + " - Tinyauth";
|
||||||
|
}
|
||||||
|
}, [title]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -150,18 +150,6 @@ func (app *BootstrapApp) Setup() error {
|
|||||||
configuredProviders := make([]controller.Provider, 0)
|
configuredProviders := make([]controller.Provider, 0)
|
||||||
|
|
||||||
for id, provider := range oauthProviders {
|
for id, provider := range oauthProviders {
|
||||||
if id == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if provider.Name == "" {
|
|
||||||
if name, ok := config.OverrideProviders[id]; ok {
|
|
||||||
provider.Name = name
|
|
||||||
} else {
|
|
||||||
provider.Name = utils.Capitalize(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
configuredProviders = append(configuredProviders, controller.Provider{
|
configuredProviders = append(configuredProviders, controller.Provider{
|
||||||
Name: provider.Name,
|
Name: provider.Name,
|
||||||
ID: id,
|
ID: id,
|
||||||
|
|||||||
@@ -71,14 +71,12 @@ func (docker *DockerService) GetLabels(appDomain string) (config.App, error) {
|
|||||||
for _, ctr := range containers {
|
for _, ctr := range containers {
|
||||||
inspect, err := docker.InspectContainer(ctr.ID)
|
inspect, err := docker.InspectContainer(ctr.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Str("id", ctr.ID).Err(err).Msg("Error inspecting container, skipping")
|
return config.App{}, err
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
labels, err := decoders.DecodeLabels(inspect.Config.Labels)
|
labels, err := decoders.DecodeLabels(inspect.Config.Labels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Str("id", ctr.ID).Err(err).Msg("Error getting container labels, skipping")
|
return config.App{}, err
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for appName, appLabels := range labels.Apps {
|
for appName, appLabels := range labels.Apps {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func (broker *OAuthBrokerService) Init() error {
|
|||||||
log.Error().Err(err).Msgf("Failed to initialize OAuth service: %T", name)
|
log.Error().Err(err).Msgf("Failed to initialize OAuth service: %T", name)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Info().Str("service", service.GetName()).Msg("Initialized OAuth service")
|
log.Info().Str("service", name).Msg("Initialized OAuth service")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ func GetOAuthProvidersConfig(env []string, args []string, appUrl string) (map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we have google/github providers and no redirect URL then set a default
|
// If we have google/github providers and no redirect URL then set a default
|
||||||
|
|
||||||
for id := range config.OverrideProviders {
|
for id := range config.OverrideProviders {
|
||||||
if provider, exists := providers[id]; exists {
|
if provider, exists := providers[id]; exists {
|
||||||
if provider.RedirectURL == "" {
|
if provider.RedirectURL == "" {
|
||||||
@@ -194,6 +193,18 @@ func GetOAuthProvidersConfig(env []string, args []string, appUrl string) (map[st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set names
|
||||||
|
for id, provider := range providers {
|
||||||
|
if provider.Name == "" {
|
||||||
|
if name, ok := config.OverrideProviders[id]; ok {
|
||||||
|
provider.Name = name
|
||||||
|
} else {
|
||||||
|
provider.Name = Capitalize(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
providers[id] = provider
|
||||||
|
}
|
||||||
|
|
||||||
// Return combined providers
|
// Return combined providers
|
||||||
return providers, nil
|
return providers, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,10 +210,12 @@ func TestGetOAuthProvidersConfig(t *testing.T) {
|
|||||||
"client1": {
|
"client1": {
|
||||||
ClientID: "client1-id",
|
ClientID: "client1-id",
|
||||||
ClientSecret: "client1-secret",
|
ClientSecret: "client1-secret",
|
||||||
|
Name: "Client1",
|
||||||
},
|
},
|
||||||
"client2": {
|
"client2": {
|
||||||
ClientID: "client2-id",
|
ClientID: "client2-id",
|
||||||
ClientSecret: "client2-secret",
|
ClientSecret: "client2-secret",
|
||||||
|
Name: "Client2",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +249,7 @@ func TestGetOAuthProvidersConfig(t *testing.T) {
|
|||||||
"client1": {
|
"client1": {
|
||||||
ClientID: "client1-id",
|
ClientID: "client1-id",
|
||||||
ClientSecret: "file content",
|
ClientSecret: "file content",
|
||||||
|
Name: "Client1",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,6 +265,7 @@ func TestGetOAuthProvidersConfig(t *testing.T) {
|
|||||||
ClientID: "google-id",
|
ClientID: "google-id",
|
||||||
ClientSecret: "google-secret",
|
ClientSecret: "google-secret",
|
||||||
RedirectURL: "http://app.url/api/oauth/callback/google",
|
RedirectURL: "http://app.url/api/oauth/callback/google",
|
||||||
|
Name: "Google",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user