Browse Source

fix linter warnings

pull/225/head
butlerx 5 years ago
parent
commit
4f4d75f0e7
No known key found for this signature in database GPG Key ID: B37CA765BAA89170
  1. 5
      .eslintrc.js
  2. 2
      .github/workflows/publish.yml
  3. 2
      package.json
  4. 15
      src/client/download.ts
  5. 8
      src/client/index.ts

5
.eslintrc.js

@ -21,6 +21,11 @@ module.exports = {
'no-use-before-define': ['error', { functions: false }], 'no-use-before-define': ['error', { functions: false }],
'@typescript-eslint/no-use-before-define': ['error', { functions: false }], '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
'import/prefer-default-export': 'off', 'import/prefer-default-export': 'off',
'lines-between-class-members': [
'error',
'always',
{ exceptAfterSingleLine: true },
],
'import/extensions': [ 'import/extensions': [
'error', 'error',
'always', 'always',

2
.github/workflows/publish.yml

@ -21,6 +21,8 @@ jobs:
run: yarn lint run: yarn lint
- run: yarn build - run: yarn build
name: Compile Typescript name: Compile Typescript
- run: yarn test
name: Run tests
- name: Publish - name: Publish
uses: mikeal/merge-release@master uses: mikeal/merge-release@master
env: env:

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "wetty", "name": "wetty",
"version": "1.2.2", "version": "1.2.3",
"description": "WeTTY = Web + TTY. Terminal access in browser over http/https", "description": "WeTTY = Web + TTY. Terminal access in browser over http/https",
"homepage": "https://github.com/butlerx/wetty", "homepage": "https://github.com/butlerx/wetty",
"repository": { "repository": {

15
src/client/download.ts

@ -2,8 +2,14 @@ const DEFAULT_FILE_BEGIN = '\u001b[5i';
const DEFAULT_FILE_END = '\u001b[4i'; const DEFAULT_FILE_END = '\u001b[4i';
export class FileDownloader { export class FileDownloader {
fileBuffer: string[];
fileBegin: string;
fileEnd: string;
partialFileBegin: string;
onCompleteFileCallback: Function;
constructor( constructor(
onCompleteFileCallback: (file: string) => any, onCompleteFileCallback: (file: string) => void,
fileBegin: string = DEFAULT_FILE_BEGIN, fileBegin: string = DEFAULT_FILE_BEGIN,
fileEnd: string = DEFAULT_FILE_END fileEnd: string = DEFAULT_FILE_END
) { ) {
@ -87,10 +93,13 @@ export class FileDownloader {
) { ) {
return data; return data;
} }
return data.split('').map(this.bufferCharacter.bind(this)).join('') return data
.split('')
.map(this.bufferCharacter.bind(this))
.join('');
} }
onCompleteFile(bufferCharacters: string) { onCompleteFile(bufferCharacters: string): void {
this.onCompleteFileCallback(bufferCharacters); this.onCompleteFileCallback(bufferCharacters);
} }
} }

8
src/client/index.ts

@ -1,8 +1,8 @@
import { Terminal } from 'xterm'; import { Terminal } from 'xterm';
import { isNull } from 'lodash'; import { isNull } from 'lodash';
import { dom, library } from "@fortawesome/fontawesome-svg-core"; import { dom, library } from '@fortawesome/fontawesome-svg-core';
import { faCogs } from "@fortawesome/free-solid-svg-icons/faCogs"; import { faCogs } from '@fortawesome/free-solid-svg-icons/faCogs';
import Toastify from 'toastify-js'; import Toastify from 'toastify-js';
import * as fileType from 'file-type'; import * as fileType from 'file-type';
import { socket } from './socket'; import { socket } from './socket';
@ -78,9 +78,7 @@ socket.on('connect', () => {
term.focus(); term.focus();
mobileKeyboard(); mobileKeyboard();
const fileDownloader = new FileDownloader(function ( const fileDownloader = new FileDownloader((bufferCharacters: string) => {
bufferCharacters: string
) {
let fileCharacters = bufferCharacters; let fileCharacters = bufferCharacters;
// Try to decode it as base64, if it fails we assume it's not base64 // Try to decode it as base64, if it fails we assume it's not base64
try { try {

Loading…
Cancel
Save