Add location param to config (redirect URI) (#8)
This commit is contained in:
parent
025f92f09d
commit
a92693bb84
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"version": "1.0.0beta1u1",
|
||||
"version": "1.0.0beta2",
|
||||
"location": "https://localhost:3000",
|
||||
"branding": {
|
||||
"name": "Hyperspace",
|
||||
"logo": "logo.svg",
|
||||
|
|
|
@ -25,6 +25,7 @@ interface IWelcomeState {
|
|||
authority: boolean;
|
||||
license?: string;
|
||||
repo?: string;
|
||||
defaultRedirectAddress: string;
|
||||
}
|
||||
|
||||
class WelcomePage extends Component<any, IWelcomeState> {
|
||||
|
@ -40,10 +41,14 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
|||
userInputError: false,
|
||||
foundSavedLogin: false,
|
||||
authority: false,
|
||||
userInputErrorMessage: ''
|
||||
userInputErrorMessage: '',
|
||||
defaultRedirectAddress: ''
|
||||
}
|
||||
|
||||
getConfig().then((result: any) => {
|
||||
if (result.location === "dynamic") {
|
||||
console.warn("Recirect URI is set to dyanmic, which may affect how sign-in works for some users. Careful!");
|
||||
}
|
||||
this.setState({
|
||||
logoUrl: result.branding? result.branding.logo: "logo.png",
|
||||
backgroundUrl: result.branding? result.branding.background: "background.png",
|
||||
|
@ -51,10 +56,11 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
|||
registerBase: result.registration? result.registration.defaultInstance: "",
|
||||
federates: result.federated? result.federated === "true": true,
|
||||
license: result.license.url,
|
||||
repo: result.repository
|
||||
repo: result.repository,
|
||||
defaultRedirectAddress: result.location != "dynamic"? result.location: `https://${window.location.host}`
|
||||
});
|
||||
}).catch(() => {
|
||||
console.warn('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');
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -124,7 +130,7 @@ class WelcomePage extends Component<any, IWelcomeState> {
|
|||
const scopes = 'read write follow';
|
||||
const baseurl = this.getLoginUser(this.state.user);
|
||||
localStorage.setItem("baseurl", baseurl);
|
||||
createHyperspaceApp(scopes, baseurl, `https://${window.location.host}`).then((resp: any) => {
|
||||
createHyperspaceApp(scopes, baseurl, this.state.defaultRedirectAddress).then((resp: any) => {
|
||||
let saveSessionForCrashing: SaveClientSession = {
|
||||
clientId: resp.clientId,
|
||||
clientSecret: resp.clientSecret,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export type Config = {
|
||||
version: string;
|
||||
location: string;
|
||||
branding?: {
|
||||
name?: string;
|
||||
logo?: string;
|
||||
|
|
Loading…
Reference in New Issue