-
Notifications
You must be signed in to change notification settings - Fork 36
[kernel 797] add disconnected screen #121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
14492de
4f3a07e
a7ec52c
2e8ef52
429d5df
9227a23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,15 +1,6 @@ | ||||||
| <template> | ||||||
| <div class="connect"> | ||||||
| <div class="window"> | ||||||
| <form class="message" v-if="!connecting" @submit.stop.prevent="connect"> | ||||||
| <span v-if="!autoPassword">{{ $t('connect.login_title') }}</span> | ||||||
| <span v-else>{{ $t('connect.invitation_title') }}</span> | ||||||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| <input type="text" :placeholder="$t('connect.displayname')" v-model="displayname" /> | ||||||
| <input type="password" :placeholder="$t('connect.password')" v-model="password" v-if="!autoPassword" /> | ||||||
| <button type="submit" @click.stop.prevent="login"> | ||||||
| {{ $t('connect.connect') }} | ||||||
| </button> | ||||||
| </form> | ||||||
| <div class="loader" v-if="connecting"> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the login form is gone,
Suggested change
|
||||||
| <img src="../assets/images/logo.svg" alt="loading" aria-hidden="true" class="kernel-logo" /> | ||||||
| </div> | ||||||
|
|
@@ -54,46 +45,6 @@ | |||||
| } | ||||||
| } | ||||||
| .message { | ||||||
| display: flex; | ||||||
| flex-direction: column; | ||||||
| span { | ||||||
| display: block; | ||||||
| text-align: center; | ||||||
| text-transform: uppercase; | ||||||
| line-height: 30px; | ||||||
| } | ||||||
| input { | ||||||
| border: none; | ||||||
| padding: 6px 8px; | ||||||
| line-height: 20px; | ||||||
| border-radius: 5px; | ||||||
| margin: 5px 0; | ||||||
| background: $background-tertiary; | ||||||
| color: $text-normal; | ||||||
| &::selection { | ||||||
| background: $text-link; | ||||||
| } | ||||||
| } | ||||||
| button { | ||||||
| cursor: pointer; | ||||||
| border-radius: 5px; | ||||||
| padding: 4px; | ||||||
| background: $style-primary; | ||||||
| color: $text-normal; | ||||||
| text-align: center; | ||||||
| text-transform: uppercase; | ||||||
| font-weight: bold; | ||||||
| line-height: 30px; | ||||||
| margin: 5px 0; | ||||||
| border: none; | ||||||
| } | ||||||
| } | ||||||
| .loader { | ||||||
| width: 90px; | ||||||
| height: 90px; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <template> | ||
| <div class="disconnected-overlay"> | ||
| <div class="message-container"> | ||
| <span class="message">{{ $t('disconnected.message') }}</span> | ||
| </div> | ||
| </div> | ||
| </template> | ||
|
|
||
| <style lang="scss" scoped> | ||
| .disconnected-overlay { | ||
| width: 100vw; | ||
| height: 100vh; | ||
| background: #000; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disconnected overlay missing position fixed for proper layeringHigh Severity The |
||
| .message-container { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| padding: 20px; | ||
| .message { | ||
| font-size: 18px; | ||
| color: $text-muted; | ||
| text-align: center; | ||
| } | ||
| } | ||
| } | ||
| </style> | ||
|
|
||
| <script lang="ts"> | ||
| import { Component, Vue } from 'vue-property-decorator' | ||
| @Component({ name: 'neko-disconnected' }) | ||
| export default class extends Vue {} | ||
| </script> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,3 +125,7 @@ export const files = { | |
| uploads: 'Uploads', | ||
| upload_here: 'Click or drag files here to upload', | ||
| } | ||
|
|
||
| export const disconnected = { | ||
| message: 'Browser has been shut down and is no longer available', | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing translation for disconnected message in non-English localesMedium Severity The new |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -69,8 +69,11 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> { | |||||||||||||||||||
| ) | ||||||||||||||||||||
| this.emit('debug', `connecting to ${this._ws.url}`) | ||||||||||||||||||||
| this._ws.onmessage = this.onMessage.bind(this) | ||||||||||||||||||||
| this._ws.onerror = () => this.onError.bind(this) | ||||||||||||||||||||
| this._ws.onclose = () => this.onDisconnected.bind(this, new Error('websocket closed')) | ||||||||||||||||||||
| this._ws.onerror = this.onError.bind(this) | ||||||||||||||||||||
| this._ws.onclose = (event) => { | ||||||||||||||||||||
| this.emit('debug', `websocket closed: code=${event.code}, reason=${event.reason}`) | ||||||||||||||||||||
| this.onDisconnected(new Error('websocket closed')) | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+73
to
+76
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice fix on the event handler binding. Right now we log
Suggested change
|
||||||||||||||||||||
| this._timeout = window.setTimeout(this.onTimeout.bind(this), 15000) | ||||||||||||||||||||
| } catch (err: any) { | ||||||||||||||||||||
| this.onDisconnected(err) | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One edge case with
wasConnected: if there’s an explicit logout flow (or any future “start a new session” flow), this flag never resets so you can get stuck on the disconnected overlay forever. Might be worth either (a) renaming it to something likehasEverConnectedto make the semantics explicit, and/or (b) resetting it when initiating a new login attempt (or when the store indicates a new session).