@mjhls/mjh-framework 1.0.709-ad-refresh-v1 → 1.0.709-ad-refresh-v3
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/dist/cjs/AdSlotsProvider.js +9 -4
- package/dist/cjs/Auth.js +206 -6
- package/dist/cjs/View.js +2 -2
- package/dist/cjs/getRelatedArticle.js +5 -354
- package/dist/cjs/index.js +3 -3
- package/dist/esm/AdSlotsProvider.js +10 -5
- package/dist/esm/Auth.js +201 -1
- package/dist/esm/View.js +2 -2
- package/dist/esm/getRelatedArticle.js +5 -354
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
- package/dist/cjs/index-bd6c9f56.js +0 -211
- package/dist/esm/index-db3bb315.js +0 -207
|
@@ -26,12 +26,17 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
|
|
|
26
26
|
var isScrolling = void 0;
|
|
27
27
|
var refreshADsAfterInterval = function refreshADsAfterInterval() {
|
|
28
28
|
isScrolling = setInterval(function () {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (main.main_36) {
|
|
30
|
+
// Refreshing leaderboard ad in mobile view
|
|
31
|
+
index.lib_3.refresh(refreshADs);
|
|
32
|
+
} else if (main.main_22) {
|
|
33
|
+
// Refreshing all ads in browser view
|
|
34
|
+
index.lib_3.refresh();
|
|
35
|
+
}
|
|
31
36
|
}, 60000);
|
|
32
37
|
};
|
|
33
|
-
autoRefresh &&
|
|
34
|
-
autoRefresh &&
|
|
38
|
+
autoRefresh && refreshADsAfterInterval();
|
|
39
|
+
autoRefresh && window.addEventListener('scroll', function () {
|
|
35
40
|
clearInterval(isScrolling);
|
|
36
41
|
refreshADsAfterInterval();
|
|
37
42
|
}, false);
|
package/dist/cjs/Auth.js
CHANGED
|
@@ -23,7 +23,6 @@ var asyncToGenerator = require('./asyncToGenerator-533d476a.js');
|
|
|
23
23
|
require('./_set-species-f92c67c5.js');
|
|
24
24
|
var reactBootstrap = require('react-bootstrap');
|
|
25
25
|
var util = require('./util-f2c1b65b.js');
|
|
26
|
-
var index$4 = require('./index-bd6c9f56.js');
|
|
27
26
|
var useSWR = _interopDefault(require('swr'));
|
|
28
27
|
var Local = _interopDefault(require('passport-local'));
|
|
29
28
|
var mysql = _interopDefault(require('mysql'));
|
|
@@ -1211,12 +1210,213 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1211
1210
|
);
|
|
1212
1211
|
};
|
|
1213
1212
|
|
|
1213
|
+
/*!
|
|
1214
|
+
* cookie
|
|
1215
|
+
* Copyright(c) 2012-2014 Roman Shtylman
|
|
1216
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1217
|
+
* MIT Licensed
|
|
1218
|
+
*/
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* Module exports.
|
|
1222
|
+
* @public
|
|
1223
|
+
*/
|
|
1224
|
+
|
|
1225
|
+
var parse_1 = parse;
|
|
1226
|
+
var serialize_1 = serialize;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Module variables.
|
|
1230
|
+
* @private
|
|
1231
|
+
*/
|
|
1232
|
+
|
|
1233
|
+
var decode = decodeURIComponent;
|
|
1234
|
+
var encode = encodeURIComponent;
|
|
1235
|
+
var pairSplitRegExp = /; */;
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
1239
|
+
*
|
|
1240
|
+
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
1241
|
+
* field-vchar = VCHAR / obs-text
|
|
1242
|
+
* obs-text = %x80-FF
|
|
1243
|
+
*/
|
|
1244
|
+
|
|
1245
|
+
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Parse a cookie header.
|
|
1249
|
+
*
|
|
1250
|
+
* Parse the given cookie header string into an object
|
|
1251
|
+
* The object has the various cookies as keys(names) => values
|
|
1252
|
+
*
|
|
1253
|
+
* @param {string} str
|
|
1254
|
+
* @param {object} [options]
|
|
1255
|
+
* @return {object}
|
|
1256
|
+
* @public
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
function parse(str, options) {
|
|
1260
|
+
if (typeof str !== 'string') {
|
|
1261
|
+
throw new TypeError('argument str must be a string');
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
var obj = {};
|
|
1265
|
+
var opt = options || {};
|
|
1266
|
+
var pairs = str.split(pairSplitRegExp);
|
|
1267
|
+
var dec = opt.decode || decode;
|
|
1268
|
+
|
|
1269
|
+
for (var i = 0; i < pairs.length; i++) {
|
|
1270
|
+
var pair = pairs[i];
|
|
1271
|
+
var eq_idx = pair.indexOf('=');
|
|
1272
|
+
|
|
1273
|
+
// skip things that don't look like key=value
|
|
1274
|
+
if (eq_idx < 0) {
|
|
1275
|
+
continue;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
var key = pair.substr(0, eq_idx).trim();
|
|
1279
|
+
var val = pair.substr(++eq_idx, pair.length).trim();
|
|
1280
|
+
|
|
1281
|
+
// quoted values
|
|
1282
|
+
if ('"' == val[0]) {
|
|
1283
|
+
val = val.slice(1, -1);
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
// only assign once
|
|
1287
|
+
if (undefined == obj[key]) {
|
|
1288
|
+
obj[key] = tryDecode(val, dec);
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
return obj;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Serialize data into a cookie header.
|
|
1297
|
+
*
|
|
1298
|
+
* Serialize the a name value pair into a cookie string suitable for
|
|
1299
|
+
* http headers. An optional options object specified cookie parameters.
|
|
1300
|
+
*
|
|
1301
|
+
* serialize('foo', 'bar', { httpOnly: true })
|
|
1302
|
+
* => "foo=bar; httpOnly"
|
|
1303
|
+
*
|
|
1304
|
+
* @param {string} name
|
|
1305
|
+
* @param {string} val
|
|
1306
|
+
* @param {object} [options]
|
|
1307
|
+
* @return {string}
|
|
1308
|
+
* @public
|
|
1309
|
+
*/
|
|
1310
|
+
|
|
1311
|
+
function serialize(name, val, options) {
|
|
1312
|
+
var opt = options || {};
|
|
1313
|
+
var enc = opt.encode || encode;
|
|
1314
|
+
|
|
1315
|
+
if (typeof enc !== 'function') {
|
|
1316
|
+
throw new TypeError('option encode is invalid');
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
if (!fieldContentRegExp.test(name)) {
|
|
1320
|
+
throw new TypeError('argument name is invalid');
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
var value = enc(val);
|
|
1324
|
+
|
|
1325
|
+
if (value && !fieldContentRegExp.test(value)) {
|
|
1326
|
+
throw new TypeError('argument val is invalid');
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
var str = name + '=' + value;
|
|
1330
|
+
|
|
1331
|
+
if (null != opt.maxAge) {
|
|
1332
|
+
var maxAge = opt.maxAge - 0;
|
|
1333
|
+
|
|
1334
|
+
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
1335
|
+
throw new TypeError('option maxAge is invalid')
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
str += '; Max-Age=' + Math.floor(maxAge);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
if (opt.domain) {
|
|
1342
|
+
if (!fieldContentRegExp.test(opt.domain)) {
|
|
1343
|
+
throw new TypeError('option domain is invalid');
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
str += '; Domain=' + opt.domain;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
if (opt.path) {
|
|
1350
|
+
if (!fieldContentRegExp.test(opt.path)) {
|
|
1351
|
+
throw new TypeError('option path is invalid');
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
str += '; Path=' + opt.path;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
if (opt.expires) {
|
|
1358
|
+
if (typeof opt.expires.toUTCString !== 'function') {
|
|
1359
|
+
throw new TypeError('option expires is invalid');
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
str += '; Expires=' + opt.expires.toUTCString();
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
if (opt.httpOnly) {
|
|
1366
|
+
str += '; HttpOnly';
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
if (opt.secure) {
|
|
1370
|
+
str += '; Secure';
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if (opt.sameSite) {
|
|
1374
|
+
var sameSite = typeof opt.sameSite === 'string'
|
|
1375
|
+
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
1376
|
+
|
|
1377
|
+
switch (sameSite) {
|
|
1378
|
+
case true:
|
|
1379
|
+
str += '; SameSite=Strict';
|
|
1380
|
+
break;
|
|
1381
|
+
case 'lax':
|
|
1382
|
+
str += '; SameSite=Lax';
|
|
1383
|
+
break;
|
|
1384
|
+
case 'strict':
|
|
1385
|
+
str += '; SameSite=Strict';
|
|
1386
|
+
break;
|
|
1387
|
+
case 'none':
|
|
1388
|
+
str += '; SameSite=None';
|
|
1389
|
+
break;
|
|
1390
|
+
default:
|
|
1391
|
+
throw new TypeError('option sameSite is invalid');
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
return str;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Try decoding a string using a decoding function.
|
|
1400
|
+
*
|
|
1401
|
+
* @param {string} str
|
|
1402
|
+
* @param {function} decode
|
|
1403
|
+
* @private
|
|
1404
|
+
*/
|
|
1405
|
+
|
|
1406
|
+
function tryDecode(str, decode) {
|
|
1407
|
+
try {
|
|
1408
|
+
return decode(str);
|
|
1409
|
+
} catch (e) {
|
|
1410
|
+
return str;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1214
1414
|
var TOKEN_NAME = 'token';
|
|
1215
1415
|
var MAX_AGE = 60 * 60 * 8; // 8 hours
|
|
1216
1416
|
|
|
1217
1417
|
function setTokenCookie(res, token, eKey) {
|
|
1218
1418
|
var cookies_serailized = [];
|
|
1219
|
-
cookies_serailized.push(
|
|
1419
|
+
cookies_serailized.push(serialize_1(TOKEN_NAME, token, {
|
|
1220
1420
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1221
1421
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1222
1422
|
//httpOnly: true,
|
|
@@ -1225,7 +1425,7 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1225
1425
|
//sameSite: 'lax',
|
|
1226
1426
|
}));
|
|
1227
1427
|
|
|
1228
|
-
cookies_serailized.push(
|
|
1428
|
+
cookies_serailized.push(serialize_1('eKey', eKey, {
|
|
1229
1429
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1230
1430
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1231
1431
|
//httpOnly: true,
|
|
@@ -1239,12 +1439,12 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1239
1439
|
|
|
1240
1440
|
function removeTokenCookie(res) {
|
|
1241
1441
|
var cookies_serailized = [];
|
|
1242
|
-
cookies_serailized.push(
|
|
1442
|
+
cookies_serailized.push(serialize_1(TOKEN_NAME, '', {
|
|
1243
1443
|
maxAge: -1,
|
|
1244
1444
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1245
1445
|
path: '/'
|
|
1246
1446
|
}));
|
|
1247
|
-
cookies_serailized.push(
|
|
1447
|
+
cookies_serailized.push(serialize_1('eKey', '', {
|
|
1248
1448
|
maxAge: -1,
|
|
1249
1449
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1250
1450
|
path: '/'
|
|
@@ -1259,7 +1459,7 @@ function parseCookies(req) {
|
|
|
1259
1459
|
|
|
1260
1460
|
// For pages we do need to parse the cookies.
|
|
1261
1461
|
var cookie = req.headers ? req.headers.cookie : null;
|
|
1262
|
-
return
|
|
1462
|
+
return parse_1(cookie || '');
|
|
1263
1463
|
}
|
|
1264
1464
|
|
|
1265
1465
|
function getTokenCookie(req) {
|
package/dist/cjs/View.js
CHANGED
|
@@ -62,9 +62,9 @@ var keys = require('./keys-a586b7a0.js');
|
|
|
62
62
|
require('react-bootstrap/Dropdown');
|
|
63
63
|
var index_esm$3 = require('./index.esm-ff47db6f.js');
|
|
64
64
|
var getSeriesDetail = require('./getSeriesDetail.js');
|
|
65
|
-
require('
|
|
66
|
-
var getRelatedArticle = require('./getRelatedArticle.js');
|
|
65
|
+
require('nookies');
|
|
67
66
|
var getQuery = require('./getQuery.js');
|
|
67
|
+
var getRelatedArticle = require('./getRelatedArticle.js');
|
|
68
68
|
var getTargeting = require('./getTargeting-fee8c429.js');
|
|
69
69
|
var getKeywords = require('./getKeywords.js');
|
|
70
70
|
var urlFor = require('./urlFor.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require('./_commonjsHelpers-06173234.js');
|
|
4
4
|
require('./_to-object-329a650b.js');
|
|
5
5
|
require('./es6.string.iterator-cc0bbaa4.js');
|
|
6
6
|
require('./_library-dd23b178.js');
|
|
@@ -9,358 +9,9 @@ require('./core.get-iterator-method-f62321d4.js');
|
|
|
9
9
|
require('./web.dom.iterable-a0e279c1.js');
|
|
10
10
|
var asyncToGenerator = require('./asyncToGenerator-533d476a.js');
|
|
11
11
|
require('./_set-species-f92c67c5.js');
|
|
12
|
-
var
|
|
12
|
+
var nookies = require('nookies');
|
|
13
13
|
var getQuery = require('./getQuery.js');
|
|
14
14
|
|
|
15
|
-
var defaultParseOptions = {
|
|
16
|
-
decodeValues: true,
|
|
17
|
-
map: false,
|
|
18
|
-
silent: false,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
function isNonEmptyString(str) {
|
|
22
|
-
return typeof str === "string" && !!str.trim();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function parseString(setCookieValue, options) {
|
|
26
|
-
var parts = setCookieValue.split(";").filter(isNonEmptyString);
|
|
27
|
-
var nameValue = parts.shift().split("=");
|
|
28
|
-
var name = nameValue.shift();
|
|
29
|
-
var value = nameValue.join("="); // everything after the first =, joined by a "=" if there was more than one part
|
|
30
|
-
|
|
31
|
-
options = options
|
|
32
|
-
? Object.assign({}, defaultParseOptions, options)
|
|
33
|
-
: defaultParseOptions;
|
|
34
|
-
|
|
35
|
-
var cookie = {
|
|
36
|
-
name: name, // grab everything before the first =
|
|
37
|
-
value: options.decodeValues ? decodeURIComponent(value) : value, // decode cookie value
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
parts.forEach(function (part) {
|
|
41
|
-
var sides = part.split("=");
|
|
42
|
-
var key = sides.shift().trimLeft().toLowerCase();
|
|
43
|
-
var value = sides.join("=");
|
|
44
|
-
if (key === "expires") {
|
|
45
|
-
cookie.expires = new Date(value);
|
|
46
|
-
} else if (key === "max-age") {
|
|
47
|
-
cookie.maxAge = parseInt(value, 10);
|
|
48
|
-
} else if (key === "secure") {
|
|
49
|
-
cookie.secure = true;
|
|
50
|
-
} else if (key === "httponly") {
|
|
51
|
-
cookie.httpOnly = true;
|
|
52
|
-
} else if (key === "samesite") {
|
|
53
|
-
cookie.sameSite = value;
|
|
54
|
-
} else {
|
|
55
|
-
cookie[key] = value;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return cookie;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function parse(input, options) {
|
|
63
|
-
options = options
|
|
64
|
-
? Object.assign({}, defaultParseOptions, options)
|
|
65
|
-
: defaultParseOptions;
|
|
66
|
-
|
|
67
|
-
if (!input) {
|
|
68
|
-
if (!options.map) {
|
|
69
|
-
return [];
|
|
70
|
-
} else {
|
|
71
|
-
return {};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (input.headers && input.headers["set-cookie"]) {
|
|
76
|
-
// fast-path for node.js (which automatically normalizes header names to lower-case
|
|
77
|
-
input = input.headers["set-cookie"];
|
|
78
|
-
} else if (input.headers) {
|
|
79
|
-
// slow-path for other environments - see #25
|
|
80
|
-
var sch =
|
|
81
|
-
input.headers[
|
|
82
|
-
Object.keys(input.headers).find(function (key) {
|
|
83
|
-
return key.toLowerCase() === "set-cookie";
|
|
84
|
-
})
|
|
85
|
-
];
|
|
86
|
-
// warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
|
|
87
|
-
if (!sch && input.headers.cookie && !options.silent) {
|
|
88
|
-
console.warn(
|
|
89
|
-
"Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
input = sch;
|
|
93
|
-
}
|
|
94
|
-
if (!Array.isArray(input)) {
|
|
95
|
-
input = [input];
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
options = options
|
|
99
|
-
? Object.assign({}, defaultParseOptions, options)
|
|
100
|
-
: defaultParseOptions;
|
|
101
|
-
|
|
102
|
-
if (!options.map) {
|
|
103
|
-
return input.filter(isNonEmptyString).map(function (str) {
|
|
104
|
-
return parseString(str, options);
|
|
105
|
-
});
|
|
106
|
-
} else {
|
|
107
|
-
var cookies = {};
|
|
108
|
-
return input.filter(isNonEmptyString).reduce(function (cookies, str) {
|
|
109
|
-
var cookie = parseString(str, options);
|
|
110
|
-
cookies[cookie.name] = cookie;
|
|
111
|
-
return cookies;
|
|
112
|
-
}, cookies);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/*
|
|
117
|
-
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
|
118
|
-
that are within a single set-cookie field-value, such as in the Expires portion.
|
|
119
|
-
|
|
120
|
-
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
|
121
|
-
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
|
122
|
-
React Native's fetch does this for *every* header, including set-cookie.
|
|
123
|
-
|
|
124
|
-
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
|
125
|
-
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
|
126
|
-
*/
|
|
127
|
-
function splitCookiesString(cookiesString) {
|
|
128
|
-
if (Array.isArray(cookiesString)) {
|
|
129
|
-
return cookiesString;
|
|
130
|
-
}
|
|
131
|
-
if (typeof cookiesString !== "string") {
|
|
132
|
-
return [];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
var cookiesStrings = [];
|
|
136
|
-
var pos = 0;
|
|
137
|
-
var start;
|
|
138
|
-
var ch;
|
|
139
|
-
var lastComma;
|
|
140
|
-
var nextStart;
|
|
141
|
-
var cookiesSeparatorFound;
|
|
142
|
-
|
|
143
|
-
function skipWhitespace() {
|
|
144
|
-
while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
|
|
145
|
-
pos += 1;
|
|
146
|
-
}
|
|
147
|
-
return pos < cookiesString.length;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function notSpecialChar() {
|
|
151
|
-
ch = cookiesString.charAt(pos);
|
|
152
|
-
|
|
153
|
-
return ch !== "=" && ch !== ";" && ch !== ",";
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
while (pos < cookiesString.length) {
|
|
157
|
-
start = pos;
|
|
158
|
-
cookiesSeparatorFound = false;
|
|
159
|
-
|
|
160
|
-
while (skipWhitespace()) {
|
|
161
|
-
ch = cookiesString.charAt(pos);
|
|
162
|
-
if (ch === ",") {
|
|
163
|
-
// ',' is a cookie separator if we have later first '=', not ';' or ','
|
|
164
|
-
lastComma = pos;
|
|
165
|
-
pos += 1;
|
|
166
|
-
|
|
167
|
-
skipWhitespace();
|
|
168
|
-
nextStart = pos;
|
|
169
|
-
|
|
170
|
-
while (pos < cookiesString.length && notSpecialChar()) {
|
|
171
|
-
pos += 1;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// currently special character
|
|
175
|
-
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
|
176
|
-
// we found cookies separator
|
|
177
|
-
cookiesSeparatorFound = true;
|
|
178
|
-
// pos is inside the next cookie, so back up and return it.
|
|
179
|
-
pos = nextStart;
|
|
180
|
-
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
|
181
|
-
start = pos;
|
|
182
|
-
} else {
|
|
183
|
-
// in param ',' or param separator ';',
|
|
184
|
-
// we continue from that comma
|
|
185
|
-
pos = lastComma + 1;
|
|
186
|
-
}
|
|
187
|
-
} else {
|
|
188
|
-
pos += 1;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
|
193
|
-
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return cookiesStrings;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
var setCookie = parse;
|
|
201
|
-
var parse_1 = parse;
|
|
202
|
-
var parseString_1 = parseString;
|
|
203
|
-
var splitCookiesString_1 = splitCookiesString;
|
|
204
|
-
setCookie.parse = parse_1;
|
|
205
|
-
setCookie.parseString = parseString_1;
|
|
206
|
-
setCookie.splitCookiesString = splitCookiesString_1;
|
|
207
|
-
|
|
208
|
-
var dist = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
209
|
-
var __assign = (_commonjsHelpers.commonjsGlobal && _commonjsHelpers.commonjsGlobal.__assign) || function () {
|
|
210
|
-
__assign = Object.assign || function(t) {
|
|
211
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
212
|
-
s = arguments[i];
|
|
213
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
214
|
-
t[p] = s[p];
|
|
215
|
-
}
|
|
216
|
-
return t;
|
|
217
|
-
};
|
|
218
|
-
return __assign.apply(this, arguments);
|
|
219
|
-
};
|
|
220
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
221
|
-
exports.destroyCookie = exports.setCookie = exports.parseCookies = void 0;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
var isBrowser = function () { return typeof window !== 'undefined'; };
|
|
225
|
-
function hasSameProperties(a, b) {
|
|
226
|
-
var aProps = Object.getOwnPropertyNames(a);
|
|
227
|
-
var bProps = Object.getOwnPropertyNames(b);
|
|
228
|
-
if (aProps.length !== bProps.length) {
|
|
229
|
-
return false;
|
|
230
|
-
}
|
|
231
|
-
for (var i = 0; i < aProps.length; i++) {
|
|
232
|
-
var propName = aProps[i];
|
|
233
|
-
if (a[propName] !== b[propName]) {
|
|
234
|
-
return false;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Compare the cookie and return true if the cookies has equivalent
|
|
241
|
-
* options and the cookies would be overwritten in the browser storage.
|
|
242
|
-
*
|
|
243
|
-
* @param a first Cookie for comparison
|
|
244
|
-
* @param b second Cookie for comparison
|
|
245
|
-
*/
|
|
246
|
-
function areCookiesEqual(a, b) {
|
|
247
|
-
var sameSiteSame = a.sameSite === b.sameSite;
|
|
248
|
-
if (typeof a.sameSite === 'string' && typeof b.sameSite === 'string') {
|
|
249
|
-
sameSiteSame = a.sameSite.toLowerCase() === b.sameSite.toLowerCase();
|
|
250
|
-
}
|
|
251
|
-
return (hasSameProperties(__assign(__assign({}, a), { sameSite: undefined }), __assign(__assign({}, b), { sameSite: undefined })) && sameSiteSame);
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Create an instance of the Cookie interface
|
|
255
|
-
*
|
|
256
|
-
* @param name name of the Cookie
|
|
257
|
-
* @param value value of the Cookie
|
|
258
|
-
* @param options Cookie options
|
|
259
|
-
*/
|
|
260
|
-
function createCookie(name, value, options) {
|
|
261
|
-
var sameSite = options.sameSite;
|
|
262
|
-
if (sameSite === true) {
|
|
263
|
-
sameSite = 'strict';
|
|
264
|
-
}
|
|
265
|
-
if (sameSite === undefined || sameSite === false) {
|
|
266
|
-
sameSite = 'lax';
|
|
267
|
-
}
|
|
268
|
-
var cookieToSet = __assign(__assign({}, options), { sameSite: sameSite });
|
|
269
|
-
delete cookieToSet.encode;
|
|
270
|
-
return __assign({ name: name, value: value }, cookieToSet);
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
*
|
|
274
|
-
* Parses cookies.
|
|
275
|
-
*
|
|
276
|
-
* @param ctx
|
|
277
|
-
* @param options
|
|
278
|
-
*/
|
|
279
|
-
function parseCookies(ctx, options) {
|
|
280
|
-
if (ctx && ctx.req && ctx.req.headers && ctx.req.headers.cookie) {
|
|
281
|
-
return index$4.cookie.parse(ctx.req.headers.cookie, options);
|
|
282
|
-
}
|
|
283
|
-
if (isBrowser()) {
|
|
284
|
-
return index$4.cookie.parse(document.cookie, options);
|
|
285
|
-
}
|
|
286
|
-
return {};
|
|
287
|
-
}
|
|
288
|
-
exports.parseCookies = parseCookies;
|
|
289
|
-
/**
|
|
290
|
-
*
|
|
291
|
-
* Sets a cookie.
|
|
292
|
-
*
|
|
293
|
-
* @param ctx
|
|
294
|
-
* @param name
|
|
295
|
-
* @param value
|
|
296
|
-
* @param options
|
|
297
|
-
*/
|
|
298
|
-
function setCookie$1(ctx, name, value, options) {
|
|
299
|
-
if (ctx && ctx.res && ctx.res.getHeader && ctx.res.setHeader) {
|
|
300
|
-
var cookies = ctx.res.getHeader('Set-Cookie') || [];
|
|
301
|
-
if (typeof cookies === 'string')
|
|
302
|
-
cookies = [cookies];
|
|
303
|
-
if (typeof cookies === 'number')
|
|
304
|
-
cookies = [];
|
|
305
|
-
var parsedCookies = setCookie.parse(cookies);
|
|
306
|
-
var cookiesToSet_1 = [];
|
|
307
|
-
parsedCookies.forEach(function (parsedCookie) {
|
|
308
|
-
if (!areCookiesEqual(parsedCookie, createCookie(name, value, options))) {
|
|
309
|
-
cookiesToSet_1.push(index$4.cookie.serialize(parsedCookie.name, parsedCookie.value, __assign({ encode: function (val) { return val; } }, parsedCookie)));
|
|
310
|
-
}
|
|
311
|
-
});
|
|
312
|
-
cookiesToSet_1.push(index$4.cookie.serialize(name, value, options));
|
|
313
|
-
if (!ctx.res.finished) {
|
|
314
|
-
ctx.res.setHeader('Set-Cookie', cookiesToSet_1);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (isBrowser()) {
|
|
318
|
-
if (options && options.httpOnly) {
|
|
319
|
-
throw new Error('Can not set a httpOnly cookie in the browser.');
|
|
320
|
-
}
|
|
321
|
-
document.cookie = index$4.cookie.serialize(name, value, options);
|
|
322
|
-
}
|
|
323
|
-
return {};
|
|
324
|
-
}
|
|
325
|
-
exports.setCookie = setCookie$1;
|
|
326
|
-
/**
|
|
327
|
-
*
|
|
328
|
-
* Destroys a cookie with a particular name.
|
|
329
|
-
*
|
|
330
|
-
* @param ctx
|
|
331
|
-
* @param name
|
|
332
|
-
* @param options
|
|
333
|
-
*/
|
|
334
|
-
function destroyCookie(ctx, name, options) {
|
|
335
|
-
var opts = __assign(__assign({}, (options || {})), { maxAge: -1 });
|
|
336
|
-
if (ctx && ctx.res && ctx.res.setHeader && ctx.res.getHeader) {
|
|
337
|
-
var cookies = ctx.res.getHeader('Set-Cookie') || [];
|
|
338
|
-
if (typeof cookies === 'string')
|
|
339
|
-
cookies = [cookies];
|
|
340
|
-
if (typeof cookies === 'number')
|
|
341
|
-
cookies = [];
|
|
342
|
-
cookies.push(index$4.cookie.serialize(name, '', opts));
|
|
343
|
-
ctx.res.setHeader('Set-Cookie', cookies);
|
|
344
|
-
}
|
|
345
|
-
if (isBrowser()) {
|
|
346
|
-
document.cookie = index$4.cookie.serialize(name, '', opts);
|
|
347
|
-
}
|
|
348
|
-
return {};
|
|
349
|
-
}
|
|
350
|
-
exports.destroyCookie = destroyCookie;
|
|
351
|
-
exports.default = {
|
|
352
|
-
set: setCookie$1,
|
|
353
|
-
get: parseCookies,
|
|
354
|
-
destroy: destroyCookie,
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
_commonjsHelpers.unwrapExports(dist);
|
|
360
|
-
var dist_1 = dist.destroyCookie;
|
|
361
|
-
var dist_2 = dist.setCookie;
|
|
362
|
-
var dist_3 = dist.parseCookies;
|
|
363
|
-
|
|
364
15
|
var _this = undefined;
|
|
365
16
|
|
|
366
17
|
var getRelatedArticle = function () {
|
|
@@ -437,13 +88,13 @@ var getRelatedArticle = function () {
|
|
|
437
88
|
|
|
438
89
|
|
|
439
90
|
if (ctx && url) {
|
|
440
|
-
cookies =
|
|
91
|
+
cookies = nookies.parseCookies(ctx);
|
|
441
92
|
prevSlugs = cookies['prevSlugs'];
|
|
442
93
|
|
|
443
94
|
if (!!prevSlugs) {
|
|
444
|
-
|
|
95
|
+
nookies.setCookie(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
|
|
445
96
|
filters = '&& !(url.current in [' + prevSlugs + '])';
|
|
446
|
-
} else
|
|
97
|
+
} else nookies.setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
|
|
447
98
|
}
|
|
448
99
|
|
|
449
100
|
query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
|
package/dist/cjs/index.js
CHANGED
|
@@ -163,9 +163,9 @@ var ConferenceArticleCard = require('./ConferenceArticleCard.js');
|
|
|
163
163
|
var KMTracker = require('./KMTracker.js');
|
|
164
164
|
var getSeriesDetail = require('./getSeriesDetail.js');
|
|
165
165
|
var SetCookie = require('./SetCookie.js');
|
|
166
|
-
require('
|
|
167
|
-
var getRelatedArticle = require('./getRelatedArticle.js');
|
|
166
|
+
require('nookies');
|
|
168
167
|
var getQuery = require('./getQuery.js');
|
|
168
|
+
var getRelatedArticle = require('./getRelatedArticle.js');
|
|
169
169
|
var Auth = require('./Auth.js');
|
|
170
170
|
require('swr');
|
|
171
171
|
require('passport-local');
|
|
@@ -257,8 +257,8 @@ exports.ConferenceArticleCard = ConferenceArticleCard;
|
|
|
257
257
|
exports.KMTracker = KMTracker;
|
|
258
258
|
exports.getSeriesDetail = getSeriesDetail;
|
|
259
259
|
exports.SetCookie = SetCookie;
|
|
260
|
-
exports.getRelatedArticle = getRelatedArticle;
|
|
261
260
|
exports.getQuery = getQuery;
|
|
261
|
+
exports.getRelatedArticle = getRelatedArticle;
|
|
262
262
|
exports.Auth = Auth.default;
|
|
263
263
|
exports.getTargeting = getTargeting.getTargeting;
|
|
264
264
|
exports.View = View;
|