Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
module.exports = function parseCacheControl(field) {
|
|
|
|
if (typeof field !== 'string') {
|
|
return null;
|
|
}
|
|
|
|
/*
|
|
Cache-Control = 1#cache-directive
|
|
cache-directive = token [ "=" ( token / quoted-string ) ]
|
|
token = [^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+
|
|
quoted-string = "(?:[^"\\]|\\.)*"
|
|
*/
|
|
|
|
// 1: directive = 2: token 3: quoted-string
|
|
var regex = /(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g;
|
|
|
|
var header = {};
|
|
var err = field.replace(regex, function($0, $1, $2, $3) {
|
|
var value = $2 || $3;
|
|
header[$1] = value ? value.toLowerCase() : true;
|
|
return '';
|
|
});
|
|
|
|
if (header['max-age']) {
|
|
try {
|
|
var maxAge = parseInt(header['max-age'], 10);
|
|
if (isNaN(maxAge)) {
|
|
return null;
|
|
}
|
|
|
|
header['max-age'] = maxAge;
|
|
}
|
|
catch (err) { }
|
|
}
|
|
|
|
return (err ? null : header);
|
|
};
|