diff --git a/app.js b/app.js index c12d97a9..9b349912 100644 --- a/app.js +++ b/app.js @@ -15,7 +15,8 @@ var session = require('express-session'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var querystring = require('querystring'); -// var PSUtil = require('psutil').PSUtil; //已舍弃 +//gzip压缩 +var compression = require('compression'); const serverModel = require('./model/ServerModel'); const UserModel = require('./model/UserModel'); @@ -124,6 +125,9 @@ app.use(session({ saveUninitialized: true, })); +//使用 gzip 静态文本压缩,但是如果你使用反向代理或某 HTTP 服务自带的gzip,请关闭它 +//app.use(compression()); + //初始化令牌管理器 已弃用 向下兼容 VarCenter.set('user_token', {}); VarCenter.set('express_app', app); @@ -238,4 +242,4 @@ app.use('/fs', require('./onlinefs/controller/function')); }); -})(); +})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1c55013e..9d2fe9ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,11 +6,7 @@ "accepts": { "version": "1.3.4", "resolved": "http://registry.npm.taobao.org/accepts/download/accepts-1.3.4.tgz", - "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", - "requires": { - "mime-types": "2.1.17", - "negotiator": "0.6.1" - } + "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=" }, "array-flatten": { "version": "1.1.1", @@ -20,19 +16,7 @@ "body-parser": { "version": "1.18.2", "resolved": "http://registry.npm.taobao.org/body-parser/download/body-parser-1.18.2.tgz", - "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "1.0.4", - "debug": "2.6.9", - "depd": "1.1.1", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "on-finished": "2.3.0", - "qs": "6.5.1", - "raw-body": "2.3.2", - "type-is": "1.6.15" - } + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=" }, "bytes": { "version": "3.0.0", @@ -44,16 +28,27 @@ "resolved": "http://registry.npm.taobao.org/colors/download/colors-1.1.2.tgz", "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=" }, + "compressible": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.13.tgz", + "integrity": "sha1-DRAgq5JLL9tNYnmHXH1tq6a6p6k=", + "dependencies": { + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + } + } + }, + "compression": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.2.tgz", + "integrity": "sha1-qv+81qr4VLROuygDU9WtFlH1mmk=" + }, "connect": { "version": "3.6.5", "resolved": "http://registry.npm.taobao.org/connect/download/connect-3.6.5.tgz", - "integrity": "sha1-+43ee6B2OHfQ7J352sC0tA5yx9o=", - "requires": { - "debug": "2.6.9", - "finalhandler": "1.0.6", - "parseurl": "1.3.2", - "utils-merge": "1.0.1" - } + "integrity": "sha1-+43ee6B2OHfQ7J352sC0tA5yx9o=" }, "content-disposition": { "version": "0.5.2", @@ -73,11 +68,7 @@ "cookie-parser": { "version": "1.4.3", "resolved": "http://registry.npm.taobao.org/cookie-parser/download/cookie-parser-1.4.3.tgz", - "integrity": "sha1-D+MfoZ0AC5X0qt8fU/3CuKIDuqU=", - "requires": { - "cookie": "0.3.1", - "cookie-signature": "1.0.6" - } + "integrity": "sha1-D+MfoZ0AC5X0qt8fU/3CuKIDuqU=" }, "cookie-signature": { "version": "1.0.6", @@ -92,10 +83,7 @@ "debug": { "version": "2.6.9", "resolved": "http://registry.npm.taobao.org/debug/download/debug-2.6.9.tgz", - "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=", - "requires": { - "ms": "2.0.0" - } + "integrity": "sha1-XRKFFd8TT/Mn6QpMk/Tgd6U2NB8=" }, "depd": { "version": "1.1.1", @@ -131,52 +119,11 @@ "version": "4.16.2", "resolved": "http://registry.npm.taobao.org/express/download/express-4.16.2.tgz", "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", - "requires": { - "accepts": "1.3.4", - "array-flatten": "1.1.1", - "body-parser": "1.18.2", - "content-disposition": "0.5.2", - "content-type": "1.0.4", - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "1.1.1", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "etag": "1.8.1", - "finalhandler": "1.1.0", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "1.1.2", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.2", - "qs": "6.5.1", - "range-parser": "1.2.0", - "safe-buffer": "5.1.1", - "send": "0.16.1", - "serve-static": "1.13.1", - "setprototypeof": "1.1.0", - "statuses": "1.3.1", - "type-is": "1.6.15", - "utils-merge": "1.0.1", - "vary": "1.1.2" - }, "dependencies": { "finalhandler": { "version": "1.1.0", "resolved": "http://registry.npm.taobao.org/finalhandler/download/finalhandler-1.1.0.tgz", - "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", - "requires": { - "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" - } + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=" }, "setprototypeof": { "version": "1.1.0", @@ -193,48 +140,22 @@ "express-session": { "version": "1.15.6", "resolved": "http://registry.npm.taobao.org/express-session/download/express-session-1.15.6.tgz", - "integrity": "sha1-R7QWDIj0KrcP6KUI4xy/92dXqwo=", - "requires": { - "cookie": "0.3.1", - "cookie-signature": "1.0.6", - "crc": "3.4.4", - "debug": "2.6.9", - "depd": "1.1.1", - "on-headers": "1.0.1", - "parseurl": "1.3.2", - "uid-safe": "2.1.5", - "utils-merge": "1.0.1" - } + "integrity": "sha1-R7QWDIj0KrcP6KUI4xy/92dXqwo=" }, "express-ws": { "version": "3.0.0", "resolved": "http://registry.npm.taobao.org/express-ws/download/express-ws-3.0.0.tgz", - "integrity": "sha1-fdqvO3x1iGXAmZBZiZEbYjRHfb0=", - "requires": { - "ws": "2.3.1" - } + "integrity": "sha1-fdqvO3x1iGXAmZBZiZEbYjRHfb0=" }, "fd-slicer": { "version": "1.0.1", "resolved": "http://registry.npm.taobao.org/fd-slicer/download/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", - "requires": { - "pend": "1.2.0" - } + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=" }, "finalhandler": { "version": "1.0.6", "resolved": "http://registry.npm.taobao.org/finalhandler/download/finalhandler-1.0.6.tgz", "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", - "requires": { - "debug": "2.6.9", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "on-finished": "2.3.0", - "parseurl": "1.3.2", - "statuses": "1.3.1", - "unpipe": "1.0.0" - }, "dependencies": { "statuses": { "version": "1.3.1", @@ -256,12 +177,7 @@ "fs-extra": { "version": "5.0.0", "resolved": "http://registry.npm.taobao.org/fs-extra/download/fs-extra-5.0.0.tgz", - "integrity": "sha1-QU0BEM3QZwVzTQVWUsVBEmDDGr0=", - "requires": { - "graceful-fs": "4.1.11", - "jsonfile": "4.0.0", - "universalify": "0.1.1" - } + "integrity": "sha1-QU0BEM3QZwVzTQVWUsVBEmDDGr0=" }, "graceful-fs": { "version": "4.1.11", @@ -271,13 +187,7 @@ "http-errors": { "version": "1.6.2", "resolved": "http://registry.npm.taobao.org/http-errors/download/http-errors-1.6.2.tgz", - "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", - "requires": { - "depd": "1.1.1", - "inherits": "2.0.3", - "setprototypeof": "1.0.3", - "statuses": "1.4.0" - } + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=" }, "iconv-lite": { "version": "0.4.19", @@ -297,10 +207,7 @@ "jsonfile": { "version": "4.0.0", "resolved": "http://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "4.1.11" - } + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=" }, "media-typer": { "version": "0.3.0", @@ -330,10 +237,7 @@ "mime-types": { "version": "2.1.17", "resolved": "http://registry.npm.taobao.org/mime-types/download/mime-types-2.1.17.tgz", - "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", - "requires": { - "mime-db": "1.30.0" - } + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=" }, "ms": { "version": "2.0.0", @@ -343,10 +247,7 @@ "multiparty": { "version": "4.1.3", "resolved": "http://registry.npm.taobao.org/multiparty/download/multiparty-4.1.3.tgz", - "integrity": "sha1-PEPH/LGJbhdGBDap3Qtu8WaOT5Q=", - "requires": { - "fd-slicer": "1.0.1" - } + "integrity": "sha1-PEPH/LGJbhdGBDap3Qtu8WaOT5Q=" }, "negotiator": { "version": "0.6.1", @@ -356,10 +257,7 @@ "on-finished": { "version": "2.3.0", "resolved": "http://registry.npm.taobao.org/on-finished/download/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=" }, "on-headers": { "version": "1.0.1", @@ -399,11 +297,7 @@ "proxy-addr": { "version": "2.0.2", "resolved": "http://registry.npm.taobao.org/proxy-addr/download/proxy-addr-2.0.2.tgz", - "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", - "requires": { - "forwarded": "0.1.2", - "ipaddr.js": "1.5.2" - } + "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=" }, "qs": { "version": "6.5.1", @@ -423,13 +317,7 @@ "raw-body": { "version": "2.3.2", "resolved": "http://registry.npm.taobao.org/raw-body/download/raw-body-2.3.2.tgz", - "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.2", - "iconv-lite": "0.4.19", - "unpipe": "1.0.0" - } + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=" }, "safe-buffer": { "version": "5.1.1", @@ -440,21 +328,6 @@ "version": "0.16.1", "resolved": "http://registry.npm.taobao.org/send/download/send-0.16.1.tgz", "integrity": "sha1-pw4coh0TgsEdDZ9iMd6ygQgNerM=", - "requires": { - "debug": "2.6.9", - "depd": "1.1.1", - "destroy": "1.0.4", - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "etag": "1.8.1", - "fresh": "0.5.2", - "http-errors": "1.6.2", - "mime": "1.4.1", - "ms": "2.0.0", - "on-finished": "2.3.0", - "range-parser": "1.2.0", - "statuses": "1.3.1" - }, "dependencies": { "statuses": { "version": "1.3.1", @@ -466,13 +339,7 @@ "serve-static": { "version": "1.13.1", "resolved": "http://registry.npm.taobao.org/serve-static/download/serve-static-1.13.1.tgz", - "integrity": "sha1-TFfVNASnYdjy58HooYpH2/J4pxk=", - "requires": { - "encodeurl": "1.0.1", - "escape-html": "1.0.3", - "parseurl": "1.3.2", - "send": "0.16.1" - } + "integrity": "sha1-TFfVNASnYdjy58HooYpH2/J4pxk=" }, "setprototypeof": { "version": "1.0.3", @@ -487,19 +354,12 @@ "type-is": { "version": "1.6.15", "resolved": "http://registry.npm.taobao.org/type-is/download/type-is-1.6.15.tgz", - "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", - "requires": { - "media-typer": "0.3.0", - "mime-types": "2.1.17" - } + "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=" }, "uid-safe": { "version": "2.1.5", "resolved": "http://registry.npm.taobao.org/uid-safe/download/uid-safe-2.1.5.tgz", - "integrity": "sha1-Kz1cckDo/C5Y+Komnl7knAhXvTo=", - "requires": { - "random-bytes": "1.0.0" - } + "integrity": "sha1-Kz1cckDo/C5Y+Komnl7knAhXvTo=" }, "ultron": { "version": "1.1.0", @@ -530,10 +390,6 @@ "version": "2.3.1", "resolved": "http://registry.npm.taobao.org/ws/download/ws-2.3.1.tgz", "integrity": "sha1-a5Sz5EfLajY/eF6vlK9jWejoHIA=", - "requires": { - "safe-buffer": "5.0.1", - "ultron": "1.1.0" - }, "dependencies": { "safe-buffer": { "version": "5.0.1", diff --git a/package.json b/package.json index 20ea90f3..e5f0d4f3 100644 --- a/package.json +++ b/package.json @@ -19,16 +19,17 @@ "dependencies": { "body-parser": "^1.17.2", "colors": "^1.1.2", + "compression": "^1.7.2", "connect": "^3.6.2", "cookie-parser": "^1.4.3", "express": "^4.15.3", "express-session": "^1.15.3", "express-ws": "^3.0.0", + "fs-extra": "^5.0.0", + "multiparty": "^4.1.3", "os-utils": "0.0.14", "pidusage": "^1.1.5", - "properties": "^1.2.1", - "fs-extra": "^5.0.0", - "multiparty": "^4.1.3" + "properties": "^1.2.1" }, "devDependencies": {}, "repository": {