mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-17 14:56:03 +01:00
.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Resolve } from '@angular/router'
|
||||
import { Observable } from 'rxjs'
|
||||
|
||||
export interface User {
|
||||
id: number
|
||||
@@ -41,10 +40,10 @@ export interface Gateway {
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class InstanceInfoResolver implements Resolve<Observable<InstanceInfo>> {
|
||||
export class InstanceInfoResolver implements Resolve<Promise<InstanceInfo>> {
|
||||
constructor (private http: HttpClient) { }
|
||||
|
||||
resolve (): Observable<InstanceInfo> {
|
||||
return this.http.get('/api/1/instance-info').toPromise()
|
||||
resolve (): Promise<InstanceInfo> {
|
||||
return this.http.get('/api/1/instance-info').toPromise() as Promise<InstanceInfo>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ export class MainComponent {
|
||||
|
||||
reloadApp (config: Config, version: Version) {
|
||||
// TODO check config incompatibility
|
||||
this.unloadApp()
|
||||
setTimeout(() => {
|
||||
this.appConnector.setState(config, version)
|
||||
this.loadApp(config, version)
|
||||
|
||||
@@ -222,7 +222,7 @@ export class AppConnectorService {
|
||||
|
||||
async chooseConnectionGateway (): Promise<Gateway> {
|
||||
try {
|
||||
return this.http.post('/api/1/gateways/choose', {}).toPromise()
|
||||
return await this.http.post('/api/1/gateways/choose', {}).toPromise() as Gateway
|
||||
} catch (err){
|
||||
if (err.status === 503) {
|
||||
throw new Error('All connections gateway are unavailable right now')
|
||||
|
||||
@@ -52,7 +52,7 @@ export class ConfigService {
|
||||
this.configs.push(config)
|
||||
return config
|
||||
}
|
||||
const config = await this.http.post('/api/1/configs', configData).toPromise()
|
||||
const config = (await this.http.post('/api/1/configs', configData).toPromise()) as Config
|
||||
this.configs.push(config)
|
||||
return config
|
||||
}
|
||||
@@ -62,11 +62,11 @@ export class ConfigService {
|
||||
}
|
||||
|
||||
async duplicateActiveConfig (): Promise<void> {
|
||||
let copy = { ...this._activeConfig, pk: undefined, id: undefined }
|
||||
let copy: any = { ...this._activeConfig, id: undefined }
|
||||
if (this.loginService.user) {
|
||||
copy = await this.http.post('/api/1/configs', copy).toPromise()
|
||||
copy = (await this.http.post('/api/1/configs', copy).toPromise()) as Config
|
||||
}
|
||||
this.configs.push(copy as any)
|
||||
this.configs.push(copy)
|
||||
}
|
||||
|
||||
async selectVersion (version: Version): Promise<void> {
|
||||
@@ -105,9 +105,9 @@ export class ConfigService {
|
||||
|
||||
private async init () {
|
||||
if (this.loginService.user) {
|
||||
this.configs = await this.http.get('/api/1/configs').toPromise()
|
||||
this.configs = (await this.http.get('/api/1/configs').toPromise()) as Config[]
|
||||
}
|
||||
this.versions = await this.http.get('/api/1/versions').toPromise()
|
||||
this.versions = (await this.http.get('/api/1/versions').toPromise()) as Version[]
|
||||
this.versions.sort((a, b) => -semverCompare(a.version, b.version))
|
||||
|
||||
if (!this.configs.length) {
|
||||
|
||||
@@ -22,7 +22,7 @@ export class LoginService {
|
||||
|
||||
private async init () {
|
||||
try {
|
||||
this.user = await this.http.get('/api/1/user').toPromise()
|
||||
this.user = (await this.http.get('/api/1/user').toPromise()) as User
|
||||
} catch {
|
||||
this.user = null
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class DemoConnector {
|
||||
export class DemoSocketProxy {
|
||||
connect$ = new Subject<void>()
|
||||
data$ = new Subject<Buffer>()
|
||||
error$ = new Subject<Buffer>()
|
||||
error$ = new Subject<Error>()
|
||||
close$ = new Subject<Buffer>()
|
||||
|
||||
async connect () {
|
||||
@@ -90,9 +90,9 @@ export class DemoTerminalComponent {
|
||||
}
|
||||
|
||||
async ngAfterViewInit (): Promise<void> {
|
||||
const versions = await this.http.get('/api/1/versions').toPromise()
|
||||
const versions = (await this.http.get('/api/1/versions').toPromise()) as Version[]
|
||||
versions.sort((a, b) => -semverCompare(a.version, b.version))
|
||||
this.connector = new DemoConnector(this.iframe.nativeElement.contentWindow, this.commonService, versions[0])
|
||||
this.connector = new DemoConnector(this.iframe.nativeElement.contentWindow, this.commonService, versions[0]!)
|
||||
this.iframe.nativeElement.src = '/terminal'
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ export class HomeComponent {
|
||||
},
|
||||
{
|
||||
title: 'Features',
|
||||
link: '/features',
|
||||
link: '/about/features',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ const ROUTES = [
|
||||
component: HomeIndexComponent,
|
||||
},
|
||||
{
|
||||
path: 'features',
|
||||
path: 'about/features',
|
||||
component: HomeFeaturesComponent,
|
||||
},
|
||||
],
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
<meta property="twitter:description" content="Tabby is a free and open source SSH, local and Telnet terminal with everything you'll ever need.">
|
||||
<meta property="twitter:image" content="https://user-images.githubusercontent.com/161476/126016449-a053012a-e322-48ed-a2ab-3ed4f3281465.png">
|
||||
|
||||
<meta property="theme-color" content="#0c131b">
|
||||
|
||||
<meta property="x-tabby-web-backend-url" content="{{backendURL}}">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -42,7 +42,7 @@ function start () {
|
||||
maxAge: '1y',
|
||||
}))
|
||||
|
||||
app.get(['/', '/app', '/login', '/features'], (req, res) => {
|
||||
app.get(['/', '/app', '/login', '/about', '/about/:_'], (req, res) => {
|
||||
res.render(
|
||||
'index',
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user