mirror of
https://github.com/hyperspacedev/hyperspace
synced 2025-02-10 16:50:38 +01:00
Use federation.universalLogin in Welcome
This commit is contained in:
parent
4987040a39
commit
ced1dfc3b5
@ -1,22 +0,0 @@
|
|||||||
import {License} from '../types/Config';
|
|
||||||
|
|
||||||
export interface Config {
|
|
||||||
version: string;
|
|
||||||
location: string;
|
|
||||||
branding?: {
|
|
||||||
name?: string;
|
|
||||||
logo?: string;
|
|
||||||
background?: string;
|
|
||||||
};
|
|
||||||
developer?: string;
|
|
||||||
federated?: string;
|
|
||||||
registration?: {
|
|
||||||
defaultInstance?: string;
|
|
||||||
};
|
|
||||||
admin?: {
|
|
||||||
name?: string;
|
|
||||||
account?: string;
|
|
||||||
};
|
|
||||||
license: License;
|
|
||||||
respository?: string;
|
|
||||||
}
|
|
@ -8,6 +8,7 @@ import {parseUrl} from 'query-string';
|
|||||||
import { getConfig } from '../utilities/settings';
|
import { getConfig } from '../utilities/settings';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import {withSnackbar, withSnackbarProps} from 'notistack';
|
import {withSnackbar, withSnackbarProps} from 'notistack';
|
||||||
|
import { Config } from '../types/Config';
|
||||||
|
|
||||||
interface IWelcomeProps extends withSnackbarProps {
|
interface IWelcomeProps extends withSnackbarProps {
|
||||||
classes: any;
|
classes: any;
|
||||||
@ -59,20 +60,23 @@ class WelcomePage extends Component<IWelcomeProps, IWelcomeState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConfig().then((result: any) => {
|
getConfig().then((result: any) => {
|
||||||
if (result.location === "dynamic") {
|
if (result !== undefined) {
|
||||||
console.warn("Recirect URI is set to dyanmic, which may affect how sign-in works for some users. Careful!");
|
let config: Config = result;
|
||||||
|
if (config.location === "dynamic") {
|
||||||
|
console.warn("Recirect URI is set to dyanmic, which may affect how sign-in works for some users. Careful!");
|
||||||
|
}
|
||||||
|
this.setState({
|
||||||
|
logoUrl: config.branding? result.branding.logo: "logo.png",
|
||||||
|
backgroundUrl: config.branding? result.branding.background: "background.png",
|
||||||
|
brandName: config.branding? result.branding.name: "Hyperspace",
|
||||||
|
registerBase: config.registration? result.registration.defaultInstance: "",
|
||||||
|
federates: config.federation.universalLogin,
|
||||||
|
license: config.license.url,
|
||||||
|
repo: config.repository,
|
||||||
|
defaultRedirectAddress: config.location != "dynamic"? config.location: `https://${window.location.host}`,
|
||||||
|
version: config.version
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.setState({
|
|
||||||
logoUrl: result.branding? result.branding.logo: "logo.png",
|
|
||||||
backgroundUrl: result.branding? result.branding.background: "background.png",
|
|
||||||
brandName: result.branding? result.branding.name: "Hyperspace",
|
|
||||||
registerBase: result.registration? result.registration.defaultInstance: "",
|
|
||||||
federates: result.federated? result.federated === "true": true,
|
|
||||||
license: result.license.url,
|
|
||||||
repo: result.repository,
|
|
||||||
defaultRedirectAddress: result.location != "dynamic"? result.location: `https://${window.location.host}`,
|
|
||||||
version: result.version
|
|
||||||
});
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
console.error('config.json is missing. If you want to customize Hyperspace, please include config.json');
|
console.error('config.json is missing. If you want to customize Hyperspace, please include config.json');
|
||||||
})
|
})
|
||||||
|
@ -16,7 +16,7 @@ export type Config = {
|
|||||||
account?: string;
|
account?: string;
|
||||||
};
|
};
|
||||||
license: License;
|
license: License;
|
||||||
respository?: string;
|
repository?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type License = {
|
export type License = {
|
||||||
|
@ -116,7 +116,7 @@ export function createUserDefaults() {
|
|||||||
* Gets the configuration data from `config.json`
|
* Gets the configuration data from `config.json`
|
||||||
* @returns The Promise data from getting the config.
|
* @returns The Promise data from getting the config.
|
||||||
*/
|
*/
|
||||||
export async function getConfig() {
|
export async function getConfig(): Promise<Config | undefined> {
|
||||||
try {
|
try {
|
||||||
const resp = await axios.get('config.json');
|
const resp = await axios.get('config.json');
|
||||||
let config: Config = resp.data;
|
let config: Config = resp.data;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user