@mjhls/mjh-framework 1.0.518 → 1.0.519
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/README.md +1 -1
- package/dist/cjs/Auth.js +6 -206
- package/dist/cjs/PartnerDetailListing.js +1200 -4
- package/dist/cjs/getRelatedArticle.js +354 -5
- package/dist/cjs/index-bd6c9f56.js +211 -0
- package/dist/cjs/index.js +3 -4
- package/dist/esm/Auth.js +1 -201
- package/dist/esm/PartnerDetailListing.js +1200 -4
- package/dist/esm/getRelatedArticle.js +354 -5
- package/dist/esm/index-db3bb315.js +207 -0
- package/dist/esm/index.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cjs/Auth.js
CHANGED
|
@@ -22,6 +22,7 @@ var asyncToGenerator = require('./asyncToGenerator-8e707718.js');
|
|
|
22
22
|
require('./_set-species-4458e975.js');
|
|
23
23
|
var reactBootstrap = require('react-bootstrap');
|
|
24
24
|
var util = require('./util-f2c1b65b.js');
|
|
25
|
+
var index$4 = require('./index-bd6c9f56.js');
|
|
25
26
|
var useSWR = _interopDefault(require('swr'));
|
|
26
27
|
var Local = _interopDefault(require('passport-local'));
|
|
27
28
|
var mysql = _interopDefault(require('mysql'));
|
|
@@ -1209,213 +1210,12 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1209
1210
|
);
|
|
1210
1211
|
};
|
|
1211
1212
|
|
|
1212
|
-
/*!
|
|
1213
|
-
* cookie
|
|
1214
|
-
* Copyright(c) 2012-2014 Roman Shtylman
|
|
1215
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1216
|
-
* MIT Licensed
|
|
1217
|
-
*/
|
|
1218
|
-
|
|
1219
|
-
/**
|
|
1220
|
-
* Module exports.
|
|
1221
|
-
* @public
|
|
1222
|
-
*/
|
|
1223
|
-
|
|
1224
|
-
var parse_1 = parse;
|
|
1225
|
-
var serialize_1 = serialize;
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* Module variables.
|
|
1229
|
-
* @private
|
|
1230
|
-
*/
|
|
1231
|
-
|
|
1232
|
-
var decode = decodeURIComponent;
|
|
1233
|
-
var encode = encodeURIComponent;
|
|
1234
|
-
var pairSplitRegExp = /; */;
|
|
1235
|
-
|
|
1236
|
-
/**
|
|
1237
|
-
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
1238
|
-
*
|
|
1239
|
-
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
1240
|
-
* field-vchar = VCHAR / obs-text
|
|
1241
|
-
* obs-text = %x80-FF
|
|
1242
|
-
*/
|
|
1243
|
-
|
|
1244
|
-
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* Parse a cookie header.
|
|
1248
|
-
*
|
|
1249
|
-
* Parse the given cookie header string into an object
|
|
1250
|
-
* The object has the various cookies as keys(names) => values
|
|
1251
|
-
*
|
|
1252
|
-
* @param {string} str
|
|
1253
|
-
* @param {object} [options]
|
|
1254
|
-
* @return {object}
|
|
1255
|
-
* @public
|
|
1256
|
-
*/
|
|
1257
|
-
|
|
1258
|
-
function parse(str, options) {
|
|
1259
|
-
if (typeof str !== 'string') {
|
|
1260
|
-
throw new TypeError('argument str must be a string');
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
var obj = {};
|
|
1264
|
-
var opt = options || {};
|
|
1265
|
-
var pairs = str.split(pairSplitRegExp);
|
|
1266
|
-
var dec = opt.decode || decode;
|
|
1267
|
-
|
|
1268
|
-
for (var i = 0; i < pairs.length; i++) {
|
|
1269
|
-
var pair = pairs[i];
|
|
1270
|
-
var eq_idx = pair.indexOf('=');
|
|
1271
|
-
|
|
1272
|
-
// skip things that don't look like key=value
|
|
1273
|
-
if (eq_idx < 0) {
|
|
1274
|
-
continue;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
var key = pair.substr(0, eq_idx).trim();
|
|
1278
|
-
var val = pair.substr(++eq_idx, pair.length).trim();
|
|
1279
|
-
|
|
1280
|
-
// quoted values
|
|
1281
|
-
if ('"' == val[0]) {
|
|
1282
|
-
val = val.slice(1, -1);
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
// only assign once
|
|
1286
|
-
if (undefined == obj[key]) {
|
|
1287
|
-
obj[key] = tryDecode(val, dec);
|
|
1288
|
-
}
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
return obj;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
/**
|
|
1295
|
-
* Serialize data into a cookie header.
|
|
1296
|
-
*
|
|
1297
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
1298
|
-
* http headers. An optional options object specified cookie parameters.
|
|
1299
|
-
*
|
|
1300
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
1301
|
-
* => "foo=bar; httpOnly"
|
|
1302
|
-
*
|
|
1303
|
-
* @param {string} name
|
|
1304
|
-
* @param {string} val
|
|
1305
|
-
* @param {object} [options]
|
|
1306
|
-
* @return {string}
|
|
1307
|
-
* @public
|
|
1308
|
-
*/
|
|
1309
|
-
|
|
1310
|
-
function serialize(name, val, options) {
|
|
1311
|
-
var opt = options || {};
|
|
1312
|
-
var enc = opt.encode || encode;
|
|
1313
|
-
|
|
1314
|
-
if (typeof enc !== 'function') {
|
|
1315
|
-
throw new TypeError('option encode is invalid');
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
if (!fieldContentRegExp.test(name)) {
|
|
1319
|
-
throw new TypeError('argument name is invalid');
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
var value = enc(val);
|
|
1323
|
-
|
|
1324
|
-
if (value && !fieldContentRegExp.test(value)) {
|
|
1325
|
-
throw new TypeError('argument val is invalid');
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
var str = name + '=' + value;
|
|
1329
|
-
|
|
1330
|
-
if (null != opt.maxAge) {
|
|
1331
|
-
var maxAge = opt.maxAge - 0;
|
|
1332
|
-
|
|
1333
|
-
if (isNaN(maxAge) || !isFinite(maxAge)) {
|
|
1334
|
-
throw new TypeError('option maxAge is invalid')
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
str += '; Max-Age=' + Math.floor(maxAge);
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
if (opt.domain) {
|
|
1341
|
-
if (!fieldContentRegExp.test(opt.domain)) {
|
|
1342
|
-
throw new TypeError('option domain is invalid');
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
str += '; Domain=' + opt.domain;
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
if (opt.path) {
|
|
1349
|
-
if (!fieldContentRegExp.test(opt.path)) {
|
|
1350
|
-
throw new TypeError('option path is invalid');
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
str += '; Path=' + opt.path;
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
if (opt.expires) {
|
|
1357
|
-
if (typeof opt.expires.toUTCString !== 'function') {
|
|
1358
|
-
throw new TypeError('option expires is invalid');
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
str += '; Expires=' + opt.expires.toUTCString();
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
if (opt.httpOnly) {
|
|
1365
|
-
str += '; HttpOnly';
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
if (opt.secure) {
|
|
1369
|
-
str += '; Secure';
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
if (opt.sameSite) {
|
|
1373
|
-
var sameSite = typeof opt.sameSite === 'string'
|
|
1374
|
-
? opt.sameSite.toLowerCase() : opt.sameSite;
|
|
1375
|
-
|
|
1376
|
-
switch (sameSite) {
|
|
1377
|
-
case true:
|
|
1378
|
-
str += '; SameSite=Strict';
|
|
1379
|
-
break;
|
|
1380
|
-
case 'lax':
|
|
1381
|
-
str += '; SameSite=Lax';
|
|
1382
|
-
break;
|
|
1383
|
-
case 'strict':
|
|
1384
|
-
str += '; SameSite=Strict';
|
|
1385
|
-
break;
|
|
1386
|
-
case 'none':
|
|
1387
|
-
str += '; SameSite=None';
|
|
1388
|
-
break;
|
|
1389
|
-
default:
|
|
1390
|
-
throw new TypeError('option sameSite is invalid');
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
return str;
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
/**
|
|
1398
|
-
* Try decoding a string using a decoding function.
|
|
1399
|
-
*
|
|
1400
|
-
* @param {string} str
|
|
1401
|
-
* @param {function} decode
|
|
1402
|
-
* @private
|
|
1403
|
-
*/
|
|
1404
|
-
|
|
1405
|
-
function tryDecode(str, decode) {
|
|
1406
|
-
try {
|
|
1407
|
-
return decode(str);
|
|
1408
|
-
} catch (e) {
|
|
1409
|
-
return str;
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
1213
|
var TOKEN_NAME = 'token';
|
|
1414
1214
|
var MAX_AGE = 60 * 60 * 8; // 8 hours
|
|
1415
1215
|
|
|
1416
1216
|
function setTokenCookie(res, token, eKey) {
|
|
1417
1217
|
var cookies_serailized = [];
|
|
1418
|
-
cookies_serailized.push(serialize_1(TOKEN_NAME, token, {
|
|
1218
|
+
cookies_serailized.push(index$4.serialize_1(TOKEN_NAME, token, {
|
|
1419
1219
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1420
1220
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1421
1221
|
//httpOnly: true,
|
|
@@ -1424,7 +1224,7 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1424
1224
|
//sameSite: 'lax',
|
|
1425
1225
|
}));
|
|
1426
1226
|
|
|
1427
|
-
cookies_serailized.push(serialize_1('eKey', eKey, {
|
|
1227
|
+
cookies_serailized.push(index$4.serialize_1('eKey', eKey, {
|
|
1428
1228
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1429
1229
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1430
1230
|
//httpOnly: true,
|
|
@@ -1438,12 +1238,12 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1438
1238
|
|
|
1439
1239
|
function removeTokenCookie(res) {
|
|
1440
1240
|
var cookies_serailized = [];
|
|
1441
|
-
cookies_serailized.push(serialize_1(TOKEN_NAME, '', {
|
|
1241
|
+
cookies_serailized.push(index$4.serialize_1(TOKEN_NAME, '', {
|
|
1442
1242
|
maxAge: -1,
|
|
1443
1243
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1444
1244
|
path: '/'
|
|
1445
1245
|
}));
|
|
1446
|
-
cookies_serailized.push(serialize_1('eKey', '', {
|
|
1246
|
+
cookies_serailized.push(index$4.serialize_1('eKey', '', {
|
|
1447
1247
|
maxAge: -1,
|
|
1448
1248
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1449
1249
|
path: '/'
|
|
@@ -1458,7 +1258,7 @@ function parseCookies(req) {
|
|
|
1458
1258
|
|
|
1459
1259
|
// For pages we do need to parse the cookies.
|
|
1460
1260
|
var cookie = req.headers ? req.headers.cookie : null;
|
|
1461
|
-
return parse_1(cookie || '');
|
|
1261
|
+
return index$4.parse_1(cookie || '');
|
|
1462
1262
|
}
|
|
1463
1263
|
|
|
1464
1264
|
function getTokenCookie(req) {
|