|
|
<?php
|
|
|
|
|
|
// Static source graph only: no application boot, database or browser network.
|
|
|
$root = dirname(__DIR__);
|
|
|
$public = $root . '/public/cloud';
|
|
|
$assert = static function ($condition, $message) {
|
|
|
if (!$condition) throw new RuntimeException($message);
|
|
|
};
|
|
|
$entry = $public . '/vendor/novnc/core/rfb.js';
|
|
|
$queue = [$entry];
|
|
|
$seen = [];
|
|
|
while ($queue !== []) {
|
|
|
$file = array_pop($queue);
|
|
|
$resolved = realpath($file);
|
|
|
$assert($resolved !== false && str_starts_with($resolved, realpath($public) . DIRECTORY_SEPARATOR), 'Missing or external noVNC module: ' . $file);
|
|
|
if (isset($seen[$resolved])) continue;
|
|
|
$seen[$resolved] = true;
|
|
|
$source = file_get_contents($resolved);
|
|
|
preg_match_all('/(?:import|export)\s+(?:[^;]*?\s+from\s+)?[\'"]([^\'"]+)[\'"]\s*;/', $source, $imports);
|
|
|
foreach ($imports[1] as $path) {
|
|
|
if (str_starts_with($path, './') || str_starts_with($path, '../')) $queue[] = dirname($resolved) . '/' . $path;
|
|
|
}
|
|
|
}
|
|
|
$assert(count($seen) > 20, 'noVNC dependency graph was not validated');
|
|
|
$assert(is_file($public . '/vendor/novnc/LICENSE.txt'), 'Vendored noVNC license missing');
|
|
|
foreach (['almalinux', 'ubuntu', 'debian', 'centos'] as $system) {
|
|
|
$assert(is_file($public . '/' . $system . '-icon.svg'), 'Local OS icon missing: ' . $system);
|
|
|
}
|
|
|
foreach (['user/layout_header.tpl', 'user/layout_plain_header.tpl', 'auth/layout_header.tpl'] as $template) {
|
|
|
$source = file_get_contents($root . '/resources/views/venix/' . $template);
|
|
|
$assert(str_contains($source, '/cloud/styles.css') && str_contains($source, '/cloud/account.css'), 'Unified user styles missing: ' . $template);
|
|
|
$assert(!str_contains($source, 'user-home.css') && !str_contains($source, '/css/auth.css'), 'Retired user stylesheet still active: ' . $template);
|
|
|
}
|
|
|
$views = $root . '/resources/views/venix';
|
|
|
$cloudShell = file_get_contents($views . '/cloud/page.tpl');
|
|
|
$cloudPages = '';
|
|
|
foreach (glob($views . '/cloud/pages/*.tpl') as $template) {
|
|
|
$cloudPages .= "\n" . file_get_contents($template);
|
|
|
}
|
|
|
$cloudTemplate = $cloudShell . $cloudPages;
|
|
|
$userLayout = file_get_contents($views . '/user/layout_header.tpl');
|
|
|
$sharedSidebar = file_get_contents($views . '/user/panel_sidebar.tpl');
|
|
|
$sharedTopbar = file_get_contents($views . '/user/panel_topbar.tpl');
|
|
|
$clientEntry = file_get_contents($public . '/app.js');
|
|
|
$clientScript = $clientEntry . "\n" . file_get_contents($public . '/runtime.js');
|
|
|
foreach (['instances', 'detail', 'deploy', 'backups', 'iso-images', 'ssh-keys', 'invoices', 'invoice-detail', 'reinstall'] as $module) {
|
|
|
$path = $public . '/' . $module . '.js';
|
|
|
$assert(is_file($path), 'Cloud page module missing: ' . $module);
|
|
|
$clientScript .= "\n" . file_get_contents($path);
|
|
|
}
|
|
|
$invoiceDetailRuntimePath = $public . '/invoice-detail-runtime.js';
|
|
|
$assert(is_file($invoiceDetailRuntimePath),
|
|
|
'Dedicated invoice-detail runtime missing: invoice-detail-runtime.js');
|
|
|
$invoiceDetailModule = file_get_contents($public . '/invoice-detail.js');
|
|
|
$invoiceDetailRuntime = file_get_contents($invoiceDetailRuntimePath);
|
|
|
$clientStyles = file_get_contents($public . '/client.css');
|
|
|
$baseStyles = file_get_contents($public . '/styles.css');
|
|
|
$routes = file_get_contents($root . '/config/routes.php');
|
|
|
$userController = file_get_contents($root . '/app/Controllers/UserController.php');
|
|
|
$cloudPageController = file_get_contents($root . '/app/Controllers/CloudPageController.php');
|
|
|
$deploymentPageService = file_get_contents($root . '/app/Services/Cloud/CloudDeploymentPageService.php');
|
|
|
$deployTemplate = file_get_contents($views . '/cloud/pages/deploy.tpl');
|
|
|
$detailTemplate = file_get_contents($views . '/cloud/pages/detail.tpl');
|
|
|
$reinstallTemplate = file_get_contents($views . '/cloud/pages/reinstall.tpl');
|
|
|
$deployModule = file_get_contents($public . '/deploy.js');
|
|
|
$reinstallModule = file_get_contents($public . '/reinstall.js');
|
|
|
$shopFormScript = file_get_contents($views . '/admin/shop/form_js.tpl');
|
|
|
$templateAdmin = file_get_contents($views . '/admin/cloud/templates.tpl');
|
|
|
$rescueAdmin = file_get_contents($views . '/admin/cloud/rescue.tpl');
|
|
|
$adminScript = file_get_contents($public . '/admin-catalog-runtime.js');
|
|
|
$adminCloudTemplateEntry = file_get_contents(
|
|
|
$public . '/admin-cloud-templates.js'
|
|
|
);
|
|
|
$adminRescueTemplateEntry = file_get_contents(
|
|
|
$public . '/admin-rescue-templates.js'
|
|
|
);
|
|
|
$templateUploadScript = file_get_contents(
|
|
|
$public . '/admin-template-upload.js'
|
|
|
);
|
|
|
$cloudAdminController = file_get_contents($root . '/app/Controllers/CloudAdminController.php');
|
|
|
$cloudRoutes = file_get_contents($root . '/config/routes_cloud.php');
|
|
|
$api = file_get_contents($root . '/app/Controllers/CloudApiController.php');
|
|
|
$middleware = file_get_contents($root . '/app/Middleware/CloudApi.php');
|
|
|
$cloudJobService = file_get_contents($root . '/app/Services/Cloud/CloudJobService.php');
|
|
|
$cloudOperationCatalog = file_get_contents($root . '/app/Services/Cloud/CloudOperationCatalog.php');
|
|
|
$cloudSchema = file_get_contents($root . '/sql/cloud.sql');
|
|
|
$adminBillingTemplate = $views . '/admin/billing.tpl';
|
|
|
$adminBillingScript = $public . '/admin-billing.js';
|
|
|
$adminBillingRuntime = file_get_contents($adminBillingScript);
|
|
|
$invoicePresentationSource = file_get_contents(
|
|
|
$root . '/app/Services/Cloud/CloudInvoicePresentation.php'
|
|
|
);
|
|
|
$billingPresentationCatalog = file_get_contents(
|
|
|
$root . '/app/Services/Cloud/CloudBillingPresentationCatalog.php'
|
|
|
);
|
|
|
$adminInstanceScript = file_get_contents($public . '/admin-instances.js')
|
|
|
. "\n" . file_get_contents($public . '/admin-instance-detail.js');
|
|
|
$adminBillingStyles = $public . '/admin-billing.css';
|
|
|
$adminSharedStyles = file_get_contents($root . '/public/theme/venix/css/admin-home.css');
|
|
|
$templateCatalogService = file_get_contents(
|
|
|
$root . '/app/Services/Cloud/CloudTemplateCatalogService.php');
|
|
|
$templateStateMachine = file_get_contents(
|
|
|
$root . '/app/Services/Cloud/CloudTemplateStateMachine.php');
|
|
|
$assert(str_contains($cloudShell, "file='user/panel_sidebar.tpl'")
|
|
|
&& str_contains($userLayout, "file='user/panel_sidebar.tpl'"), 'Cloud and account pages must share one sidebar partial');
|
|
|
$assert(str_contains($cloudShell, "file='user/panel_topbar.tpl'")
|
|
|
&& str_contains($userLayout, "file='user/panel_topbar.tpl'"), 'Cloud and account pages must share one topbar partial');
|
|
|
$taskDrawerInclude = "{include file='user/task_center_drawer.tpl'}";
|
|
|
$assert(!str_contains($sharedTopbar, $taskDrawerInclude)
|
|
|
&& substr_count($cloudShell, $taskDrawerInclude) === 1
|
|
|
&& strpos($cloudShell, $taskDrawerInclude) > strpos($cloudShell, '</div>\n</div>'),
|
|
|
'The task center drawer must be a body-level cloud shell sibling, never nested in the scrolling main area');
|
|
|
$assert(preg_match('/\.panel-task-drawer:not\(\[open\]\)\s*\{[^}]*display:\s*none[^}]*\}/s',
|
|
|
$clientStyles) === 1,
|
|
|
'The task center drawer must remain hidden without relying on browser dialog defaults');
|
|
|
$assert(preg_match('/\.panel-task-drawer\s*\{(?=[^}]*isolation:\s*isolate)(?=[^}]*z-index:\s*[1-9][0-9]*)[^}]*\}/s',
|
|
|
$clientStyles) === 1,
|
|
|
'The task center drawer fallback must own an isolated layer above the user page');
|
|
|
$assert(preg_match('/\.panel-topbar\s*\{(?=[^}]*position:\s*sticky)(?=[^}]*top:\s*0)(?=[^}]*z-index:\s*[1-9][0-9]*)[^}]*\}/s',
|
|
|
$clientStyles) === 1,
|
|
|
'The shared user topbar must remain visible while the page content scrolls');
|
|
|
$assert(preg_match('/\.main-area\s*>\s*\.content\s+\.template-catalog\s*\{[^}]*isolation:\s*isolate[^}]*\}/s',
|
|
|
$clientStyles) === 1,
|
|
|
'Template picker layers must remain below the sticky shared topbar');
|
|
|
$assert(preg_match('/html\.panel-(?:announcements|task)-open\s+\.panel-topbar\s*\{[^}]*position:\s*fixed[^}]*\}/s',
|
|
|
$clientStyles) === 0,
|
|
|
'Drawer scroll locking must not remove the shared topbar from normal flow');
|
|
|
foreach (['announcements' => 'announcements', 'task' => 'task'] as $drawerClass => $scrollVariable) {
|
|
|
foreach (['topbar', 'sidebar'] as $shellPart) {
|
|
|
$assert(preg_match('/html\.panel-' . $drawerClass . '-open\s+\.panel-' . $shellPart . '\s*\{[^}]*transform:\s*translate3d\(0,\s*calc\(0px\s*-\s*var\(--panel-' . $scrollVariable . '-scroll-top,\s*0px\)\),\s*0\)[^}]*\}/s',
|
|
|
$clientStyles) === 1,
|
|
|
'Opening the ' . $drawerClass . ' drawer after scrolling must retain the desktop ' . $shellPart . ' position');
|
|
|
}
|
|
|
}
|
|
|
$assert(preg_match('/@media\s*\(max-width:\s*960px\)\s*\{[\s\S]*?html\.panel-announcements-open\s+\.panel-topbar\s*\{[^}]*max\(0px,\s*calc\(0px\s*-\s*var\(--panel-announcements-scroll-top,\s*0px\)\s*-\s*65px\)\)[^}]*\}[\s\S]*?html\.panel-task-open\s+\.panel-topbar\s*\{[^}]*max\(0px,\s*calc\(0px\s*-\s*var\(--panel-task-scroll-top,\s*0px\)\s*-\s*65px\)\)[^}]*\}[\s\S]*?html\.panel-announcements-open\s+\.panel-sidebar,\s*html\.panel-task-open\s+\.panel-sidebar\s*\{[^}]*transform:\s*none[^}]*\}/s',
|
|
|
$clientStyles) === 1,
|
|
|
'Mobile drawers must compensate for the 65px mobile sidebar without reviving it');
|
|
|
$assert(!str_contains($cloudShell, '<aside class="sidebar"')
|
|
|
&& !str_contains($userLayout, 'vu-sidebar'), 'A duplicate user sidebar shell remains active');
|
|
|
$assert(str_contains($userLayout, '/cloud/client.css'), 'Account pages must load the shared VM-panel navigation styles');
|
|
|
$assert(str_contains($sharedSidebar, 'mdi-server') && str_contains($sharedSidebar, 'mdi-lifebuoy'), 'Shared sidebar must retain Venix iconography');
|
|
|
$assert(str_contains($clientStyles, '.cloud-sidebar-nav .sidebar-link + .sidebar-link { margin-top: 6px; }'),
|
|
|
'Adjacent sidebar links must retain visual separation when active and hover states meet');
|
|
|
$assert(str_contains($sharedSidebar, '/user/logout') && !str_contains($clientScript, "location.assign('/auth/logout')"), 'Logged-in logout must use the authenticated user route');
|
|
|
$retiredUserPages = [
|
|
|
'/account' => 'index',
|
|
|
'/profile' => 'profile',
|
|
|
'/announcement' => 'announcement',
|
|
|
];
|
|
|
foreach ($retiredUserPages as $route => $method) {
|
|
|
$assert(!str_contains($routes, "get('" . $route . "', 'App\\Controllers\\UserController:" . $method . "')"),
|
|
|
'Retired user page route remains: ' . $route);
|
|
|
$assert(!str_contains($userController, 'public function ' . $method . '('),
|
|
|
'Retired user page controller remains: ' . $method);
|
|
|
}
|
|
|
$assert(!str_contains($routes, "'App\\Controllers\\UserController:bought'")
|
|
|
&& !str_contains($routes, "'App\\Controllers\\UserController:boughtInvoice'")
|
|
|
&& !str_contains($userController, 'public function bought(')
|
|
|
&& !str_contains($userController, 'public function boughtInvoice(')
|
|
|
&& !str_contains($userController, 'public function deleteBoughtGet('),
|
|
|
'Retired user order history handlers remain');
|
|
|
foreach (['index.tpl', 'profile.tpl', 'bought.tpl', 'bought_invoice.tpl', 'announcement.tpl'] as $retiredTemplate) {
|
|
|
$assert(!is_file($views . '/user/' . $retiredTemplate),
|
|
|
'Retired user page template remains: ' . $retiredTemplate);
|
|
|
}
|
|
|
$remainingUserTemplates = '';
|
|
|
foreach (glob($views . '/user/*.tpl') as $template) {
|
|
|
$remainingUserTemplates .= "\n" . file_get_contents($template);
|
|
|
}
|
|
|
$assert(!str_contains($sharedSidebar . $remainingUserTemplates, '/user/account')
|
|
|
&& !str_contains($sharedSidebar . $remainingUserTemplates, '/user/profile')
|
|
|
&& !str_contains($sharedSidebar . $remainingUserTemplates, '/user/bought')
|
|
|
&& !str_contains($sharedSidebar . $remainingUserTemplates, '/user/announcement'),
|
|
|
'A retained user template links to a retired user page');
|
|
|
$assert(str_contains($routes, "'/cloud/invoices'")
|
|
|
&& str_contains($routes, "get('/billing', 'App\\Controllers\\Admin\\CloudPageController:billing')")
|
|
|
&& !str_contains($routes, "'/bought'")
|
|
|
&& is_file($adminBillingTemplate)
|
|
|
&& is_file($adminBillingScript)
|
|
|
&& !is_file($adminBillingStyles),
|
|
|
'Cloud invoices and the unified administrator billing page must replace legacy bought history');
|
|
|
$assert(str_contains($cloudRoutes, "'/admin/billing/invoices'")
|
|
|
&& str_contains($cloudRoutes, "'/admin/billing/invoices/{id:[0-9]+}'")
|
|
|
&& str_contains($cloudRoutes, "'/admin/billing/orders'")
|
|
|
&& str_contains($cloudRoutes, "'/admin/billing/payments'"),
|
|
|
'Unified administrator billing API routes are incomplete');
|
|
|
$assert(str_contains($routes, "'/cloud/instances'")
|
|
|
&& str_contains($routes, "'/cloud/instances/{id:[0-9]+}'")
|
|
|
&& !str_contains($routes, "'/cloud/instances/{id:[0-9]+}/rescue'")
|
|
|
&& str_contains($routes, "'/cloud/deploy'")
|
|
|
&& str_contains($routes, "'/cloud/iso-images'")
|
|
|
&& str_contains($routes, "'/cloud/ssh-keys'")
|
|
|
&& str_contains($routes, "'/cloud/invoices'")
|
|
|
&& str_contains($routes, "'/cloud/invoices/{id:[0-9]+}'"),
|
|
|
'Cloud user pages must have stable first-class routes');
|
|
|
$assert(str_contains($cloudPageController, "'/user/cloud/instances'")
|
|
|
&& str_contains($cloudShell, 'data-cloud-page=')
|
|
|
&& str_contains($clientEntry, "instances: '/cloud/instances.js'")
|
|
|
&& str_contains($clientEntry, 'import(versionedModuleUrl(modulePath))'),
|
|
|
'Cloud route controller and page-module bootstrap contract is incomplete');
|
|
|
$assert(!str_contains($clientScript, 'location.hash')
|
|
|
&& !str_contains($clientScript, 'hashchange')
|
|
|
&& !str_contains($clientScript, 'routeHash')
|
|
|
&& !str_contains($sharedSidebar, '/user/cloud#'),
|
|
|
'Retired hash routing must not remain in the user cloud UI');
|
|
|
$assert(str_contains($clientEntry, "new URL(import.meta.url).searchParams.get('v')")
|
|
|
&& str_contains($clientEntry, 'function versionedModuleUrl(path)')
|
|
|
&& str_contains($clientScript, "versionedModuleUrl('/cloud/runtime.js')")
|
|
|
&& !preg_match('/[?&]v=[0-9]{6,}/', $clientScript),
|
|
|
'Page modules must propagate the asset version to avoid year-long stale module caching');
|
|
|
$assert(substr_count($clientScript, "window.addEventListener('pageshow'") >= 3
|
|
|
&& substr_count($clientScript, 'if (!event.persisted) return;') >= 3
|
|
|
&& substr_count($clientScript, 'startPolling();') >= 6,
|
|
|
'Instance, detail and invoice polling must resume after a browser back-forward cache restore');
|
|
|
$assert(str_contains($baseStyles, '#create-view.workspace-form-page,#reinstall-view.workspace-form-page{width:100%;margin-left:0;margin-right:0}'), 'Create and reinstall pages must align to the full VM-list content width');
|
|
|
$assert(str_contains($baseStyles, '.ssh-key-details small{display:block;margin:0;')
|
|
|
&& str_contains($baseStyles, '.ssh-key-actions .row-button{flex:1}')
|
|
|
&& str_contains($clientScript, "makeElement('small', '', key.fingerprint || '')"),
|
|
|
'Saved SSH keys must not inherit global muted spacing and mobile actions must target the rendered button class');
|
|
|
$assert(str_contains($baseStyles,
|
|
|
'.ssh-key-picker{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,320px));')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.ssh-key-picker .ssh-key-option{display:grid;grid-template-columns:34px minmax(0,1fr) 20px;')
|
|
|
&& str_contains($baseStyles, '.ssh-key-choice-fingerprint{display:block;')
|
|
|
&& str_contains($clientScript,
|
|
|
"const fingerprintLabel = makeElement('small', 'ssh-key-choice-fingerprint'")
|
|
|
&& str_contains($clientScript, "button.dataset.keyId = keyId;")
|
|
|
&& str_contains($clientScript, "button.dataset.keyFingerprint = fingerprint;")
|
|
|
&& str_contains($clientScript, ",指纹 \${fingerprint || '未记录'}")
|
|
|
&& str_contains($clientScript,
|
|
|
"container.querySelectorAll('.ssh-key-option').forEach((option) =>"),
|
|
|
'Deploy and reinstall SSH key choices must stay compact, show fingerprints and update selection in place.');
|
|
|
$assert(str_contains($cloudTemplate, '>实例管理</h1>')
|
|
|
&& str_contains($cloudTemplate, '部署实例</a>'),
|
|
|
'Instance page terminology missing');
|
|
|
$assert(str_contains($sharedSidebar, '>我的实例</span>') && str_contains($sharedSidebar, '>部署实例</span>'), 'Shared sidebar instance terminology missing');
|
|
|
$assert(str_contains($sharedSidebar, 'href="/user/cloud/backups"')
|
|
|
&& str_contains($sharedSidebar, '>云备份</span>')
|
|
|
&& str_contains($cloudShell, "cloud_page == 'backups'")
|
|
|
&& str_contains($clientEntry, "backups: '/cloud/backups.js'"),
|
|
|
'User cloud-backup page must be reachable from the shared navigation and module bootstrap.');
|
|
|
$assert(str_contains($sharedSidebar, 'href="/user/cloud/iso-images"')
|
|
|
&& str_contains($sharedSidebar, '{if !empty($user_iso_enabled)}')
|
|
|
&& str_contains($sharedSidebar, '>ISO 上传</span>')
|
|
|
&& str_contains($cloudShell, "cloud_page == 'isos'")
|
|
|
&& str_contains($clientEntry, "isos: '/cloud/iso-images.js'"),
|
|
|
'User-owned ISO page must be reachable from shared navigation and module bootstrap.');
|
|
|
$regionPosition = strpos($cloudTemplate, 'id="vm-region-picker"');
|
|
|
$linePosition = strpos($cloudTemplate, 'id="vm-line-picker"');
|
|
|
$offerPosition = strpos($cloudTemplate, 'id="vm-offer-picker"');
|
|
|
$sourcePosition = strpos($cloudTemplate, 'id="vm-template-catalog"');
|
|
|
$assert($regionPosition !== false && $linePosition > $regionPosition
|
|
|
&& $offerPosition > $linePosition && $sourcePosition > $offerPosition
|
|
|
&& str_contains($clientScript, 'function renderRegionPicker()')
|
|
|
&& str_contains($clientScript, 'function renderLinePicker()')
|
|
|
&& str_contains($clientScript, 'function renderOfferPicker()')
|
|
|
&& str_contains($clientScript,
|
|
|
"source: state.deployCloudSnapshotKey ? 'deployment_snapshot' : 'cloud'")
|
|
|
&& str_contains($clientScript,
|
|
|
'body.cloud_snapshot_key = state.deployCloudSnapshotKey')
|
|
|
&& !str_contains($clientScript, 'body.backup_id =')
|
|
|
&& str_contains($clientScript, "offer_id: Number(byId('vm-offer').value)")
|
|
|
&& str_contains($clientScript, "automatic_backup: byId('vm-automatic-backup')?.checked === true")
|
|
|
&& !str_contains($deployTemplate, 'host_id')
|
|
|
&& !str_contains($deployTemplate, 'plan_id')
|
|
|
&& !str_contains($clientScript, "body.iso_id")
|
|
|
&& !str_contains($cloudTemplate, 'class="create-source-picker"')
|
|
|
&& !str_contains($cloudTemplate, 'id="vm-iso"')
|
|
|
&& str_contains($clientScript, 'if (!strongPassword(password))')
|
|
|
&& str_contains($clientScript, '/^[\\x21-\\x7e]+$/.test(value)')
|
|
|
&& substr_count($cloudTemplate, 'maxlength="128"') >= 2
|
|
|
&& str_contains($clientScript, 'formBody.inert = true')
|
|
|
&& str_contains($clientScript, 'formBody.inert = false')
|
|
|
&& !str_contains($clientScript, 'body.iso_path ='),
|
|
|
'Deployment must select region, optional line, offer and a global cloud image without exposing placement details.');
|
|
|
$assert(str_contains($deployTemplate, '<label for="vm-name">实例名称</label>')
|
|
|
&& !str_contains($deployTemplate, '实例名称(可选)')
|
|
|
&& !str_contains($deployTemplate, '留空自动生成,例如 vm-k7m4p2')
|
|
|
&& !str_contains($deployTemplate, 'vm- 加 6 位随机编码')
|
|
|
&& !preg_match('/id="vm-name"[^>]*\splaceholder=/', $deployTemplate)
|
|
|
&& !preg_match('/id="vm-name"[^>]*\srequired(?:\s|>)/', $deployTemplate),
|
|
|
'Deployment instance name must remain optional without optional or generated-value helper copy.');
|
|
|
$keyCardsRendererStart = strpos($clientScript, 'function renderKeyCards(kind)');
|
|
|
$keyCardsRendererEnd = strpos($clientScript, 'function flagForCountry(', $keyCardsRendererStart);
|
|
|
$keyCardsRenderer = $keyCardsRendererStart === false || $keyCardsRendererEnd === false
|
|
|
? ''
|
|
|
: substr($clientScript, $keyCardsRendererStart, $keyCardsRendererEnd - $keyCardsRendererStart);
|
|
|
$assert(str_contains($deployTemplate, '<span class="ssh-key-picker-title">SSH 公钥</span>')
|
|
|
&& !str_contains($deployTemplate, 'SSH 公钥(可选)')
|
|
|
&& !str_contains($deployTemplate, '不选公钥也会生成强密码。')
|
|
|
&& str_contains($deployTemplate, '<label for="vm-root-password">初始 root 密码</label>')
|
|
|
&& !str_contains($deployTemplate, '初始 root 密码(可选)')
|
|
|
&& !str_contains($deployTemplate, '留空时生成 32 位完全随机密码')
|
|
|
&& !str_contains($deployTemplate, '自行设置需为 12–128 位')
|
|
|
&& str_contains($keyCardsRenderer, "makeElement('p', 'muted', '暂无公钥,可先到“公钥管理”添加。')")
|
|
|
&& !str_contains($keyCardsRenderer, '不选公钥也会生成强密码。'),
|
|
|
'Deployment credentials must omit optional labels and password-generation helper copy.');
|
|
|
$assert(str_contains($baseStyles, '.ssh-key-picker-title{display:block;color:#34445a;font-size:13px;font-weight:700}')
|
|
|
&& str_contains($baseStyles, '.form-stack label,.field label,.console-password label{font-size:13px;'),
|
|
|
'SSH key picker headings must match the other form label font size.');
|
|
|
$assert(str_contains($reinstallTemplate, 'id="reinstall-template-catalog"')
|
|
|
&& str_contains($reinstallTemplate, '<span class="ssh-key-picker-title">SSH 公钥</span>')
|
|
|
&& str_contains($reinstallTemplate, '<label for="reinstall-root-password">初始 root 密码</label>')
|
|
|
&& str_contains($reinstallTemplate, '<label for="reinstall-confirm-name">输入虚拟机名称以确认重装并处理旧盘 <span>*</span>')
|
|
|
&& !str_contains($reinstallTemplate, '(可选)')
|
|
|
&& !str_contains($reinstallTemplate, '不选公钥也会生成强密码。')
|
|
|
&& !str_contains($reinstallTemplate, '重装将永久清除原系统盘中的全部数据。')
|
|
|
&& !str_contains($reinstallTemplate, '沿用首次创建的公网网络信息')
|
|
|
&& !str_contains($reinstallTemplate, '点击系统图标下方的箭头展开版本')
|
|
|
&& !str_contains($reinstallTemplate, '直接选择“公钥管理”中保存的公钥')
|
|
|
&& !str_contains($reinstallTemplate, '留空时生成 32 位完全随机密码')
|
|
|
&& !str_contains($reinstallTemplate, '请完整输入上方当前名称')
|
|
|
&& !preg_match('/id="reinstall-root-password"[^>]*\splaceholder=/', $reinstallTemplate)
|
|
|
&& !preg_match('/id="reinstall-confirm-name"[^>]*\splaceholder=/', $reinstallTemplate)
|
|
|
&& !str_contains($reinstallTemplate, 'reinstall-template-hint')
|
|
|
&& !str_contains($reinstallTemplate, 'reinstall-root-password-hint')
|
|
|
&& !str_contains($reinstallTemplate, 'reinstall-confirm-hint')
|
|
|
&& !str_contains($clientScript, "text('reinstall-subtitle'")
|
|
|
&& !str_contains($clientScript, "text('reinstall-public-ip'"),
|
|
|
'Reinstall form must retain only its controls without optional labels, helper copy or placeholders.');
|
|
|
$requiredMarker = '<span class="deployment-required-mark" aria-hidden="true">*</span><span class="sr-only">(必选)</span>';
|
|
|
$assert(str_contains($deployTemplate, 'id="deploy-region-title">选择地区' . $requiredMarker . '</h2>')
|
|
|
&& str_contains($deployTemplate, 'id="deploy-offer-title">选择实例规格' . $requiredMarker . '</h2>')
|
|
|
&& str_contains($deployTemplate, '云快照来源{else}选择系统镜像{/if}' . $requiredMarker . '</h2>')
|
|
|
&& substr_count($deployTemplate, $requiredMarker) === 3
|
|
|
&& str_contains($baseStyles, '.deployment-step-heading h2 .deployment-required-mark{margin-left:4px;color:#dc5965;font-size:11px;vertical-align:super}'),
|
|
|
'Region, offer and system headings must expose compact required markers.');
|
|
|
$offerRendererStart = strpos($clientScript, 'function renderOfferPicker()');
|
|
|
$offerRendererEnd = strpos($clientScript, 'async function selectRegion(', $offerRendererStart);
|
|
|
$offerRenderer = $offerRendererStart === false || $offerRendererEnd === false
|
|
|
? ''
|
|
|
: substr($clientScript, $offerRendererStart, $offerRendererEnd - $offerRendererStart);
|
|
|
$assert(str_contains($offerRenderer, "'offer-table-head'")
|
|
|
&& str_contains($offerRenderer, 'formatMemoryGiB(offer.memory_mib)')
|
|
|
&& str_contains($offerRenderer, 'formatTrafficTiB(offer.traffic_tib)')
|
|
|
&& !str_contains($offerRenderer, 'formatUsd(offer.price)')
|
|
|
&& !str_contains($offerRenderer, 'bandwidth_mbps')
|
|
|
&& str_contains($baseStyles, '.offer-option[aria-pressed="true"]::after{content:"✓"')
|
|
|
&& !str_contains($baseStyles, '.offer-option>:nth-child(6)::before{content:"价格"}')
|
|
|
&& !str_contains($deployTemplate, 'offer-option-price')
|
|
|
&& str_contains($deployTemplate, 'id="vm-order-total-price"')
|
|
|
&& !str_contains($cloudTemplate, 'id="vm-plan-summary"')
|
|
|
&& !str_contains($cloudTemplate, 'class="vm-auto-public-pool"')
|
|
|
&& !str_contains($cloudTemplate, 'id="create-cloud-tip"')
|
|
|
&& !str_contains($cloudTemplate, 'id="create-iso-tip"'),
|
|
|
'Deployment offers must use selectable specification rows without obsolete helper panels.');
|
|
|
$assert(str_contains($baseStyles,
|
|
|
'.offer-option:last-of-type{border-bottom:0;border-bottom-right-radius:10px;border-bottom-left-radius:10px}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.offer-option:first-of-type{border-top-left-radius:10px;border-top-right-radius:10px}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.offer-option[aria-pressed="true"]{z-index:1;background:#eef9fa;box-shadow:inset 0 0 0 2px #2eabb4;'),
|
|
|
'Selected offer rows must preserve rounded first/last corners without clipping their inset border.');
|
|
|
$runtimeDeployScript = file_get_contents($public . '/runtime.js');
|
|
|
$selectRegionStart = strpos($runtimeDeployScript, 'async function selectRegion(');
|
|
|
$selectRegionEnd = $selectRegionStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'async function selectLine(', $selectRegionStart);
|
|
|
$selectRegion = $selectRegionStart === false || $selectRegionEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $selectRegionStart, $selectRegionEnd - $selectRegionStart);
|
|
|
$selectLineStart = strpos($runtimeDeployScript, 'async function selectLine(');
|
|
|
$selectLineEnd = $selectLineStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'async function selectOffer(', $selectLineStart);
|
|
|
$selectLine = $selectLineStart === false || $selectLineEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $selectLineStart, $selectLineEnd - $selectLineStart);
|
|
|
$selectOfferStart = strpos($runtimeDeployScript, 'async function selectOffer(');
|
|
|
$selectOfferEnd = $selectOfferStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'async function openCreate(', $selectOfferStart);
|
|
|
$selectOffer = $selectOfferStart === false || $selectOfferEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $selectOfferStart, $selectOfferEnd - $selectOfferStart);
|
|
|
$assert($selectOffer !== ''
|
|
|
&& !str_contains($selectOffer, 'renderOfferPicker();')
|
|
|
&& str_contains($selectOffer,
|
|
|
"byId('vm-offer-picker').querySelectorAll('.offer-option').forEach(button => {")
|
|
|
&& str_contains($selectOffer,
|
|
|
"button.setAttribute('aria-pressed', String(button.dataset.offerId === String(offer.id)));"),
|
|
|
'Selecting an offer must preserve the focused row instead of replacing the offer list.');
|
|
|
$openCreateStart = strpos($runtimeDeployScript, 'async function openCreate(');
|
|
|
$openCreateEnd = $openCreateStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'async function loadGlobalTemplates()', $openCreateStart);
|
|
|
$openCreate = $openCreateStart === false || $openCreateEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $openCreateStart, $openCreateEnd - $openCreateStart);
|
|
|
$openReinstallStart = strpos($runtimeDeployScript, 'async function openReinstall(');
|
|
|
$openReinstallEnd = $openReinstallStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'async function reinstall(', $openReinstallStart);
|
|
|
$openReinstall = $openReinstallStart === false || $openReinstallEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $openReinstallStart, $openReinstallEnd - $openReinstallStart);
|
|
|
$deployHydrationReturn = strpos($openCreate, ' return;');
|
|
|
$deployFallbackRequest = strpos($openCreate, 'Promise.allSettled([');
|
|
|
$reinstallBootstrapStart = strpos($openReinstall,
|
|
|
'if (bootstrap && Array.isArray(bootstrap.templates))');
|
|
|
$reinstallHydrationReturn = $reinstallBootstrapStart === false ? false
|
|
|
: strpos($openReinstall, ' return;', $reinstallBootstrapStart);
|
|
|
$reinstallFallbackRequest = strpos($openReinstall, "api(`/api/v1/resources?vm_id=");
|
|
|
$assert(str_contains($deployTemplate, 'id="deploy-bootstrap" type="application/json"')
|
|
|
&& str_contains($deployTemplate, '{foreach $cloud_deploy_regions as $region}')
|
|
|
&& str_contains($deployTemplate, '{foreach $cloud_deploy_lines as $line}')
|
|
|
&& str_contains($deployTemplate, '{foreach $cloud_deploy_offers as $offer}')
|
|
|
&& str_contains($deployTemplate, '$cloud_deploy_lines_enabled')
|
|
|
&& !str_contains($deployTemplate, 'offer-option-price')
|
|
|
&& str_contains($deployTemplate, '{foreach $cloud_deploy_template_groups as $group}')
|
|
|
&& str_contains($deployTemplate, '{foreach $cloud_deploy_ssh_keys as $key}')
|
|
|
&& !str_contains($deployTemplate, '正在加载系统镜像')
|
|
|
&& !str_contains($deployTemplate, 'host_id')
|
|
|
&& !str_contains($deployTemplate, 'plan_id'),
|
|
|
'Deployment HTML must contain regions, optional lines, offers, images and SSH keys before hydration.');
|
|
|
$assert(str_contains($deploymentPageService, "->join('cloud_resource_pools as pool'")
|
|
|
&& str_contains($deploymentPageService, "->join('cloud_network_lines as line'")
|
|
|
&& !str_contains($deploymentPageService, "->where('offer.stock', '<>', 0)")
|
|
|
&& str_contains($deploymentPageService,
|
|
|
'CloudPlacementService::poolCapacityAvailability(')
|
|
|
&& str_contains($deploymentPageService, "'sellable' =>")
|
|
|
&& str_contains($deploymentPageService, "\$query->where('line.is_default', 1)")
|
|
|
&& str_contains($cloudPageController, '$defaultRegionId = $regions === [] ? 0 : (int) $regions[0][\'id\']')
|
|
|
&& str_contains($cloudPageController, "'default_line_id' => \$defaultLineId")
|
|
|
&& str_contains($cloudPageController, "'cloud_deploy_bootstrap_json' => \$this->safeJson(\$payload)"),
|
|
|
'Deployment SSR must retain sold-out offers, calculate pool availability, and select the first available region and line.');
|
|
|
$assert(str_contains($deployModule, "readBootstrap('deploy-bootstrap')")
|
|
|
&& str_contains($deployModule, "initializeSession('create', bootstrap?.user)")
|
|
|
&& str_contains($deployModule, 'openCreate(bootstrap)')
|
|
|
&& !str_contains($deployModule, '/api/v1/session')
|
|
|
&& !str_contains($deployModule, '/api/v1/plans')
|
|
|
&& !str_contains($deployModule, '/api/v1/resources')
|
|
|
&& !str_contains($deployModule, '/api/v1/ssh-keys'),
|
|
|
'Deployment first paint must hydrate its embedded payload without initial data API requests.');
|
|
|
$assert(str_contains($openCreate, 'Array.isArray(bootstrap.offers)')
|
|
|
&& str_contains($openCreate, 'Array.isArray(bootstrap.regions)')
|
|
|
&& str_contains($openCreate, 'Array.isArray(bootstrap.lines)')
|
|
|
&& str_contains($openCreate, 'Array.isArray(bootstrap.templates)')
|
|
|
&& str_contains($openCreate, 'applySaleCatalog(bootstrap)')
|
|
|
&& str_contains($openCreate, "renderTemplateCatalog('vm-template')")
|
|
|
&& $deployHydrationReturn !== false && $deployFallbackRequest !== false
|
|
|
&& $deployHydrationReturn < $deployFallbackRequest,
|
|
|
'Deployment hydration must use the embedded full catalog and first valid region/line before any compatibility fallback.');
|
|
|
$assert(str_contains($cloudRoutes,
|
|
|
'$this->get(\'/catalog\', \'App\\Controllers\\CloudApiController:catalog\');')
|
|
|
&& !str_contains($cloudRoutes, '$this->get(\'/plans\'')
|
|
|
&& str_contains($openCreate, "api('/api/v1/catalog')")
|
|
|
&& !str_contains($runtimeDeployScript, '/api/v1/plans')
|
|
|
&& !str_contains($runtimeDeployScript, 'payload?.plans'),
|
|
|
'Deployment fallback must use only the public sale-catalog endpoint and response shape.');
|
|
|
$assert(str_contains($reinstallTemplate, 'id="reinstall-bootstrap" type="application/json"')
|
|
|
&& str_contains($reinstallTemplate, '$cloud_reinstall_vm.name')
|
|
|
&& str_contains($reinstallTemplate, '{foreach $cloud_reinstall_template_groups as $group}')
|
|
|
&& str_contains($reinstallTemplate, '{foreach $cloud_reinstall_ssh_keys as $key}')
|
|
|
&& str_contains($reinstallModule, "readBootstrap('reinstall-bootstrap')")
|
|
|
&& str_contains($reinstallModule, "initializeSession('reinstall', bootstrap?.user)")
|
|
|
&& str_contains($reinstallModule, 'selectVmByApiId(document.body.dataset.vmId || \'\', bootstrap?.vm)')
|
|
|
&& str_contains($reinstallModule, 'openReinstall(vm, bootstrap)')
|
|
|
&& !str_contains($reinstallModule, '/api/v1/session')
|
|
|
&& !str_contains($reinstallModule, '/api/v1/resources')
|
|
|
&& !str_contains($reinstallModule, '/api/v1/ssh-keys')
|
|
|
&& str_contains($openReinstall, 'Array.isArray(bootstrap.templates)')
|
|
|
&& $reinstallHydrationReturn !== false && $reinstallFallbackRequest !== false
|
|
|
&& $reinstallHydrationReturn < $reinstallFallbackRequest,
|
|
|
'Reinstall HTML must embed VM, image and key data and hydrate without initial data API requests.');
|
|
|
$assert($selectRegion !== '' && $selectLine !== '' && $selectOffer !== ''
|
|
|
&& !str_contains($selectRegion, 'resetInstallChoices()')
|
|
|
&& str_contains($selectRegion, "renderTemplateCatalog('vm-template')")
|
|
|
&& !str_contains($selectRegion, 'loadGlobalTemplates(')
|
|
|
&& !str_contains($selectRegion, "byId('vm-template').value")
|
|
|
&& !str_contains($selectLine, 'resetInstallChoices()')
|
|
|
&& str_contains($selectLine, "renderTemplateCatalog('vm-template')")
|
|
|
&& !str_contains($selectLine, 'loadGlobalTemplates(')
|
|
|
&& !str_contains($selectLine, "byId('vm-template').value")
|
|
|
&& !str_contains($selectOffer, 'resetInstallChoices()')
|
|
|
&& str_contains($selectOffer, "renderTemplateCatalog('vm-template')")
|
|
|
&& !str_contains($selectOffer, 'loadGlobalTemplates(')
|
|
|
&& !str_contains($selectOffer, "byId('vm-template').value"),
|
|
|
'Changing regions, lines or offers must immediately revalidate the image against the selected offer.');
|
|
|
$catalogRendererStart = strpos($runtimeDeployScript, 'function renderTemplateCatalog(inputId)');
|
|
|
$catalogRendererEnd = $catalogRendererStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'async function initializeSession(', $catalogRendererStart);
|
|
|
$catalogRenderer = $catalogRendererStart === false || $catalogRendererEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $catalogRendererStart,
|
|
|
$catalogRendererEnd - $catalogRendererStart);
|
|
|
$mobileDeploymentStylesStart = strpos($baseStyles, '@media(max-width:510px){.deployment-step');
|
|
|
$mobileDeploymentStyles = $mobileDeploymentStylesStart === false ? ''
|
|
|
: substr($baseStyles, $mobileDeploymentStylesStart);
|
|
|
$cardVersionRule = strpos($baseStyles,
|
|
|
'.template-version-option{width:100%;display:grid;gap:3px;');
|
|
|
$flatVersionRule = strpos($baseStyles,
|
|
|
'.template-version-option{min-height:44px;padding:11px 4px;border:0;');
|
|
|
$assert(str_contains($mobileDeploymentStyles,
|
|
|
'.offer-option{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:auto auto;gap:12px 8px;min-height:108px;')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.offer-option-name{grid-column:1/5;grid-row:1;align-self:center;padding-right:31px;font-size:14px}')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.offer-option-value{display:grid;grid-row:2;gap:4px;white-space:normal}')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.offer-option>:nth-child(2){grid-column:1}.offer-option>:nth-child(3){grid-column:2}.offer-option>:nth-child(4){grid-column:3}.offer-option>:nth-child(5){grid-column:4}')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.offer-option[aria-pressed="true"]{box-shadow:none}')
|
|
|
&& !str_contains($mobileDeploymentStyles, 'box-shadow:inset 4px 0 0')
|
|
|
&& !str_contains($mobileDeploymentStyles, '.offer-option-price')
|
|
|
&& !str_contains($mobileDeploymentStyles,
|
|
|
'.offer-option{grid-template-columns:repeat(2,minmax(0,1fr))'),
|
|
|
'Mobile deployment offers must use a compact two-row comparison layout without replacing semantic offer buttons.');
|
|
|
$assert(str_contains($baseStyles,
|
|
|
'.template-catalog{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));align-items:start;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-card{position:relative;z-index:1;')
|
|
|
&& str_contains($baseStyles, 'background:#fff;overflow:visible;transition:')
|
|
|
&& str_contains($baseStyles, '.template-family-card[open]{z-index:20;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-versions{position:absolute;top:calc(100% + 8px);left:0;right:0;z-index:30;')
|
|
|
&& str_contains($baseStyles, 'max-height:min(260px,50vh);')
|
|
|
&& str_contains($baseStyles, 'overflow-y:auto;')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-card{height:140px;min-height:140px;border:1px solid #dce7ec;border-radius:12px;background:#fff;overflow:hidden;box-shadow:none}')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-summary{height:100%;min-height:100%;border:0;border-radius:inherit;background:transparent}')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-card[open]{z-index:70;border-color:#a8dadd;box-shadow:')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-card.has-selection{border-color:#2eabb4;background:#f5fbfb}')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-versions{position:absolute;inset:0;z-index:80;width:auto;height:auto;max-height:none;margin:0;')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'padding:6px 8px 40px;overflow-y:auto;border:0;border-radius:inherit;background:#fbfdfd;box-shadow:none;')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-card[open] .template-family-footer{position:absolute;right:7px;bottom:7px;z-index:90;width:32px;min-height:32px;')
|
|
|
&& str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-card[open] .template-family-selection{display:none}')
|
|
|
&& str_contains($mobileDeploymentStyles, 'overscroll-behavior:contain;')
|
|
|
&& !str_contains($mobileDeploymentStyles,
|
|
|
'.template-versions{position:fixed;')
|
|
|
&& !str_contains($mobileDeploymentStyles,
|
|
|
'.template-versions{position:relative;')
|
|
|
&& !str_contains($mobileDeploymentStyles, 'width:calc(200%')
|
|
|
&& !str_contains($mobileDeploymentStyles, 'left:calc(-100%')
|
|
|
&& !str_contains($mobileDeploymentStyles,
|
|
|
'.template-family-card:nth-child(even) .template-versions')
|
|
|
&& !str_contains($baseStyles, 'width:min(280px,calc(100vw - 66px))')
|
|
|
&& str_contains($baseStyles, '.template-versions{gap:0;padding:5px 12px}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-version-option{min-height:44px;padding:11px 4px;border:0;border-bottom:1px solid #e4ecef;border-radius:0;background:transparent;box-shadow:none;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-version-option[aria-pressed="true"]{border-color:#e4ecef;background:#eaf8f8;box-shadow:none;')
|
|
|
&& $cardVersionRule !== false && $flatVersionRule !== false
|
|
|
&& $flatVersionRule > $cardVersionRule
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-card.has-selection{border-color:#2eabb4;background:#f5fbfb}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-selected-mark{position:absolute;top:10px;right:10px;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-card.has-selection .template-family-selected-mark{display:grid}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-summary{display:flex;align-items:center;flex-direction:column;gap:6px;min-height:152px;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'list-style:none;-webkit-tap-highlight-color:transparent}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-icon{display:flex;align-items:center;justify-content:center;width:58px;height:58px;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-footer{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:25px;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-arrow{display:block;flex:none;width:8px;height:8px;border-right:2px solid #718795;border-bottom:2px solid #718795;')
|
|
|
&& str_contains($baseStyles, '.template-family-selection{display:block;')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-selection:empty{display:none}')
|
|
|
&& !str_contains($baseStyles,
|
|
|
'.template-family-selection:empty::before{content:"选择版本"}')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.template-family-summary{min-height:140px;padding:13px 8px 10px}')
|
|
|
&& str_contains($deployTemplate, 'name="vm-template-family"')
|
|
|
&& str_contains($reinstallTemplate, 'name="reinstall-template-family"')
|
|
|
&& str_contains($deployTemplate, 'class="template-family-footer"')
|
|
|
&& str_contains($reinstallTemplate, 'class="template-family-footer"')
|
|
|
&& str_contains($deployTemplate, 'class="template-family-selected-mark" aria-hidden="true"')
|
|
|
&& str_contains($reinstallTemplate, 'class="template-family-selected-mark" aria-hidden="true"')
|
|
|
&& !str_contains($deployTemplate, '⌄')
|
|
|
&& !str_contains($reinstallTemplate, '⌄')
|
|
|
&& str_contains($deployTemplate, 'class="template-family-selection" aria-hidden="true"')
|
|
|
&& str_contains($reinstallTemplate, 'class="template-family-selection" aria-hidden="true"'),
|
|
|
'Image cards must stay fixed while mobile version menus scroll inside the selected card.');
|
|
|
$assert($catalogRenderer !== ''
|
|
|
&& str_contains($runtimeDeployScript, 'function bindTemplateVersionMenu(card, container)')
|
|
|
&& str_contains($runtimeDeployScript, 'const TEMPLATE_FAMILY_ORDER = new Map([')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'["AlmaLinux", 0], ["Debian", 1], ["CentOS Stream", 2], ["Ubuntu", 3]')
|
|
|
&& str_contains($runtimeDeployScript, 'function compareTemplateVersions(left, right)')
|
|
|
&& str_contains($runtimeDeployScript, '(?:\\.[0-9]+){0,2}$')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'function updateTemplateFamilySelection(card, selectedName = "", selectedVersion = "")')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'container.querySelectorAll(".template-family-card[open]")')
|
|
|
&& str_contains($runtimeDeployScript, 'if (other !== card) other.open = false;')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'summary?.setAttribute("aria-label", `${family},收起版本列表`);')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'card.querySelector(\'.template-version-option[aria-pressed="true"]\')')
|
|
|
&& str_contains($runtimeDeployScript, 'option?.focus({ preventScroll: true });')
|
|
|
&& str_contains($catalogRenderer,
|
|
|
'card.setAttribute("name", `${inputId}-family`);')
|
|
|
&& str_contains($catalogRenderer, 'card.open = opened.has(family);')
|
|
|
&& str_contains($catalogRenderer,
|
|
|
'const orderedGroups = Array.from(groups.entries()).sort')
|
|
|
&& str_contains($catalogRenderer,
|
|
|
'entries.sort((a, b) => compareTemplateVersions(b.version, a.version)')
|
|
|
&& !str_contains($catalogRenderer, 'card.open = opened.has(family) ||')
|
|
|
&& str_contains($catalogRenderer, 'card.open = false;')
|
|
|
&& str_contains($catalogRenderer, 'summary.focus({ preventScroll: true });')
|
|
|
&& str_contains($catalogRenderer, 'const footer = makeElement("span", "template-family-footer");')
|
|
|
&& str_contains($catalogRenderer, 'const selectedMark = makeElement("span", "template-family-selected-mark", "✓");')
|
|
|
&& str_contains($catalogRenderer, 'selectedMark.setAttribute("aria-hidden", "true");')
|
|
|
&& str_contains($catalogRenderer, 'footer.append(selection, arrow);')
|
|
|
&& str_contains($catalogRenderer,
|
|
|
'summary.append(selectedMark, icon, makeElement("strong", "", family), footer);')
|
|
|
&& !str_contains($catalogRenderer, '"⌄"')
|
|
|
&& str_contains($catalogRenderer, 'familyCard === card ? name : "", familyCard === card ? version : "");')
|
|
|
&& str_contains($catalogRenderer, 'selectedEntry?.version || "");')
|
|
|
&& str_contains($catalogRenderer, 'card.append(summary, versions);')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'label.textContent = selected ? versionLabel : "";')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'? `${family},已选择 ${selectedName},展开更改版本`')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'if (event.key !== "Escape") return;')
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'!event.target.closest(".template-family-card")')
|
|
|
&& substr_count($runtimeDeployScript,
|
|
|
'document.addEventListener("click", (event) => {') === 1
|
|
|
&& substr_count($runtimeDeployScript,
|
|
|
'document.addEventListener("keydown", (event) => {') === 1
|
|
|
&& substr_count($runtimeDeployScript,
|
|
|
'document.addEventListener("focusin", (event) => {') === 1
|
|
|
&& str_contains($runtimeDeployScript,
|
|
|
'openCard.contains(event.target)'),
|
|
|
'Image version menus must be single-open, dismissible, and close after selection.');
|
|
|
$availabilityStart = strpos($runtimeDeployScript, 'function updateCreateAvailability()');
|
|
|
$availabilityEnd = $availabilityStart === false ? false
|
|
|
: strpos($runtimeDeployScript, 'function strongPassword(', $availabilityStart);
|
|
|
$availability = $availabilityStart === false || $availabilityEnd === false ? ''
|
|
|
: substr($runtimeDeployScript, $availabilityStart, $availabilityEnd - $availabilityStart);
|
|
|
$assert(str_contains($availability, 'const offer = selectedSaleOffer()')
|
|
|
&& str_contains($availability,
|
|
|
'const validTemplate = deploymentTemplates().some(')
|
|
|
&& str_contains($availability,
|
|
|
'const validMedia = Boolean(state.deployCloudSnapshotKey || validTemplate)')
|
|
|
&& !str_contains($availability, 'state.resources'),
|
|
|
'Deployment submission must require a matching region/line/offer and offer-scoped image.');
|
|
|
$assert(str_contains($baseStyles, '.deployment-step')
|
|
|
&& str_contains($baseStyles, '.region-option')
|
|
|
&& str_contains($baseStyles, '.line-option')
|
|
|
&& str_contains($baseStyles, '.offer-option')
|
|
|
&& str_contains($baseStyles, '.user-iso-row'),
|
|
|
'Region/line/offer deployment and personal ISO pages must retain VM-panel styling.');
|
|
|
$assert(!str_contains($cloudTemplate, '购买并开通') && !str_contains($sharedSidebar, '我的虚拟机'), 'Retired VM sales labels remain');
|
|
|
$assert(!str_contains($shopFormScript, 'data.hosts')
|
|
|
&& !str_contains($shopFormScript, "'host_id'")
|
|
|
&& !str_contains($shopFormScript, "'price'")
|
|
|
&& !str_contains($shopFormScript, "'stock'"),
|
|
|
'Base-plan editor must not load hosts or submit offer-owned placement, price, or stock fields.');
|
|
|
$assert(preg_match('/<input id="template-sha256"([^>]*)>/', $templateAdmin, $shaInput) === 1
|
|
|
&& !str_contains($shaInput[1], 'required'), 'Cloud image SHA-256 must be optional');
|
|
|
$assert(str_contains($templateAdmin, 'AlmaLinux 8/9/10')
|
|
|
&& str_contains($templateAdmin, 'Debian 11/12/13')
|
|
|
&& str_contains($templateAdmin, 'CentOS Stream 9/10')
|
|
|
&& str_contains($templateAdmin, 'Ubuntu 20.04 至 26.04')
|
|
|
&& str_contains($templateAdmin, '官方 HTTPS 文件地址')
|
|
|
&& str_contains($templateAdmin, '通过公网安全校验的跳转链')
|
|
|
&& str_contains($templateAdmin, 'accept=".qcow2,application/octet-stream"')
|
|
|
&& str_contains($templateAdmin, '不含 backing file 的独立 QCOW2'),
|
|
|
'Cloud image guidance must cover every supported official distribution and file format.');
|
|
|
$assert(str_contains($runtimeDeployScript, 'centosstream: "CentOS Stream"')
|
|
|
&& str_contains($runtimeDeployScript, '"CentOS Stream": "/cloud/centos-icon.svg"')
|
|
|
&& str_contains($runtimeDeployScript, 'debian: "Debian"')
|
|
|
&& str_contains($runtimeDeployScript, 'ubuntu: "Ubuntu"')
|
|
|
&& str_contains($runtimeDeployScript, '/^[0-9]+(?:\\.[0-9]+){0,2}$/'),
|
|
|
'Cloud image family icons or dotted Ubuntu versions are not mapped correctly.');
|
|
|
$importStart = strpos($adminScript, 'async function importTemplate(');
|
|
|
$importEnd = $importStart === false ? false
|
|
|
: strpos($adminScript, 'async function importRescue(', $importStart);
|
|
|
$importScript = $importStart === false || $importEnd === false ? ''
|
|
|
: substr($adminScript, $importStart, $importEnd - $importStart);
|
|
|
$assert(!str_contains($templateAdmin, 'catalog-host')
|
|
|
&& str_contains($templateAdmin, '所有可售地区共用的 cloud-init 系统镜像目录')
|
|
|
&& !str_contains($rescueAdmin, 'id="catalog-host"')
|
|
|
&& !str_contains($rescueAdmin, 'type="file"')
|
|
|
&& str_contains($rescueAdmin, 'id="rescue-import"')
|
|
|
&& str_contains($rescueAdmin, 'id="rescue-url"')
|
|
|
&& str_contains($rescueAdmin, 'id="rescue-sha256"')
|
|
|
&& str_contains($rescueAdmin, '维护全局救援 ISO 目录')
|
|
|
&& str_contains($adminScript, "expectedKind === 'templates'")
|
|
|
&& str_contains($adminCloudTemplateEntry, "initialize('templates')")
|
|
|
&& str_contains($adminRescueTemplateEntry, "initialize('rescue')"),
|
|
|
'Cloud images and rescue ISOs must use global catalogs without a host selector.');
|
|
|
$assert(str_contains($importScript, 'if (sha256) body.sha256 = sha256;')
|
|
|
&& str_contains($importScript,
|
|
|
"/api/v1/admin/cloud-template-imports/remote")
|
|
|
&& str_contains($importScript, 'idempotencyKey: record.requestKey')
|
|
|
&& str_contains($importScript, 'timeoutMs: 3600000')
|
|
|
&& !str_contains($importScript, 'host_id')
|
|
|
&& !str_contains($importScript, 'catalog-host'),
|
|
|
'Global cloud image imports must omit blank SHA-256 and all host selectors.');
|
|
|
$assert(str_contains($templateAdmin, 'id="template-upload"')
|
|
|
&& str_contains($templateAdmin, 'id="template-upload-system"')
|
|
|
&& str_contains($templateAdmin, 'id="template-upload-file"')
|
|
|
&& str_contains($templateAdmin, 'accept=".qcow2,application/octet-stream"')
|
|
|
&& str_contains($templateAdmin, '不含 backing file')
|
|
|
&& str_contains($templateAdmin, '最大 4 GiB'),
|
|
|
'Cloud template admin must offer a constrained local QCOW2 upload form.');
|
|
|
$assert(str_contains($templateUploadScript,
|
|
|
"file.name.toLowerCase().endsWith('.qcow2')")
|
|
|
&& str_contains($templateUploadScript, '4 * 1024 ** 3')
|
|
|
&& str_contains($templateUploadScript, 'os_family: osFamily')
|
|
|
&& str_contains($templateUploadScript, 'os_version: osVersion')
|
|
|
&& str_contains($templateUploadScript,
|
|
|
"request.open('PUT', parsed.href, true)")
|
|
|
&& str_contains($templateUploadScript,
|
|
|
"request.getResponseHeader('ETag')")
|
|
|
&& str_contains($templateUploadScript,
|
|
|
'/api/v1/admin/cloud-template-imports')
|
|
|
&& str_contains($templateUploadScript,
|
|
|
'/cloud-template-imports/${encodeURIComponent(intent.id)}/resume')
|
|
|
&& !str_contains($adminScript, '/api/v1/admin/cloud-templates/upload?'),
|
|
|
'Browser QCOW2 upload must use resumable direct multipart storage with progress.');
|
|
|
$rescueImportStart = strpos($adminScript, 'async function importRescue(');
|
|
|
$rescueImportEnd = $rescueImportStart === false ? false
|
|
|
: strpos($adminScript, 'async function initialize(', $rescueImportStart);
|
|
|
$rescueImportScript = $rescueImportStart === false || $rescueImportEnd === false
|
|
|
? '' : substr(
|
|
|
$adminScript,
|
|
|
$rescueImportStart,
|
|
|
$rescueImportEnd - $rescueImportStart
|
|
|
);
|
|
|
$assert(str_contains($rescueImportScript, 'if (sha256) body.sha256 = sha256;')
|
|
|
&& str_contains($rescueImportScript, "parsed.protocol !== 'https:'")
|
|
|
&& str_contains($rescueImportScript, "parsed.pathname.toLowerCase().endsWith('.iso')")
|
|
|
&& str_contains($rescueImportScript, "api(catalogPath(), { method: 'POST', body })")
|
|
|
&& str_contains($rescueImportScript, 'validation_scheduled === true')
|
|
|
&& !str_contains($rescueImportScript, 'host_id')
|
|
|
&& !str_contains($rescueImportScript, 'rescue-file'),
|
|
|
'Global rescue ISO import must be HTTPS-only and independent of browser file uploads or host selection.');
|
|
|
$assert(str_contains($cloudAdminController,
|
|
|
'CloudRescueCatalogService::adminCatalog()')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'CloudRescueCatalogService::importRemote(')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'CloudRescueTemplateReplicaCoordinator::beginValidation(')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'CloudRescueTemplateReplicaCoordinator::syncHost(')
|
|
|
&& str_contains($cloudRoutes,
|
|
|
'/admin/rescue-templates/{id}/replicas/{host_id:[1-9][0-9]*}/repair')
|
|
|
&& str_contains($adminScript,
|
|
|
'/api/v1/admin/rescue-templates/${encodeURIComponent(entry.id)}/replicas/')
|
|
|
&& str_contains($adminScript,
|
|
|
'expected_revision: Number(entry.revision)')
|
|
|
&& str_contains($adminScript,
|
|
|
"generation_token: String(entry.generation_token || '')"),
|
|
|
'Global rescue catalog must expose exact host replicas, repair, and revisioned retirement.');
|
|
|
$assert(str_contains($api,
|
|
|
'CloudRescueCatalogService::publicCatalogForHost($hostId)')
|
|
|
&& str_contains($api, "\$public['rescue_catalog_status']")
|
|
|
&& str_contains($detailTemplate, 'id="rescue-catalog-status"')
|
|
|
&& str_contains($clientScript, 'rescueStatusReachable')
|
|
|
&& str_contains($clientScript, 'Promise.allSettled([')
|
|
|
&& str_contains($clientScript, '当前宿主机已精确校验')
|
|
|
&& str_contains($baseStyles,
|
|
|
'.rescue-catalog-status[data-state="host_unavailable"]'),
|
|
|
'User rescue UI must expose only exact host-ready entries and retain a useful status when the Agent is unavailable.');
|
|
|
$assert(str_contains($cloudRoutes,
|
|
|
"'/admin/cloud-template-imports/remote'")
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'public function cloudTemplateImportRemote(')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'(new CloudTemplateRemoteAcquisition())->importRemote(')
|
|
|
&& !str_contains($cloudRoutes, '/admin/cloud-templates/upload')
|
|
|
&& !str_contains($cloudAdminController, 'CloudLocalUploadService')
|
|
|
&& !str_contains($cloudRoutes, '/admin/rescue-templates/upload')
|
|
|
&& !str_contains($cloudRoutes, '/api/internal/cloud/upload-staging/')
|
|
|
&& !str_contains($cloudAdminController,
|
|
|
'尚未实现云镜像二进制上传,目录未修改'),
|
|
|
'QCOW2 upload must publish without the retired rescue upload transport.');
|
|
|
$assert(str_contains($cloudRoutes, "['PATCH', 'DELETE']")
|
|
|
&& str_contains($adminScript, '删除全局云镜像模板')
|
|
|
&& str_contains($adminScript, "method: 'DELETE'")
|
|
|
&& str_contains($templateAdmin, '已经创建的实例使用独立克隆磁盘')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'CloudTemplateCatalogService::adminCatalog()')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'CloudTemplateCatalogService::rename(')
|
|
|
&& str_contains($cloudAdminController,
|
|
|
'CloudTemplateCatalogService::delete(')
|
|
|
&& str_contains($adminScript, 'expected_revision: Number(entry.revision)')
|
|
|
&& str_contains($adminScript,
|
|
|
'generation_token: String(entry.generation_token || \'\')'),
|
|
|
'Global cloud templates must expose a revisioned PHP-owned admin catalog.');
|
|
|
$assert(str_contains($cloudSchema, 'CREATE TABLE cloud_templates')
|
|
|
&& str_contains($cloudSchema, 'generation_token CHAR(32)')
|
|
|
&& str_contains($cloudSchema, 'startup_script MEDIUMTEXT NOT NULL')
|
|
|
&& !str_contains($cloudSchema, 'cloud_template_retirements')
|
|
|
&& !str_contains($cloudSchema, 'cloud_template_catalog_locks')
|
|
|
&& str_contains($templateCatalogService, 'lockForUpdate()')
|
|
|
&& str_contains($templateCatalogService,
|
|
|
"CloudTemplateStateMachine::moveTemplate(\$template, 'retired')")
|
|
|
&& is_string($templateStateMachine)
|
|
|
&& str_contains($templateStateMachine, 'TEMPLATE_TRANSITIONS')
|
|
|
&& str_contains($deploymentPageService, 'CloudTemplateCatalogService::publicCatalog()'),
|
|
|
'Template catalog must use the fresh PHP schema and CAS retirement boundary.');
|
|
|
$assert(str_contains($clientScript,
|
|
|
"makeElement('div', 'cloud-order-actions cloud-invoice-list-actions')")
|
|
|
&& str_contains($clientStyles, '.cloud-orders { min-height: 0;'),
|
|
|
'Billing records must use grouped actions without inheriting the inventory minimum height');
|
|
|
$assert(str_contains($cloudTemplate, 'data-detail-tab="operations"')
|
|
|
&& str_contains($cloudTemplate, 'data-detail-tab="performance"')
|
|
|
&& !str_contains($cloudTemplate, 'data-detail-tab="traffic"')
|
|
|
&& str_contains($cloudTemplate, 'data-detail-tab="operations-log"')
|
|
|
&& str_contains($cloudTemplate, 'data-detail-tab="settings"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-form="hostname"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-form="password"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-form="ssh_key"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-tab="hostname"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-tab="password"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-tab="ssh_key"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-tab="snapshots"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-panel="hostname"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-panel="password"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-panel="ssh_key"')
|
|
|
&& str_contains($cloudTemplate, 'data-instance-setting-panel="snapshots"')
|
|
|
&& !str_contains($cloudTemplate, 'class="vm-settings-grid"')
|
|
|
&& !str_contains($cloudTemplate, 'class="vm-settings-card"')
|
|
|
&& str_contains($cloudTemplate, '>使用记录</button>')
|
|
|
&& str_contains($cloudTemplate, 'class="vm-usage-sections"')
|
|
|
&& str_contains($cloudTemplate, 'vm-traffic-daily'),
|
|
|
'VM details must expose operations, usage records and operation log tabs, with traffic content merged into usage records');
|
|
|
$assert(str_contains($cloudRoutes, "'/vms/{id:[0-9]+}/operations'")
|
|
|
&& str_contains($cloudRoutes, "'/vms/{id}/settings'")
|
|
|
&& str_contains($api, 'public function operationLogs(')
|
|
|
&& str_contains($api, 'public function settings(')
|
|
|
&& str_contains($middleware, '/api/v1/vms/[0-9]+/operations$#D')
|
|
|
&& str_contains($cloudJobService, "'total_pages' => \$pages"),
|
|
|
'VM operation logs must use a bounded PHP database-only API route');
|
|
|
$assert(str_contains($cloudTemplate, 'vm-operation-log-header')
|
|
|
&& str_contains($cloudTemplate, 'vm-operation-log-footer')
|
|
|
&& str_contains($clientScript, 'operationLogsPage')
|
|
|
&& str_contains($cloudTemplate,
|
|
|
'记录这台实例的电源、重装、设置、网络、防火墙、快照和救援操作。')
|
|
|
&& str_contains($cloudJobService,
|
|
|
'CloudOperationCatalog::instanceLogKinds()'),
|
|
|
'VM operation logs must remain a compact three-column paginated list');
|
|
|
$assert(is_string($cloudOperationCatalog)
|
|
|
&& str_contains($cloudOperationCatalog, "'network_change' => '更换公网 IP'")
|
|
|
&& str_contains($cloudOperationCatalog, "'poweroff' => '强制断电'")
|
|
|
&& str_contains($cloudJobService, 'CloudOperationCatalog::isPowerAction')
|
|
|
&& str_contains($clientScript, 'action_label')
|
|
|
&& !str_contains($clientScript, 'POWER_ACTION_LABELS')
|
|
|
&& !str_contains($clientScript, 'function jobKind(')
|
|
|
&& str_contains($adminBillingRuntime, 'task.kind_label')
|
|
|
&& str_contains($adminInstanceScript, 'job.kind_label'),
|
|
|
'Panel task labels must come from the canonical PHP operation catalog without client-side action maps.');
|
|
|
$assert(str_contains($clientScript, '/traffic/daily?days=30')
|
|
|
&& str_contains($cloudTemplate, '最近 30 天每日流量')
|
|
|
&& str_contains($clientScript, "const VM_DETAIL_TABS = ['operations', 'performance', 'operations-log', 'settings']")
|
|
|
&& str_contains($clientScript, '/settings')
|
|
|
&& str_contains($clientScript, 'password_available')
|
|
|
&& str_contains($clientScript, "state.detailTab === \"performance\""),
|
|
|
'VM usage records must load and display daily traffic history alongside performance data');
|
|
|
$assert(str_contains($clientScript, 'function setInstanceSettingTab(')
|
|
|
&& str_contains($clientScript, "document.querySelectorAll('[data-instance-setting-tab]')")
|
|
|
&& str_contains($clientScript, "document.querySelectorAll('[data-instance-setting-panel]')")
|
|
|
&& str_contains($clientScript, "window.matchMedia('(max-width: 740px)')")
|
|
|
&& str_contains($cloudTemplate, 'aria-orientation="vertical"')
|
|
|
&& str_contains($baseStyles, '.vm-settings-layout{display:grid;grid-template-columns:')
|
|
|
&& str_contains($baseStyles, '.vm-settings-navigation-button.active{')
|
|
|
&& !str_contains($baseStyles, '.vm-settings-card{')
|
|
|
&& !str_contains($baseStyles, '.vm-settings-grid{')
|
|
|
&& str_contains($clientScript, "if (settingsHostname) settingsHostname.textContent"),
|
|
|
'Instance settings must use a two-column navigation layout without the retired card grid.');
|
|
|
$assert(str_contains($detailTemplate, 'id="vm-snapshot-create-form"')
|
|
|
&& str_contains($detailTemplate, 'id="vm-snapshot-list"')
|
|
|
&& str_contains($detailTemplate, 'id="vm-snapshot-empty"')
|
|
|
&& str_contains($detailTemplate, 'QGA)可用时会短暂冻结文件系统')
|
|
|
&& str_contains($detailTemplate, '快照不包含内存')
|
|
|
&& str_contains($detailTemplate, '每份会按系统盘容量预留空间')
|
|
|
&& str_contains($detailTemplate, '保留快照期间不能重装系统')
|
|
|
&& str_contains($detailTemplate, '不回滚账单、服务周期、公网 IP 或当前登录设置')
|
|
|
&& str_contains($detailTemplate, 'QEMU Guest Agent(QGA)')
|
|
|
&& str_contains($detailTemplate, '确认 QGA 不可用时会自动改用崩溃一致')
|
|
|
&& str_contains($detailTemplate, '自动(优先文件系统一致)')
|
|
|
&& str_contains($detailTemplate, 'value="filesystem" selected')
|
|
|
&& str_contains($detailTemplate, 'value="crash"')
|
|
|
&& str_contains($clientScript, 'const SNAPSHOT_LIMIT = 2;')
|
|
|
&& str_contains($clientScript, 'function loadVmSnapshots(')
|
|
|
&& str_contains($clientScript, "if (tab === 'snapshots') {")
|
|
|
&& str_contains($clientScript, 'void loadVmSnapshots(vmId, true)')
|
|
|
&& str_contains($clientScript, 'function pollSnapshotJob(')
|
|
|
&& str_contains($clientScript, 'const handle = watchTask(receipt')
|
|
|
&& str_contains($clientScript, 'onTerminal: task =>')
|
|
|
&& !str_contains($clientScript, 'attempt < 120 ? 5000 : 15000')
|
|
|
&& str_contains($clientScript, '/snapshots/${encodeURIComponent(key)}/restore`')
|
|
|
&& str_contains($clientScript, "consistency_mode: consistencyMode === 'crash' ? 'crash' : 'filesystem'")
|
|
|
&& str_contains($clientScript, '{ confirmation_name: confirmationName }')
|
|
|
&& str_contains($clientScript, 'const activeJobPresent = Boolean(payload?.active_job)')
|
|
|
&& str_contains($clientScript, 'payload?.can_mutate === false')
|
|
|
&& str_contains($clientScript, 'snapshotHasUnsafeFailure(items)')
|
|
|
&& str_contains($clientScript, 'const succeeded = taskSucceededWithoutRecovery(task)')
|
|
|
&& str_contains($clientScript, 'snapshotEffectLocked = task.recovery?.pending === true')
|
|
|
&& str_contains($clientScript, '操作效果可能已经发生。相关操作已停用')
|
|
|
&& str_contains($clientScript, '宿主机未能安全完成自动降级')
|
|
|
&& str_contains($clientScript, '实际模式为${snapshotConsistency(actualConsistency)}')
|
|
|
&& str_contains($baseStyles, '.vm-snapshot-create-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(190px,.78fr);align-items:start;gap:14px}')
|
|
|
&& str_contains($baseStyles, '.vm-snapshot-row{display:grid;grid-template-columns:')
|
|
|
&& str_contains($baseStyles, '@media(max-width:510px){.vm-snapshot-toolbar{display:block}'),
|
|
|
'Instance settings must lazily manage at most two online snapshots with explicit consistency and uncertain-state guards.');
|
|
|
$assert(str_contains($detailTemplate, 'id="vm-detail-name-trigger"')
|
|
|
&& str_contains($detailTemplate, 'aria-controls="vm-detail-name-form"')
|
|
|
&& str_contains($detailTemplate, 'role="tooltip">点击实例名称修改</span>')
|
|
|
&& str_contains($detailTemplate, 'id="vm-detail-name-form"')
|
|
|
&& str_contains($detailTemplate, 'maxlength="63"')
|
|
|
&& str_contains($detailTemplate, 'class="vm-detail-name-action save"')
|
|
|
&& str_contains($detailTemplate, 'class="vm-detail-name-action cancel"')
|
|
|
&& !str_contains($detailTemplate, 'vm-detail-name-bubble')
|
|
|
&& !str_contains($detailTemplate, 'mdi-pencil-outline')
|
|
|
&& str_contains($clientScript, 'function bindDisplayNameEditor(')
|
|
|
&& str_contains($clientScript, 'function syncDisplayNameInputSize(')
|
|
|
&& str_contains($clientScript, "input.addEventListener('input', () => syncDisplayNameInputSize(input))")
|
|
|
&& str_contains($clientScript, '/display-name`')
|
|
|
&& str_contains($clientScript, "event.key !== 'Escape'")
|
|
|
&& str_contains($clientScript, "save.textContent = '保存中…'")
|
|
|
&& str_contains($clientScript, 'let displayNameChanged = false;')
|
|
|
&& str_contains($baseStyles, '.vm-detail-name-form input{field-sizing:content;')
|
|
|
&& preg_match('/\.vm-detail-name-form input\{[^}]*border:0;[^}]*background:transparent;/', $baseStyles) === 1
|
|
|
&& preg_match('/\.vm-detail-name-action\{[^}]*border:0;[^}]*background:transparent;/', $baseStyles) === 1
|
|
|
&& str_contains($baseStyles, '.vm-detail-name-action:not(:disabled):hover{background:transparent;')
|
|
|
&& !str_contains($baseStyles, '.vm-detail-name-bubble')
|
|
|
&& !str_contains($baseStyles, '.vm-detail-name-form .button')
|
|
|
&& str_contains($baseStyles, '.vm-detail-name-display:hover .vm-detail-name-tooltip')
|
|
|
&& str_contains($baseStyles, '.vm-detail-name-display:focus-within .vm-detail-name-tooltip'),
|
|
|
'Instance display-name editing must replace the heading in place without icon or painted form controls.');
|
|
|
$assert(str_contains($detailTemplate, 'id="vm-detail-password-result" class="reinstall-password-card"')
|
|
|
&& str_contains($detailTemplate, 'id="vm-detail-generated-password-close"')
|
|
|
&& str_contains($detailTemplate, 'id="vm-detail-generated-password-saved"')
|
|
|
&& str_contains($clientScript, 'function clearGeneratedPassword()')
|
|
|
&& str_contains($clientScript, 'card.focus({ preventScroll: true })')
|
|
|
&& str_contains($clientScript, "if (value) value.textContent = ''")
|
|
|
&& !str_contains($detailTemplate, 'vm-settings-password-receipt')
|
|
|
&& !str_contains($detailTemplate, 'vm-settings-password-value')
|
|
|
&& !str_contains($baseStyles, '.vm-settings-password-receipt')
|
|
|
&& !str_contains($baseStyles, '.vm-settings-password-value'),
|
|
|
'Password reset must reuse the reinstall one-time password card and clear plaintext when dismissed.');
|
|
|
$assert(preg_match('/\.inventory-panel\.vm-service-panel\s*\{[^}]*min-height:\s*0;/',
|
|
|
$clientStyles) === 1
|
|
|
&& str_contains($cloudTemplate,
|
|
|
'class="inventory-panel vm-service-panel"'),
|
|
|
'The service and traffic card must size to its content without the inventory minimum-height gap');
|
|
|
$assert(str_contains($detailTemplate, '>实例到期时间</dt>')
|
|
|
&& str_contains($detailTemplate, 'id="vm-detail-service-expiry"')
|
|
|
&& str_contains($detailTemplate, 'service_expiry_display')
|
|
|
&& !str_contains($detailTemplate, '>当前账期结束</dt>')
|
|
|
&& !str_contains($detailTemplate, 'id="vm-detail-period-end"')
|
|
|
&& str_contains($clientScript, 'const serviceExpiresAt =')
|
|
|
&& !str_contains($clientScript, 'const periodEndsAt =')
|
|
|
&& str_contains($clientScript,
|
|
|
"text('vm-detail-service-expiry', formatServiceDate(data.serviceExpiresAt))"),
|
|
|
'VM details must show only the latest instance expiry instead of the current service-period end.');
|
|
|
foreach (['expired_grace', 'blocked_expired', 'deleting', 'delete_failed',
|
|
|
'purge_pending', 'purge_stopping', 'purge_stop_failed', 'purge_deleting',
|
|
|
'purge_failed'] as $lifecycleStatus) {
|
|
|
$assert(str_contains($clientScript, $lifecycleStatus . ':'),
|
|
|
'Missing user-facing lifecycle status: ' . $lifecycleStatus);
|
|
|
}
|
|
|
$assert(str_contains($sharedSidebar, 'href="/user/cloud/invoices"')
|
|
|
&& str_contains($cloudTemplate, 'id="invoices-workspace"')
|
|
|
&& str_contains($cloudTemplate, 'id="invoice-detail-workspace"')
|
|
|
&& str_contains($sharedSidebar, '>账单信息</span>')
|
|
|
&& str_contains($invoiceDetailRuntime, '/pay-balance')
|
|
|
&& str_contains($invoiceDetailRuntime, '/payments'),
|
|
|
'Unified invoices must support balance and online payment paths');
|
|
|
$assert(str_contains($clientEntry, "'invoice-detail': '/cloud/invoice-detail.js'")
|
|
|
&& str_contains($cloudShell, 'data-invoice-id=')
|
|
|
&& str_contains($cloudShell, "panel_cloud_active='invoices'")
|
|
|
&& str_contains($invoiceDetailModule, '/cloud/invoice-detail-runtime.js')
|
|
|
&& str_contains($invoiceDetailModule, 'readInvoiceDetailBootstrap()')
|
|
|
&& str_contains($invoiceDetailModule, 'hydrateInvoiceDetail(bootstrap, invoiceId)')
|
|
|
&& !str_contains($invoiceDetailModule, '/cloud/runtime.js')
|
|
|
&& !str_contains($invoiceDetailModule, '/api/v1/invoices/'),
|
|
|
'Invoice details must hydrate SSR data through a dedicated lightweight module.');
|
|
|
$assert(str_contains($clientScript, "String(invoice?.title || '账单')")
|
|
|
&& str_contains($clientScript, 'invoice?.created_display')
|
|
|
&& str_contains($clientScript, 'invoice?.amount_display')
|
|
|
&& str_contains($clientScript, "makeElement('div', 'cloud-invoice-list-amount')")
|
|
|
&& str_contains($clientScript,
|
|
|
'link.href = `/user/cloud/invoices/${encodeURIComponent(String(invoice.id))}`')
|
|
|
&& !str_contains($clientScript, 'invoice.invoice_no'),
|
|
|
'Invoice rows must use short database IDs, type labels, a right-aligned amount and a detail link.');
|
|
|
$runtimeScript = file_get_contents($public . '/runtime.js');
|
|
|
$invoicesModule = file_get_contents($public . '/invoices.js');
|
|
|
$assert(!str_contains($runtimeScript, 'function loadInvoiceDetail(')
|
|
|
&& !str_contains($runtimeScript, 'function renderInvoiceDetail(')
|
|
|
&& !str_contains($runtimeScript, 'INVOICE_PAYMENT_STORAGE_PREFIX'),
|
|
|
'The all-feature VM runtime must not duplicate invoice-detail behavior.');
|
|
|
$invoiceLoaderStart = strpos($invoicesModule, 'async function loadInvoices(');
|
|
|
$invoiceLoaderEnd = $invoiceLoaderStart === false ? false
|
|
|
: strpos($invoicesModule, 'function hydrate(', $invoiceLoaderStart);
|
|
|
$invoiceLoader = $invoiceLoaderStart === false || $invoiceLoaderEnd === false
|
|
|
? '' : substr($invoicesModule, $invoiceLoaderStart, $invoiceLoaderEnd - $invoiceLoaderStart);
|
|
|
$assert(str_contains($cloudTemplate, 'id="invoices-pagination"')
|
|
|
&& str_contains($cloudTemplate, 'id="invoices-previous"')
|
|
|
&& str_contains($cloudTemplate, 'id="invoices-next"')
|
|
|
&& str_contains($cloudTemplate, 'id="invoices-page-label"')
|
|
|
&& str_contains($clientStyles, '.invoice-pagination'),
|
|
|
'The invoice list is missing its accessible previous/next pagination controls.');
|
|
|
$assert(str_contains($invoiceLoader, 'invoiceQueryString(requestedPage, requestedFilters)')
|
|
|
&& str_contains($invoiceLoader, '`/api/v1/invoices${query ? `?${query}` : \'\'}`')
|
|
|
&& str_contains($invoiceLoader, 'state.readController?.abort();')
|
|
|
&& str_contains($invoiceLoader, 'if (sequence !== state.readSequence) return;')
|
|
|
&& str_contains($invoiceLoader,
|
|
|
'state.pagination = normalizePagination(payload?.pagination, requestedPage);')
|
|
|
&& !str_contains($invoiceLoader, 'payment_methods'),
|
|
|
'Invoice pagination must fetch one server page at a time without detail-only payment data.');
|
|
|
$assert(str_contains($invoicesModule, "byId('invoices-previous')")
|
|
|
&& str_contains($invoicesModule, "byId('invoices-next')")
|
|
|
&& str_contains($invoicesModule, 'loadInvoices(state.page + 1)')
|
|
|
&& str_contains($invoicesModule, 'state.loading')
|
|
|
&& str_contains($invoicesModule, "byId('invoices-bootstrap')")
|
|
|
&& !str_contains($invoicesModule, "new URL('/cloud/runtime.js'")
|
|
|
&& !str_contains($invoicesModule, "api('/api/v1/session')"),
|
|
|
'Invoice pages must hydrate the server-rendered first page and fetch only guarded later pages.');
|
|
|
$assert(str_contains($cloudTemplate, 'id="invoice-payment-methods"')
|
|
|
&& str_contains($cloudTemplate, 'id="invoice-payment-submit"')
|
|
|
&& str_contains($invoicePresentationSource, "'id' => 'balance'")
|
|
|
&& str_contains($invoicePresentationSource, "'name' => '账户余额'")
|
|
|
&& str_contains($invoiceDetailRuntime, "card.setAttribute('aria-pressed'")
|
|
|
&& str_contains($clientStyles, '.invoice-payment-method-card[aria-pressed="true"]')
|
|
|
&& str_contains($invoiceDetailRuntime, 'renderInvoiceSpecification(presentation)')
|
|
|
&& str_contains($invoiceDetailRuntime,
|
|
|
'renderInvoiceFulfillment(state.selectedInvoice, presentation)'),
|
|
|
'Invoice detail must isolate plan data and expose one card-based payment selector.');
|
|
|
$assert(!str_contains($invoiceDetailRuntime, "uncertain: ['正在核对结果', 'warning']")
|
|
|
&& !str_contains($invoiceDetailRuntime, "'needs_attention', 'uncertain'].includes(status)")
|
|
|
&& str_contains($invoicePresentationSource,
|
|
|
"\$rawFulfillment['task_id'] ?? null")
|
|
|
&& str_contains($invoicePresentationSource,
|
|
|
"'completion_notice' => self::completionNotice(")
|
|
|
&& str_contains($invoiceDetailRuntime, 'presentation?.polling_required === true')
|
|
|
&& !str_contains($invoiceDetailRuntime, 'job_id'),
|
|
|
'Provisioning must expose task_id and converge to an explicit terminal receipt without a reconciliation-only state.');
|
|
|
$assert(!str_contains($sharedSidebar, 'data-view="orders"')
|
|
|
&& !str_contains($cloudTemplate, 'id="orders-workspace"')
|
|
|
&& !str_contains($clientScript, 'function loadOrders()')
|
|
|
&& !str_contains($clientScript, "target === 'orders' || target === 'invoices'"),
|
|
|
'The retired user provisioning-order page and hash redirect must be absent');
|
|
|
$assert(str_contains($cloudTemplate, '>创建实例</button>')
|
|
|
&& str_contains($clientScript, "api('/api/v1/invoices', { method: 'POST', body })")
|
|
|
&& str_contains($clientScript, '/api/v1/invoices/by-request/')
|
|
|
&& str_contains($invoiceDetailRuntime, "invoice?.purpose")
|
|
|
&& str_contains($invoiceDetailRuntime,
|
|
|
'appendProvisionInvoiceActions(invoice, presentation, detail, actions)')
|
|
|
&& str_contains($invoiceDetailRuntime, "makeElement('a', 'row-button', '查看实例')"),
|
|
|
'Instance deployment must create a recoverable invoice and expose fulfillment inside billing');
|
|
|
$assert(!str_contains($cloudShell, '/theme/venix/js/qrcode.min.js')
|
|
|
&& str_contains($invoiceDetailRuntime, "document.createElement('script')")
|
|
|
&& str_contains($invoiceDetailRuntime, '/theme/venix/js/qrcode.min.js')
|
|
|
&& str_contains($invoiceDetailRuntime, "'weixin:', 'alipays:', 'alipayqr:'")
|
|
|
&& str_contains($invoiceDetailRuntime,
|
|
|
'void appendPaymentQr(box, qrValue, generation)'),
|
|
|
'Invoice online payments must lazy-load local QR rendering after creating a payment order.');
|
|
|
$assert(str_contains($invoiceDetailRuntime, 'INVOICE_PAYMENT_STORAGE_PREFIX')
|
|
|
&& str_contains($invoiceDetailRuntime, 'pendingInvoicePaymentKey(invoice.id, method.id)'),
|
|
|
'Invoice provider orders must reuse a session-scoped idempotency key after lost responses');
|
|
|
$assert(str_contains($invoiceDetailRuntime, 'function invoiceNeedsPolling(')
|
|
|
&& str_contains($invoiceDetailRuntime,
|
|
|
'api(`/api/v1/invoices/${encodeURIComponent(state.pollInvoiceId)}/status`')
|
|
|
&& str_contains($invoiceDetailRuntime, 'stopInvoicePoll();')
|
|
|
&& !str_contains($invoiceDetailRuntime, 'setInterval(')
|
|
|
&& substr_count($invoiceDetailRuntime,
|
|
|
"container.querySelectorAll('button').forEach(button => { button.disabled = false; });") >= 2,
|
|
|
'Active invoice polling must use the lightweight status endpoint and remain recoverable.');
|
|
|
$assert(!str_contains($invoiceDetailRuntime, '/api/v1/jobs/')
|
|
|
&& str_contains($invoiceDetailRuntime, "actionButton('刷新账单状态'")
|
|
|
&& str_contains($invoiceDetailRuntime,
|
|
|
'/api/v1/invoices/${encodeURIComponent(invoice.id)}/status'),
|
|
|
'Invoice creation progress must not load the general job payload or a cloud session.');
|
|
|
$assert(str_contains($invoicePresentationSource, "\$invoice['deletion_at']")
|
|
|
&& str_contains($invoicePresentationSource,
|
|
|
"self::timestampFact('最晚支付'")
|
|
|
&& str_contains($invoiceDetailRuntime, 'function invoiceCanPay(invoice)')
|
|
|
&& substr_count($invoiceDetailRuntime, 'if (!invoiceCanPay(invoice))') >= 2
|
|
|
&& str_contains($invoiceDetailRuntime,
|
|
|
'panel.hidden = presentation?.show_payment !== true;')
|
|
|
&& str_contains($invoiceDetailRuntime, 'container.replaceChildren();')
|
|
|
&& str_contains($invoicePresentationSource, '已超过支付截止时间'),
|
|
|
'Invoice UI must show the deletion deadline and hide every payment path after the cutoff');
|
|
|
$assert(str_contains($invoiceDetailRuntime, 'status >= 400 && status < 500')
|
|
|
&& str_contains($invoiceDetailRuntime, 'const ambiguousHttpFailure = [408, 425, 429].includes(status)')
|
|
|
&& str_contains($invoiceDetailRuntime, 'pendingInvoicePaymentKey(invoice.id, method.id)'),
|
|
|
'Ambiguous 5xx or transport failures must retain the provider idempotency key');
|
|
|
$assert(!str_contains($clientScript, '/renewals')
|
|
|
&& !str_contains($cloudTemplate, '续费周期'),
|
|
|
'Retired direct-renewal controls must not remain in the user UI');
|
|
|
$assert(!str_contains($cloudAdminController, 'CloudInstanceDiscovery')
|
|
|
&& !str_contains($cloudAdminController, 'known_owners'),
|
|
|
'Host administration must not depend on the retired VM discovery ownership map');
|
|
|
$adminEntryScripts = [
|
|
|
'hosts/index.tpl' => 'admin-hosts.js',
|
|
|
'cloud/rescue.tpl' => 'admin-rescue-templates.js',
|
|
|
'cloud/templates.tpl' => 'admin-cloud-templates.js',
|
|
|
];
|
|
|
foreach ($adminEntryScripts as $template => $entryScript) {
|
|
|
$source = file_get_contents($views . '/admin/' . $template);
|
|
|
$assert(str_contains($source,
|
|
|
'/cloud/' . $entryScript . '?v={$venix_asset_version}'),
|
|
|
'Cloud admin script cache busting missing: ' . $template);
|
|
|
}
|
|
|
$adminBillingSource = file_get_contents($adminBillingTemplate);
|
|
|
$adminBillingMarkup = $adminBillingSource
|
|
|
. file_get_contents($views . '/admin/billing_rows.tpl')
|
|
|
. file_get_contents($views . '/admin/billing_summary.tpl');
|
|
|
$assert(str_contains($adminBillingSource,
|
|
|
'/cloud/admin-billing.js?v={$venix_asset_version}')
|
|
|
&& str_contains($adminBillingSource, "{include file='admin/static_footer.tpl'}")
|
|
|
&& !str_contains($adminBillingSource, '/cloud/admin-billing.css')
|
|
|
&& !is_file($adminBillingStyles)
|
|
|
&& str_contains($adminBillingSource, 'admin-billing-summary')
|
|
|
&& preg_match_all('/<article class="[^"]*\badmin-billing-stat\b/', $adminBillingMarkup) === 5
|
|
|
&& !str_contains($adminBillingSource, 'admin-ticket-stat h-100')
|
|
|
&& str_contains($adminBillingSource, 'admin-checkout-table')
|
|
|
&& str_contains($adminBillingSource, '<dialog data-admin-instance-drawer data-admin-billing-drawer')
|
|
|
&& str_contains($adminBillingSource, 'admin-billing-bootstrap'),
|
|
|
'Unified administrator billing must reuse Venix admin styles and version its functional script');
|
|
|
$billingIds = [
|
|
|
'billing-notice', 'billing-refresh', 'billing-summary', 'billing-summary-total',
|
|
|
'billing-summary-amount-label', 'billing-summary-amount', 'billing-summary-focus-label',
|
|
|
'billing-summary-focus', 'billing-summary-result-label', 'billing-summary-result',
|
|
|
'billing-filter-title', 'billing-filter-form', 'billing-query', 'billing-user-id',
|
|
|
'billing-status-primary-field', 'billing-status-primary-label', 'billing-status-primary',
|
|
|
'billing-status-secondary-field', 'billing-status-secondary-label', 'billing-status-secondary',
|
|
|
'billing-category-field', 'billing-category-label', 'billing-category',
|
|
|
'billing-reference-field', 'billing-reference-label', 'billing-reference-select',
|
|
|
'billing-reference-input', 'billing-created-from', 'billing-created-to', 'billing-per-page',
|
|
|
'billing-apply', 'billing-reset', 'billing-panel', 'billing-view-heading',
|
|
|
'billing-view-description', 'billing-result-count', 'billing-table',
|
|
|
'billing-table-caption', 'billing-table-head', 'billing-table-body', 'billing-pagination',
|
|
|
'billing-previous', 'billing-page-label', 'billing-next', 'billing-detail-dialog',
|
|
|
'billing-detail-close', 'billing-detail-title', 'billing-detail-state', 'billing-detail-body',
|
|
|
'billing-summary-refunded', 'billing-refund-card', 'billing-detail-links',
|
|
|
'billing-advanced', 'billing-shown-filters',
|
|
|
];
|
|
|
foreach ($billingIds as $billingId) {
|
|
|
$assert(substr_count($adminBillingMarkup, 'id="' . $billingId . '"') === 1,
|
|
|
'Unified administrator billing hook missing or duplicated: ' . $billingId);
|
|
|
}
|
|
|
$assert(str_contains($adminBillingSource, '<main data-admin-billing>')
|
|
|
&& str_contains($adminBillingSource, '{foreach $billing_titles as $view=>$label}')
|
|
|
&& str_contains($adminBillingSource, 'data-billing-view="{$view|escape}"')
|
|
|
&& str_contains($adminBillingSource, 'admin-billing-filter-actions')
|
|
|
&& str_contains($adminSharedStyles, '.admin-billing-summary .admin-billing-stat-value')
|
|
|
&& str_contains($adminSharedStyles, '.admin-billing-filter-actions')
|
|
|
&& str_contains($adminBillingRuntime, "document.querySelector('[data-admin-billing]')")
|
|
|
&& str_contains($adminBillingRuntime, "document.querySelectorAll('[data-billing-view]')")
|
|
|
&& str_contains($adminBillingRuntime, 'button.dataset.invoiceId')
|
|
|
&& str_contains($adminBillingRuntime, 'cell.dataset.label'),
|
|
|
'Unified administrator billing data hooks must remain aligned with its runtime');
|
|
|
$billingMobileStyles = strstr($adminSharedStyles, '@media (max-width: 575.98px)');
|
|
|
$assert($billingMobileStyles !== false
|
|
|
&& preg_match('/\[data-admin-billing\] \.form-control,\s*\[data-admin-billing\] \.form-select\s*\{(?=[^}]*min-height:\s*44px)(?=[^}]*font-size:\s*16px)[^}]*\}/s', $billingMobileStyles)
|
|
|
&& preg_match('/\[data-admin-billing\] \.btn,\s*\.admin-ticket-tabs a\s*\{[^}]*min-height:\s*44px/s', $billingMobileStyles),
|
|
|
'Administrator billing controls must remain zoom-safe and touch-friendly on phones');
|
|
|
$assert(preg_match('/\[data-admin-billing-drawer\] \.admin-modal-close\s*\{(?=[^}]*width:\s*44px)(?=[^}]*height:\s*44px)[^}]*\}/s', $adminSharedStyles)
|
|
|
&& preg_match('/\.admin-checkout-user\s*\{[^}]*min-width:\s*0/s', $adminSharedStyles)
|
|
|
&& preg_match('/\.admin-checkout-user strong,\s*\.admin-checkout-user span\s*\{[^}]*overflow-wrap:\s*anywhere/s', $adminSharedStyles),
|
|
|
'Administrator billing dialog controls and long table values must remain usable on narrow screens');
|
|
|
$assert(str_contains($adminBillingSource, '<header class="admin-instance-drawer-header')
|
|
|
&& str_contains($adminBillingSource, 'admin-modal-close position-static flex-shrink-0')
|
|
|
&& preg_match('/\[data-admin-instance-drawer\]\[open\]\s*\{(?=[^}]*display:\s*flex)(?=[^}]*flex-direction:\s*column)[^}]*\}/s', $adminSharedStyles)
|
|
|
&& preg_match('/\[data-admin-instance-drawer\] \.admin-instance-drawer-body\s*\{(?=[^}]*min-height:\s*0)(?=[^}]*overflow-y:\s*auto)[^}]*\}/s', $adminSharedStyles)
|
|
|
&& str_contains($adminBillingRuntime, "dialog.addEventListener('cancel'")
|
|
|
&& str_contains($adminBillingRuntime, "document.documentElement.classList.remove('admin-instance-detail-open')")
|
|
|
&& str_contains($adminBillingRuntime, 'state.detailOpener.focus({ preventScroll: true })'),
|
|
|
'Administrator billing detail must keep its close action visible and restore page state after scrolling');
|
|
|
$assert(!preg_match('/text-bg-(?:success|info|warning|danger)/', $adminBillingRuntime)
|
|
|
&& str_contains($adminBillingRuntime, 'presentation?.class')
|
|
|
&& str_contains($billingPresentationCatalog,
|
|
|
"'success' => 'bg-success-subtle text-success-emphasis'")
|
|
|
&& str_contains($billingPresentationCatalog,
|
|
|
"'warning' => 'bg-warning-subtle text-warning-emphasis'")
|
|
|
&& str_contains($billingPresentationCatalog,
|
|
|
"'danger' => 'bg-danger-subtle text-danger-emphasis'")
|
|
|
&& str_contains($billingPresentationCatalog,
|
|
|
"'info' => 'bg-info-subtle text-info-emphasis'"),
|
|
|
'Administrator billing status badges must retain readable semantic colors');
|
|
|
foreach (glob($views . '/user/*.tpl') as $template) {
|
|
|
$source = file_get_contents($template);
|
|
|
$assert(!str_contains($source, 'href="/user/shop"'), 'Obsolete package link remains: ' . basename($template));
|
|
|
$assert(!str_contains($source, 'href="/user"'), 'Ambiguous user-home link remains: ' . basename($template));
|
|
|
}
|
|
|
$assert(str_contains($sharedTopbar, 'panel-topbar') && str_contains($sharedTopbar, 'breadcrumb-current'), 'Shared topbar contract missing');
|
|
|
$assert(!str_contains(file_get_contents($root . '/.gitignore'), "\nvendor/"), 'Nested noVNC vendor directory would be omitted from Git');
|
|
|
echo 'Unified user styles, local icons and noVNC source modules passed: ' . count($seen) . " modules.\n";
|