Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/scripts/name_order_test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// node .github/scripts/name_order_test.js — the server's fv3_name_cmp() sorts names as the pages do in the browser
// (localeCompare(b, undefined, {numeric: true, sensitivity: 'base'})): the shipped PHP function against node's ICU on the same names (needs php)
'use strict';
const path = require('path');
const { execFileSync } = require('child_process');
const { check, done, read } = require('./preview_pages_harness.js');
const { check, done, plugin } = require('./preview_pages_harness.js');

// The shipped function, taken from lib.php as written
const fn = read('server/lib.php').match(/^ {4}function fv3_name_cmp\([\s\S]*?\n {4}}\n/m)[0];
const phpSort = (names) => JSON.parse(execFileSync('php', ['-r', `${fn} $l = json_decode(stream_get_contents(STDIN), true); usort($l, 'fv3_name_cmp'); echo json_encode($l);`],
// The shipped lib.order.php, required whole: it defines functions only
const phpSort = (names) => JSON.parse(execFileSync('php', ['-r', `require $argv[1]; $l = json_decode(stream_get_contents(STDIN), true); usort($l, 'fv3_name_cmp'); echo json_encode($l);`,
path.join(plugin, 'server/lib.order.php')],
{ input: JSON.stringify(names), encoding: 'utf8' }));
const browserSort = (names) => names.slice().sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }));

Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/preview_pages_harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,4 @@ const phpServer = (label, { containers = [] } = {}) => {
return { config, server, cleanup: () => fs.rmSync(tmp, { recursive: true, force: true }) };
};

module.exports = { makePage, drawDocker, drawVms, fakeXhr, scriptHelpers, check, done, flush, read, phpServer, FOLDER_SETTINGS };
module.exports = { makePage, drawDocker, drawVms, fakeXhr, scriptHelpers, check, done, flush, read, phpServer, plugin, FOLDER_SETTINGS };
2 changes: 1 addition & 1 deletion .github/unraid-watch/watch.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
{"path": "emhttp/plugins/dynamix.vm.manager/include/VMajax.php", "match": "\\['error' => ",
"why": "answers a refused VM action in `error` (shared.js fv3ActionAnswer)"},
{"path": "emhttp/plugins/dynamix.docker.manager/include/UserPrefs.php", "match": "\\$save\\[\\] = \\$index\\[\\$i\\+\\+\\]\\.\"=\\\\\"\"\\.\\$name\\.\"\\\\\"\"",
"why": "saves the Docker order as N=\"name\" lines, the format the plugin reads and inserts into (lib.php fv3_parse_user_prefs)"}
"why": "saves the Docker order as N=\"name\" lines, the format the plugin reads and inserts into (lib.order.php fv3_parse_user_prefs)"}
],
"styles": {
"themes": ["azure", "black", "gray", "white"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ function fv3_convert_foreign_bundle(array $raw, ?string $onlyType, array $existi
$regex = is_string($src['regex'] ?? null) && strlen($src['regex']) <= 1024 ? $src['regex'] : '';
// A regex present but refused on type or length is left out as much as one that will not compile
if ($regex === '' && $suppliedRegex !== null && $suppliedRegex !== '') $r['dropped_regex']++;
// Same pattern build as syncContainerOrder in lib.php; a regex it can't compile would match nothing
// Same pattern build as fv3_compute_folder_membership in lib.order.php; a regex it can't compile would match nothing
if ($regex !== '' && @preg_match('/' . str_replace('/', '\/', $regex) . '/', '') === false) { $regex = ''; $r['dropped_regex']++; }
// The renderers hand the stored pattern to JS new RegExp(), so one PHP alone accepts
// would place members the page then cannot show — see fv3_foreign_regex_js_safe()
Expand Down
Loading
Loading