mirror of
https://github.com/Eugeny/tabby-web.git
synced 2025-06-08 13:39:56 +00:00
.
This commit is contained in:
parent
dbf1ec5f3c
commit
b3bb9fdd40
@ -162,6 +162,7 @@ class LogoutView(APIView):
|
|||||||
|
|
||||||
class InstanceInfoSerializer(Serializer):
|
class InstanceInfoSerializer(Serializer):
|
||||||
login_enabled = fields.BooleanField()
|
login_enabled = fields.BooleanField()
|
||||||
|
homepage_enabled = fields.BooleanField()
|
||||||
|
|
||||||
|
|
||||||
class InstanceInfoViewSet(RetrieveModelMixin, GenericViewSet):
|
class InstanceInfoViewSet(RetrieveModelMixin, GenericViewSet):
|
||||||
@ -171,6 +172,7 @@ class InstanceInfoViewSet(RetrieveModelMixin, GenericViewSet):
|
|||||||
def get_object(self):
|
def get_object(self):
|
||||||
return {
|
return {
|
||||||
'login_enabled': settings.ENABLE_LOGIN,
|
'login_enabled': settings.ENABLE_LOGIN,
|
||||||
|
'homepage_enabled': settings.ENABLE_HOMEPAGE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,6 +194,7 @@ for key in [
|
|||||||
'ENABLE_LOGIN',
|
'ENABLE_LOGIN',
|
||||||
'GA_ID',
|
'GA_ID',
|
||||||
'GA_DOMAIN',
|
'GA_DOMAIN',
|
||||||
|
'ENABLE_HOMEPAGE',
|
||||||
]:
|
]:
|
||||||
globals()[key] = os.getenv(key)
|
globals()[key] = os.getenv(key)
|
||||||
|
|
||||||
@ -206,6 +207,7 @@ for key in [
|
|||||||
|
|
||||||
for key in [
|
for key in [
|
||||||
'ENABLE_LOGIN',
|
'ENABLE_LOGIN',
|
||||||
|
'ENABLE_HOMEPAGE',
|
||||||
]:
|
]:
|
||||||
globals()[key] = bool(globals()[key]) if globals()[key] else None
|
globals()[key] = bool(globals()[key]) if globals()[key] else None
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ export interface Version {
|
|||||||
|
|
||||||
export interface InstanceInfo {
|
export interface InstanceInfo {
|
||||||
login_enabled: boolean
|
login_enabled: boolean
|
||||||
|
homepage_enabled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Gateway {
|
export interface Gateway {
|
||||||
|
@ -112,6 +112,6 @@ strong {
|
|||||||
img {
|
img {
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'
|
|||||||
import { InstanceInfo, Version } from '../api'
|
import { InstanceInfo, Version } from '../api'
|
||||||
import { faCoffee, faDownload, faSignInAlt } from '@fortawesome/free-solid-svg-icons'
|
import { faCoffee, faDownload, faSignInAlt } from '@fortawesome/free-solid-svg-icons'
|
||||||
import { faGithub } from '@fortawesome/free-brands-svg-icons'
|
import { faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||||
import { ActivatedRoute } from '@angular/router'
|
import { ActivatedRoute, Router } from '@angular/router'
|
||||||
import { CommonService } from '../services/common.service'
|
import { CommonService } from '../services/common.service'
|
||||||
|
|
||||||
|
|
||||||
@ -101,9 +101,13 @@ export class HomeComponent {
|
|||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
private commonService: CommonService,
|
private commonService: CommonService,
|
||||||
route: ActivatedRoute,
|
route: ActivatedRoute,
|
||||||
|
router: Router,
|
||||||
) {
|
) {
|
||||||
window.addEventListener('message', this.connectorRequestHandler)
|
window.addEventListener('message', this.connectorRequestHandler)
|
||||||
this.instanceInfo = route.snapshot.data.instanceInfo
|
this.instanceInfo = route.snapshot.data.instanceInfo
|
||||||
|
if (!this.instanceInfo.homepage_enabled) {
|
||||||
|
router.navigate(['/app'])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||||
|
Loading…
x
Reference in New Issue
Block a user