yakuza0 2.23.19 → 2.23.20-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/proxy/tire.js +18 -5
- package/utils/inclusive.js +2 -1
package/package.json
CHANGED
package/server/proxy/tire.js
CHANGED
|
@@ -71,8 +71,17 @@ var _require = require('http-proxy-middleware'),
|
|
|
71
71
|
|
|
72
72
|
var autoRefreshCapacity = {};
|
|
73
73
|
|
|
74
|
-
var getCacheKey = function getCacheKey(
|
|
75
|
-
|
|
74
|
+
var getCacheKey = function getCacheKey(req) {
|
|
75
|
+
var str = "";
|
|
76
|
+
if (req) {
|
|
77
|
+
if (req.url) {
|
|
78
|
+
str += req.url.split('?')[0];
|
|
79
|
+
}
|
|
80
|
+
if (req.headers) {
|
|
81
|
+
str += (0, _server.md5)(req.headers["User-Agent".toLowerCase()]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return str;
|
|
76
85
|
};
|
|
77
86
|
|
|
78
87
|
var spiBody = function spiBody(appConf) {
|
|
@@ -321,7 +330,7 @@ exports.default = function () {
|
|
|
321
330
|
|
|
322
331
|
app.use(function (req, res, next) {
|
|
323
332
|
if (_config2.default.security.isTire) {
|
|
324
|
-
var data = (0, _secCache.secCacheGet)(getCacheKey(req
|
|
333
|
+
var data = (0, _secCache.secCacheGet)(getCacheKey(req));
|
|
325
334
|
|
|
326
335
|
if (data) {
|
|
327
336
|
var isHasCookie = false;
|
|
@@ -346,7 +355,7 @@ exports.default = function () {
|
|
|
346
355
|
var isSet = req.get("x-gen-set");
|
|
347
356
|
|
|
348
357
|
if (isSet !== "true") {
|
|
349
|
-
var _data = (0, _secCache.secCacheGet)(getCacheKey(req
|
|
358
|
+
var _data = (0, _secCache.secCacheGet)(getCacheKey(req));
|
|
350
359
|
// res.header("Connection", "close");
|
|
351
360
|
// console.log(req.url, "all");
|
|
352
361
|
|
|
@@ -363,6 +372,7 @@ exports.default = function () {
|
|
|
363
372
|
// res.send(data.body);
|
|
364
373
|
} else {
|
|
365
374
|
// console.log(req.url, "sec nooo~");
|
|
375
|
+
var userAgentMd5 = (0, _server.md5)(req.get('User-Agent'));
|
|
366
376
|
var extIndex = req.url.lastIndexOf('.');
|
|
367
377
|
if (!apiVer(req.url) && extIndex === -1) {
|
|
368
378
|
var _extends2;
|
|
@@ -373,6 +383,7 @@ exports.default = function () {
|
|
|
373
383
|
url: req.url,
|
|
374
384
|
project: _config2.default.name,
|
|
375
385
|
app: config.appName,
|
|
386
|
+
userAgentMd5: userAgentMd5,
|
|
376
387
|
|
|
377
388
|
personality: server.generate.personality,
|
|
378
389
|
domain: appConf.cookieDomain || _server.Cookies.getDefCookieDomain(req && req.headers && req.headers.host || ''),
|
|
@@ -520,6 +531,7 @@ exports.default = function () {
|
|
|
520
531
|
ws: true,
|
|
521
532
|
// pathRewrite: {['^/' + server.basePath + '/api-ws'] : '/api-ws'},
|
|
522
533
|
onProxyRes: function onProxyRes(proxyRes, req, res) {
|
|
534
|
+
var userAgentMd5 = (0, _server.md5)(req.headers["User-Agent".toLowerCase()]);
|
|
523
535
|
var isDoc = ['text/html; charset=utf-8'].includes((proxyRes.headers['content-type'] || '').toLowerCase());
|
|
524
536
|
|
|
525
537
|
// cache ---
|
|
@@ -582,7 +594,7 @@ exports.default = function () {
|
|
|
582
594
|
body = Buffer.concat(body);
|
|
583
595
|
|
|
584
596
|
if (isTireSave || isLibSave || isFastDfs(req.url)) {
|
|
585
|
-
(0, _secCache.secCacheSet)(getCacheKey(req
|
|
597
|
+
(0, _secCache.secCacheSet)(getCacheKey(req), {
|
|
586
598
|
body: body,
|
|
587
599
|
resHeaders: proxyRes.headers,
|
|
588
600
|
status: res.statusCode
|
|
@@ -601,6 +613,7 @@ exports.default = function () {
|
|
|
601
613
|
project: _config2.default.name,
|
|
602
614
|
app: config.appName,
|
|
603
615
|
url: req.url,
|
|
616
|
+
userAgentMd5: userAgentMd5,
|
|
604
617
|
|
|
605
618
|
personality: server.generate.personality,
|
|
606
619
|
host: pHost,
|
package/utils/inclusive.js
CHANGED
|
@@ -395,7 +395,8 @@ var render = function () {
|
|
|
395
395
|
compress: {
|
|
396
396
|
threshold: 1024,
|
|
397
397
|
gzip: true,
|
|
398
|
-
brotli: false
|
|
398
|
+
brotli: false,
|
|
399
|
+
br: false
|
|
399
400
|
// ...(mainConf.server && mainConf.server.compress ? mainConf.server.compress : {}),
|
|
400
401
|
// ...(ykConf.server && ykConf.server.compress ? ykConf.server.compress : {})
|
|
401
402
|
},
|