This commit is contained in:
Eugene Pankov
2021-07-16 20:25:00 +02:00
parent 6d4ae3b4c3
commit 2c95a15609
18 changed files with 379 additions and 137 deletions

BIN
src/assets/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -1,3 +1,6 @@
.modal-header
h5.modal-title Config file
.modal-body
.header(*ngIf='configService.activeConfig')
.d-flex.align-items-center.py-2.px-4

View File

@@ -6,23 +6,6 @@ import { faCoffee, faDownload, faSignInAlt } from '@fortawesome/free-solid-svg-i
import { faGithub } from '@fortawesome/free-brands-svg-icons'
import { ActivatedRoute } from '@angular/router'
// TODO
import Analytics from 'analytics'
import googleAnalytics from '@analytics/google-analytics'
const analytics = Analytics({
app: 'tabby-web',
plugins: [
googleAnalytics({
trackingId: 'UA-3278102-18'
})
]
})
/* Track a page view */
analytics.page()
class DemoConnector {
constructor (targetWindow: Window, private version: Version) {

13
src/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta name="viewport" content="initial-scale=1, minimal-ui, shrink-to-fit=no">
<link rel="icon" type="image/png">
<link rel="shortcut icon" type="image/png" href="./assets/favicon.png">
<title>Tabby</title>
</head>
<body>
<app></app>
</body>
</html>

View File

@@ -1,9 +0,0 @@
doctype html
html
head
base(href='/')
meta(name='viewport', content='initial-scale=1, minimal-ui, shrink-to-fit=no')
script(src='/static/index.js', defer)
title Tabby
body
app

View File

@@ -14,7 +14,7 @@ export class SocketProxy {
url: string
authToken: string
webSocket: WebSocket
webSocket: WebSocket|null
initialBuffer: Buffer
options: {
host: string
@@ -35,18 +35,18 @@ export class SocketProxy {
this.url = gateway.url
this.authToken = gateway.auth_token
} catch (err) {
this.error$.next(err)
this.close(err)
return
}
}
try {
this.webSocket = new WebSocket(this.url)
} catch (err) {
this.error$.next(err)
this.close(err)
return
}
this.webSocket.onerror = err => {
this.error$.next(new Error(`Failed to connect to the connection gateway at ${this.url}`))
this.close(new Error(`Failed to connect to the connection gateway at ${this.url}`))
return
}
this.webSocket.onmessage = async event => {
@@ -100,7 +100,7 @@ export class SocketProxy {
}
close (error?: Error): void {
this.webSocket.close()
this.webSocket?.close()
if (error) {
this.error$.next(error)
}
@@ -177,6 +177,13 @@ export class AppConnectorService {
}
async chooseConnectionGateway (): Promise<Gateway> {
return await this.http.post('/api/1/gateways/choose', {}).toPromise()
try {
return await this.http.post('/api/1/gateways/choose', {}).toPromise()
} catch (err){
if (err.status === 503) {
throw new Error('All connections gateway are unavailable right now')
}
throw err
}
}
}

21
src/terminal.html Normal file
View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html class="tabby">
<head>
<meta charset="UTF-8">
<style id="custom-css"></style>
<style>body { transition: 0.5s background; }</style>
</head>
<body>
<app-root style="display: none">
<div class="preload-logo">
<div>
<div class="tabby-logo"></div>
<h1 class="tabby-title">Tabby<sup>α</sup></h1>
<div class="progress">
<div class="bar" style="width: 0%"></div>
</div>
</div>
</div>
</app-root>
</body>
</html>

View File

@@ -1,17 +0,0 @@
doctype html
html.tabby
head
meta(charset='UTF-8')
script(src='/static/terminal.js')
style#custom-css
style.
body { transition: 0.5s background; }
body
app-root(style='display: none')
.preload-logo
div
.tabby-logo
h1.tabby-title Tabby
sup α
.progress
.bar(style='width: 0%')