From ca4ddade1712f26f8052cde8d216b8acfac22812 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Fri, 29 Jul 2022 01:52:34 +0200 Subject: [PATCH] fix(core): update --- .gitlab-ci.yml | 23 +++++++---------------- .vscode/launch.json | 24 +++--------------------- npmextra.json | 2 +- package.json | 5 +++-- test/test.ts | 2 +- ts/00_commitinfo_data.ts | 2 +- ts/index.ts | 2 +- ts/smartproxy.classes.networkproxy.ts | 11 +++++------ ts/smartproxy.portproxy.ts | 12 ++++++------ 9 files changed, 28 insertions(+), 55 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a4467e..69b3e08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,20 +12,12 @@ stages: - release - metadata +before_script: + - npm install -g @shipzone/npmci + # ==================== # security stage # ==================== -mirror: - stage: security - script: - - npmci git mirror - only: - - tags - tags: - - lossless - - docker - - notpriv - auditProductionDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci stage: security @@ -36,6 +28,7 @@ auditProductionDependencies: - npmci command npm audit --audit-level=high --only=prod --production tags: - docker + allow_failure: true auditDevDependencies: image: registry.gitlab.com/hosttoday/ht-docker-node:npmci @@ -96,10 +89,9 @@ codequality: only: - tags script: - - npmci command npm install -g tslint typescript + - npmci command npm install -g typescript - npmci npm prepare - npmci npm install - - npmci command "tslint -c tslint.json ./ts/**/*.ts" tags: - lossless - docker @@ -119,11 +111,10 @@ trigger: pages: stage: metadata script: - - npmci node install lts - - npmci command npm install -g @gitzone/tsdoc + - npmci node install stable - npmci npm prepare - npmci npm install - - npmci command tsdoc + - npmci command npm run buildDocs tags: - lossless - docker diff --git a/.vscode/launch.json b/.vscode/launch.json index 112db52..26e9f92 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -2,28 +2,10 @@ "version": "0.2.0", "configurations": [ { - "name": "current file", - "type": "node", + "command": "npm test", + "name": "Run npm test", "request": "launch", - "args": [ - "${relativeFile}" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" - }, - { - "name": "test.ts", - "type": "node", - "request": "launch", - "args": [ - "test/test.ts" - ], - "runtimeArgs": ["-r", "@gitzone/tsrun"], - "cwd": "${workspaceRoot}", - "protocol": "inspector", - "internalConsoleOptions": "openOnSessionStart" + "type": "node-terminal" } ] } diff --git a/npmextra.json b/npmextra.json index 89676db..bd6defc 100644 --- a/npmextra.json +++ b/npmextra.json @@ -5,7 +5,7 @@ "githost": "gitlab.com", "gitscope": "pushrocks", "gitrepo": "smartproxy", - "shortDescription": "a proxy for handling high workloads of proxying", + "description": "a proxy for handling high workloads of proxying", "npmPackagename": "@pushrocks/smartproxy", "license": "MIT", "projectDomain": "push.rocks" diff --git a/package.json b/package.json index 7dc8222..df9d944 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "scripts": { "test": "(tstest test/)", "build": "(tsbuild --web --allowimplicitany)", - "format": "(gitzone format)" + "format": "(gitzone format)", + "buildDocs": "tsdoc" }, "devDependencies": { "@gitzone/tsbuild": "^2.1.63", @@ -44,4 +45,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index e3d762a..4cdeaf9 100644 --- a/test/test.ts +++ b/test/test.ts @@ -5,7 +5,7 @@ let testProxy: smartproxy.NetworkProxy; tap.test('first test', async () => { testProxy = new smartproxy.NetworkProxy({ - port: 3001 + port: 3001, }); expect(testProxy).toBeInstanceOf(smartproxy.NetworkProxy); }); diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index e283046..8ac450f 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartproxy', - version: '3.0.4', + version: '3.0.5', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/index.ts b/ts/index.ts index 0f68d5a..1407a9f 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,2 +1,2 @@ -export * from './smartproxy.classes.networkproxy.js' +export * from './smartproxy.classes.networkproxy.js'; export * from './smartproxy.portproxy.js'; diff --git a/ts/smartproxy.classes.networkproxy.ts b/ts/smartproxy.classes.networkproxy.ts index 69abb68..1262222 100644 --- a/ts/smartproxy.classes.networkproxy.ts +++ b/ts/smartproxy.classes.networkproxy.ts @@ -6,7 +6,6 @@ export interface INetworkProxyOptions { } export class NetworkProxy { - // INSTANCE public options: INetworkProxyOptions; public proxyConfigs: plugins.tsclass.network.IReverseProxyConfig[] = []; @@ -248,7 +247,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= }); }); this.httpsServer.keepAliveTimeout = 61000; - this.httpsServer.headersTimeout = 65000; + this.httpsServer.headersTimeout = 65000; this.httpsServer.on('connection', (connection: plugins.net.Socket) => { connection.setTimeout(120000); @@ -276,7 +275,9 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= }); this.httpsServer.listen(this.options.port); - console.log(`ProxyWorker -> OK: now listening for new connections on port ${this.options.port}`); + console.log( + `ProxyWorker -> OK: now listening for new connections on port ${this.options.port}` + ); } public async updateProxyConfigs(proxyConfigsArg: plugins.tsclass.network.IReverseProxyConfig[]) { @@ -310,9 +311,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= this.httpsServer.listen(this.port); */ } - public async addDefaultHeaders(headersArg: { - [key: string]: string; - }) { + public async addDefaultHeaders(headersArg: { [key: string]: string }) { for (const headerKey of Object.keys(headersArg)) { this.defaultHeaders[headerKey] = headersArg[headerKey]; } diff --git a/ts/smartproxy.portproxy.ts b/ts/smartproxy.portproxy.ts index 16fc7f2..8f2dec4 100644 --- a/ts/smartproxy.portproxy.ts +++ b/ts/smartproxy.portproxy.ts @@ -9,10 +9,10 @@ export class PortProxy { constructor(fromPortArg: number, toPortArg: number) { this.fromPort = fromPortArg; - this.toPort = toPortArg + this.toPort = toPortArg; } - public async start () { + public async start() { httpServer = plugins.http.createServer((request, response) => { const requestUrl = new URL(request.url, `http://${request.headers.host}`); const completeUrlWithoutProtocol = `${requestUrl.host}${requestUrl.pathname}${requestUrl.search}`; @@ -34,7 +34,7 @@ export class PortProxy { to.unpipe(); from.destroy(); to.destroy(); - } + }; netServer = net .createServer((from) => { const to = net.createConnection({ @@ -64,10 +64,10 @@ export class PortProxy { }); from.on('end', () => { cleanUpSockets(from, to); - }) + }); to.on('end', () => { cleanUpSockets(from, to); - }) + }); }) .listen(this.fromPort); console.log(`PortProxy -> OK: Now listening on port ${this.fromPort}`); @@ -82,4 +82,4 @@ export class PortProxy { }); await done.promise; } -}; +}