diff --git a/package-lock.json b/package-lock.json index 9d64290b..2ac4a758 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "bcryptjs": "~2.4.3", "bootstrap": "5.1.3", "bree": "~7.1.5", + "cacheable-lookup": "^6.0.4", "chardet": "^1.3.0", "chart.js": "~3.6.2", "chartjs-adapter-dayjs": "~1.0.0", @@ -4770,6 +4771,14 @@ "node": ">= 0.8" } }, + "node_modules/cacheable-lookup": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.0.4.tgz", + "integrity": "sha512-mbcDEZCkv2CZF4G01kr8eBd/5agkt9oCqz75tJMSIsquvRZ2sL6Hi5zGVKi/0OSC9oO1GHfJ2AV0ZIOY9vye0A==", + "engines": { + "node": ">=10.6.0" + } + }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -19882,6 +19891,11 @@ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==" }, + "cacheable-lookup": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-6.0.4.tgz", + "integrity": "sha512-mbcDEZCkv2CZF4G01kr8eBd/5agkt9oCqz75tJMSIsquvRZ2sL6Hi5zGVKi/0OSC9oO1GHfJ2AV0ZIOY9vye0A==" + }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", diff --git a/package.json b/package.json index 08eed263..022e7d8d 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "bcryptjs": "~2.4.3", "bootstrap": "5.1.3", "bree": "~7.1.5", + "cacheable-lookup": "^6.0.4", "chardet": "^1.3.0", "chart.js": "~3.6.2", "chartjs-adapter-dayjs": "~1.0.0", diff --git a/server/uptime-kuma-server.js b/server/uptime-kuma-server.js index 605ba533..6f7be7ba 100644 --- a/server/uptime-kuma-server.js +++ b/server/uptime-kuma-server.js @@ -7,6 +7,7 @@ const { R } = require("redbean-node"); const { log } = require("../src/util"); const Database = require("./database"); const util = require("util"); +const CacheableLookup = require("cacheable-lookup"); /** * `module.exports` (alias: `server`) should be inside this class, in order to avoid circular dependency issue. @@ -71,6 +72,10 @@ class UptimeKumaServer { } } + const cacheable = new CacheableLookup(); + cacheable.install(http.globalAgent); + cacheable.install(https.globalAgent); + this.io = new Server(this.httpServer); }