mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-25 01:26:08 +00:00
zmodem fixes (fixes #1949)
This commit is contained in:
@@ -15,7 +15,6 @@ const SPACER = ' '
|
|||||||
export class ZModemDecorator extends TerminalDecorator {
|
export class ZModemDecorator extends TerminalDecorator {
|
||||||
private subscriptions: Subscription[] = []
|
private subscriptions: Subscription[] = []
|
||||||
private logger: Logger
|
private logger: Logger
|
||||||
private sentry
|
|
||||||
private activeSession: any = null
|
private activeSession: any = null
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
@@ -28,8 +27,12 @@ export class ZModemDecorator extends TerminalDecorator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
attach (terminal: TerminalTabComponent): void {
|
attach (terminal: TerminalTabComponent): void {
|
||||||
this.sentry = new ZModem.Sentry({
|
const sentry = new ZModem.Sentry({
|
||||||
to_terminal: () => null,
|
to_terminal: data => {
|
||||||
|
if (!terminal.enablePassthrough) {
|
||||||
|
terminal.write(data)
|
||||||
|
}
|
||||||
|
},
|
||||||
sender: data => terminal.session.write(Buffer.from(data)),
|
sender: data => terminal.session.write(Buffer.from(data)),
|
||||||
on_detect: async detection => {
|
on_detect: async detection => {
|
||||||
try {
|
try {
|
||||||
@@ -49,7 +52,7 @@ export class ZModemDecorator extends TerminalDecorator {
|
|||||||
const chunkSize = 1024
|
const chunkSize = 1024
|
||||||
for (let i = 0; i <= Math.floor(data.length / chunkSize); i++) {
|
for (let i = 0; i <= Math.floor(data.length / chunkSize); i++) {
|
||||||
try {
|
try {
|
||||||
this.sentry.consume(data.subarray(i * chunkSize, (i + 1) * chunkSize))
|
sentry.consume(data.subarray(i * chunkSize, (i + 1) * chunkSize))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logger.error('protocol error', e)
|
this.logger.error('protocol error', e)
|
||||||
this.activeSession.abort()
|
this.activeSession.abort()
|
||||||
|
Reference in New Issue
Block a user