mirror of
https://github.com/eugeny/tabby
synced 2026-08-22 22:06:56 +00:00
lint & fixes
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
import LRU from 'lru-cache'
|
||||
import { LRUCache } from 'lru-cache'
|
||||
import * as fs from 'fs'
|
||||
const lru = new LRU({ max: 256, maxAge: 250 })
|
||||
const lru = new LRUCache<string, string>({ ttl: 250, ttlAutopurge: true })
|
||||
const origLstat = fs.realpathSync.bind(fs)
|
||||
|
||||
// NB: The biggest offender of thrashing realpathSync is the node module system
|
||||
|
||||
+2
-2
@@ -16,8 +16,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@electron/remote": "^2",
|
||||
"atomically": "^2.0.2",
|
||||
"any-promise": "^1.3.0",
|
||||
"atomically": "^2.0.2",
|
||||
"dunder-proto": "^1",
|
||||
"electron-config": "2.0.0",
|
||||
"electron-debug": "^3.2.0",
|
||||
@@ -30,7 +30,7 @@
|
||||
"mz": "^2.7.0",
|
||||
"native-process-working-directory": "^1.0.2",
|
||||
"node-pty": "^1.2.0-beta.8",
|
||||
"npm": "6",
|
||||
"npm": "12",
|
||||
"russh": "0.1.37",
|
||||
"rxjs": "^7.5.7",
|
||||
"source-map-support": "^0.5.20",
|
||||
|
||||
+937
-2357
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,6 @@
|
||||
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
||||
"@typescript-eslint/parser": "^6.4.1",
|
||||
"apply-loader": "2.0.0",
|
||||
"axios": "^1.4.0",
|
||||
"babel-loader": "^9.1.2",
|
||||
"browserify-sign": "^4.2.1",
|
||||
"clone-deep": "^4.0.1",
|
||||
@@ -57,7 +56,6 @@
|
||||
"ngx-filesize": "^3.0.2",
|
||||
"node-abi": "^4",
|
||||
"npmlog": "6.0.2",
|
||||
"npx": "^10.2.2",
|
||||
"patch-package": "^6.4.7",
|
||||
"po-gettext-loader": "^1.0.0",
|
||||
"pug": "3",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import axios from 'axios'
|
||||
|
||||
import { Logger, LogService, ConfigService, UpdaterService, PlatformService, TranslateService } from 'tabby-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
@@ -101,8 +100,8 @@ export class ElectronUpdaterService extends UpdaterService {
|
||||
|
||||
} else {
|
||||
this.logger.debug('Checking for updates through fallback method.')
|
||||
const response = await axios.get(UPDATES_URL)
|
||||
const data = response.data
|
||||
const response = await fetch(UPDATES_URL)
|
||||
const data = await response.json()
|
||||
const version = data.tag_name.substring(1)
|
||||
if (this.electron.app.getVersion() !== version) {
|
||||
this.logger.info('Update available')
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as tmp from 'tmp-promise'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
import { Subject, debounceTime, debounce } from 'rxjs'
|
||||
import { Injectable } from '@angular/core'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import axios from 'axios'
|
||||
import { compare as semverCompare } from 'semver'
|
||||
import { Observable, from, forkJoin, map, of } from 'rxjs'
|
||||
import { Injectable, Inject } from '@angular/core'
|
||||
@@ -51,9 +50,9 @@ export class PluginManagerService {
|
||||
|
||||
_listAvailableInternal (namePrefix: string, keyword: string, query?: string): Observable<PluginInfo[]> {
|
||||
return from(
|
||||
axios.get(`https://registry.npmjs.com/-/v1/search?text=keywords%3A${keyword}%20${query}&size=250`),
|
||||
fetch(`https://registry.npmjs.com/-/v1/search?text=keywords%3A${keyword}%20${query}&size=250`).then(r => r.json()),
|
||||
).pipe(
|
||||
map(response => response.data.objects
|
||||
map(response => response.objects
|
||||
.filter(item => !item.keywords?.includes('tabby-dummy-transition-plugin'))
|
||||
.map(item => ({
|
||||
name: item.package.name.substring(namePrefix.length),
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
"author": "Tabby Developers",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/marked": "^5.0.1",
|
||||
"marked": "^9.1.4",
|
||||
"ngx-infinite-scroll": "^16"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'
|
||||
import axios from 'axios'
|
||||
import * as marked from '../../node_modules/marked/src/marked'
|
||||
import { Component, Injector } from '@angular/core'
|
||||
import { BaseTabComponent, TranslateService } from 'tabby-core'
|
||||
@@ -30,10 +29,11 @@ export class ReleaseNotesComponent extends BaseTabComponent {
|
||||
|
||||
async loadReleases (page) {
|
||||
console.log('Loading releases page', page)
|
||||
const response = await axios.get(`https://api.github.com/repos/eugeny/tabby/releases?page=${page}`, {
|
||||
const response = await fetch(`https://api.github.com/repos/eugeny/tabby/releases?page=${page}`, {
|
||||
headers: { Accept: 'application/vnd.github.v3+json' },
|
||||
})
|
||||
this.releases = this.releases.concat(response.data.map(r => ({
|
||||
const releases = await response.json()
|
||||
this.releases = this.releases.concat(releases.map(r => ({
|
||||
name: r.name,
|
||||
version: r.tag_name,
|
||||
content: marked.marked(r.body),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import * as yaml from 'js-yaml'
|
||||
import axios from 'axios'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ConfigService, HostAppService, Logger, LogService, Platform, PlatformService } from 'tabby-core'
|
||||
|
||||
@@ -159,7 +158,7 @@ export class ConfigSyncService {
|
||||
await this.config.save()
|
||||
}
|
||||
|
||||
private async request (method: 'GET'|'POST'|'PATCH'|'DELETE', url: string, params = {}) {
|
||||
private async request (method: 'GET'|'POST'|'PATCH'|'DELETE', url: string, { data }: { data?: any } = {}) {
|
||||
if (this.config.store.configSync.host.endsWith('/')) {
|
||||
this.config.store.configSync.host = this.config.store.configSync.host.slice(0, -1)
|
||||
}
|
||||
@@ -175,18 +174,23 @@ export class ConfigSyncService {
|
||||
throw new Error(message)
|
||||
}
|
||||
url = host + url
|
||||
this.logger.debug(`${method} ${url}`, params)
|
||||
this.logger.debug(`${method} ${url}`, data)
|
||||
try {
|
||||
const response = await axios.request({
|
||||
url,
|
||||
const response = await fetch(url, {
|
||||
method,
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.config.store.configSync.token}`,
|
||||
...data !== undefined ? { 'Content-Type': 'application/json' } : {},
|
||||
},
|
||||
...params,
|
||||
body: data !== undefined ? JSON.stringify(data) : undefined,
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(`${method} ${url} failed: ${response.status} ${response.statusText}`)
|
||||
}
|
||||
this.logger.debug(response)
|
||||
return response.data
|
||||
// ponytail: DELETE returns empty 204, parse only if there's a body
|
||||
const text = await response.text()
|
||||
return text ? JSON.parse(text) : undefined
|
||||
} catch (error) {
|
||||
this.logger.error(error)
|
||||
throw error
|
||||
|
||||
Reference in New Issue
Block a user