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):
|
||||
login_enabled = fields.BooleanField()
|
||||
homepage_enabled = fields.BooleanField()
|
||||
|
||||
|
||||
class InstanceInfoViewSet(RetrieveModelMixin, GenericViewSet):
|
||||
@ -171,6 +172,7 @@ class InstanceInfoViewSet(RetrieveModelMixin, GenericViewSet):
|
||||
def get_object(self):
|
||||
return {
|
||||
'login_enabled': settings.ENABLE_LOGIN,
|
||||
'homepage_enabled': settings.ENABLE_HOMEPAGE,
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,6 +194,7 @@ for key in [
|
||||
'ENABLE_LOGIN',
|
||||
'GA_ID',
|
||||
'GA_DOMAIN',
|
||||
'ENABLE_HOMEPAGE',
|
||||
]:
|
||||
globals()[key] = os.getenv(key)
|
||||
|
||||
@ -206,6 +207,7 @@ for key in [
|
||||
|
||||
for key in [
|
||||
'ENABLE_LOGIN',
|
||||
'ENABLE_HOMEPAGE',
|
||||
]:
|
||||
globals()[key] = bool(globals()[key]) if globals()[key] else None
|
||||
|
||||
|
@ -28,6 +28,7 @@ export interface Version {
|
||||
|
||||
export interface InstanceInfo {
|
||||
login_enabled: boolean
|
||||
homepage_enabled: boolean
|
||||
}
|
||||
|
||||
export interface Gateway {
|
||||
|
@ -113,5 +113,5 @@ strong {
|
||||
min-width: 100px;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'
|
||||
import { InstanceInfo, Version } from '../api'
|
||||
import { faCoffee, faDownload, faSignInAlt } from '@fortawesome/free-solid-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'
|
||||
|
||||
|
||||
@ -101,9 +101,13 @@ export class HomeComponent {
|
||||
private http: HttpClient,
|
||||
private commonService: CommonService,
|
||||
route: ActivatedRoute,
|
||||
router: Router,
|
||||
) {
|
||||
window.addEventListener('message', this.connectorRequestHandler)
|
||||
this.instanceInfo = route.snapshot.data.instanceInfo
|
||||
if (!this.instanceInfo.homepage_enabled) {
|
||||
router.navigate(['/app'])
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
|
Loading…
x
Reference in New Issue
Block a user