Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974

This commit is contained in:
Public Source Publisher committed 2026-10-01 01:38:08 +02:00
commit c737a37f71
531 files changed
+119270

No files matched your search

+154
View File
@@ -0,0 +1,154 @@
'use strict';
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
test('central notifications render external messages as text', () => {
const root = path.resolve(__dirname, '../..');
const state = fs.readFileSync(path.join(root, 'renderer', 'modules', 'state.js'), 'utf8');
const toastFunction = state.slice(state.indexOf('function showToast'), state.indexOf('// ── Navigation'));
const friendly = state.slice(state.indexOf('function friendlyMessage'), state.indexOf('function showToast'));
// The body must be written as text, and the text must be a coerced string.
// showToast now displays the translated message, so the coercion moved into
// friendlyMessage; both halves of the chain are asserted here.
assert.match(toastFunction, /const message = friendlyMessage\(msg\);/);
assert.match(toastFunction, /body\.textContent = message;/);
assert.match(friendly, /String\(text \?\? ''\)/);
assert.doesNotMatch(toastFunction, /innerHTML/);
assert.doesNotMatch(friendly, /innerHTML/);
});
test('the retired console service is absent from active product surfaces', () => {
const root = path.resolve(__dirname, '../..');
const token = ['void', 'shell'].join('');
const files = [
'main.js', 'preload.js', 'renderer/index.html', 'renderer/pork-web-shim.js',
'src/server/create-registry.js', 'src/server/register-functional-modules.js',
'src/services/console-profile-service.js', 'build/lang/en.json', 'build/lang/fr.json',
];
const rendererModules = fs.readdirSync(path.join(root, 'renderer', 'modules')).filter(file => file.endsWith('.js')).map(file => `renderer/modules/${file}`);
const contents = [...files, ...rendererModules].map(file => fs.readFileSync(path.join(root, file), 'utf8').toLowerCase()).join('\n');
assert.equal(contents.includes(token), false);
assert.equal(fs.existsSync(path.join(root, 'renderer', 'modules', `${token}.js`)), false);
assert.equal(fs.existsSync(path.join(root, 'build', 'garlic', `${token}.elf`)), false);
assert.equal(fs.existsSync(path.join(root, 'build', 'garlic', 'ps5_autoloader', `${token}.elf`)), false);
});
test('active renderer modules use accessible in-app dialogs', () => {
const root = path.resolve(__dirname, '../..');
const contents = fs.readdirSync(path.join(root, 'renderer', 'modules'))
.filter(file => file.endsWith('.js'))
.map(file => fs.readFileSync(path.join(root, 'renderer', 'modules', file), 'utf8'))
.join('\n');
assert.doesNotMatch(contents, /(?:window\.)?(?:confirm|prompt|alert)\s*\(/);
assert.match(contents, /showExactConfirmation\(/);
});
test('the primary application shell has no inline script event handlers', () => {
const root = path.resolve(__dirname, '../..');
const html = fs.readFileSync(path.join(root, 'renderer', 'index.html'), 'utf8');
const activeModules = ['backups.js', 'backporks.js', 'cheats.js', 'games.js', 'media.js', 'modal.js', 'pfs-ripper.js']
.map(file => fs.readFileSync(path.join(root, 'renderer', 'modules', file), 'utf8')).join('\n');
assert.doesNotMatch(html, /<script(?![^>]*\bsrc=)[^>]*>/i);
assert.doesNotMatch(html, /\son(?:click|error|load|change|submit|keydown)\s*=/i);
assert.doesNotMatch(activeModules, /\son(?:click|error|load|change|submit|keydown)\s*=/i);
});
test('PS5 payload sessions only start from explicit user controls', () => {
const root = path.resolve(__dirname, '../..');
const html = fs.readFileSync(path.join(root, 'renderer', 'index.html'), 'utf8');
const arsenal = fs.readFileSync(path.join(root, 'renderer', 'modules', 'elf-arsenal.js'), 'utf8');
const saveManager = fs.readFileSync(path.join(root, 'renderer', 'modules', 'savemgr.js'), 'utf8');
assert.match(arsenal, /ea-embed-start[^]*addEventListener\('click'/);
assert.doesNotMatch(arsenal, /autoStart/);
assert.match(html, /id="btn-sm-start-session"/);
assert.match(saveManager, /btn-sm-start-session[^]*addEventListener\('click'/);
assert.doesNotMatch(saveManager, /smFetchSaves\([^)]*autoStart/);
});
test('ELF Arsenal uses the native Chimera client instead of embedding the fragile upstream page', () => {
const root = path.resolve(__dirname, '../..');
const arsenal = fs.readFileSync(path.join(root, 'renderer', 'modules', 'elf-arsenal.js'), 'utf8');
assert.doesNotMatch(arsenal, /createElement\(['"]iframe['"]\)|<iframe/i);
assert.match(arsenal, /eaList\(/);
assert.match(arsenal, /eaDownload\(/);
assert.match(arsenal, /eaStart\(/);
assert.match(arsenal, /Open original WebUI/);
});
test('platform-managed plugin and XAvatar installs require exact confirmations', () => {
const root = path.resolve(__dirname, '../..');
const registry = fs.readFileSync(path.join(root, 'src', 'server', 'create-registry.js'), 'utf8');
const ecosystem = fs.readFileSync(path.join(root, 'renderer', 'modules', 'ecosystem.js'), 'utf8');
const xavatar = fs.readFileSync(path.join(root, 'renderer', 'modules', 'xavatar.js'), 'utf8');
assert.match(registry, /name: 'ecosystem:plugins:install'[^]*confirmation: 'INSTALL PLUGIN'/);
assert.match(ecosystem, /showExactConfirmation\([^]*'INSTALL PLUGIN'/);
assert.match(registry, /name: 'xavatar:install-companion'[^]*confirmation: 'INSTALL XAVATAR'/);
assert.match(xavatar, /showExactConfirmation\([^]*'INSTALL XAVATAR'/);
assert.match(registry, /32515b8253a027bbe65b95f574fb1484020bb0d65d6d0f6e418cb73ab739f2b3/);
});
test('installing the Save Manager autoload payload requires exact confirmation in every runtime', () => {
const root = path.resolve(__dirname, '../..');
const server = fs.readFileSync(path.join(root, 'src', 'server', 'register-functional-modules.js'), 'utf8');
const electron = fs.readFileSync(path.join(root, 'main.js'), 'utf8');
const renderer = fs.readFileSync(path.join(root, 'renderer', 'modules', 'savemgr.js'), 'utf8');
const phrase = 'INSTALLEER GARLIC AUTOLOAD';
assert.match(server, /name: 'savemgr:push-payload',[^]*classification: 'destructive'/);
assert.match(server, new RegExp(`confirmation: '${phrase}'`));
assert.match(electron, new RegExp(`input\\.confirmation !== '${phrase}'`));
assert.match(renderer, new RegExp(`confirmation = '${phrase}'`));
});
test('starting a PS5 payload requires exact confirmation at UI and server boundaries', () => {
const root = path.resolve(__dirname, '../..');
const server = fs.readFileSync(path.join(root, 'src', 'server', 'register-functional-modules.js'), 'utf8');
const renderer = fs.readFileSync(path.join(root, 'renderer', 'modules', 'payload.js'), 'utf8');
assert.match(server, /name: 'pldmgr:launch', classification: 'destructive', confirmation: 'START PAYLOAD'/);
assert.match(renderer, /showExactConfirmation\([^]*'START PAYLOAD'/);
assert.match(renderer, /pldmgrLaunch\(payloadPath, confirmConflict, 'START PAYLOAD'\)/);
});
test('high-risk payloads stay in the hidden expert group even when updates exist', () => {
const root = path.resolve(__dirname, '../..');
const renderer = fs.readFileSync(path.join(root, 'renderer', 'modules', 'payload.js'), 'utf8');
const classifier = renderer.slice(renderer.indexOf('function payloadCatalogGroup'), renderer.indexOf('const PAYLOAD_GROUPS'));
assert.ok(classifier.indexOf("return 'expert'") < classifier.indexOf("return 'updates'"));
assert.match(classifier, /\['kernel', 'debug', 'linux'\]/);
assert.match(classifier, /shell\(\?:code\)\?/);
assert.match(classifier, /elf\\s\*\(\?:ldr\|loader\)/);
assert.match(renderer, /visibleSources = sources\.filter\(source =>[^]*expertMode \|\| payloadCatalogGroup\(\{ source, files: \[\] \}\) !== 'expert'/);
assert.match(renderer, /chimera:expert-mode-changed/);
});
test('background warmup stays passive until a console host is configured', () => {
const root = path.resolve(__dirname, '../..');
const payload = fs.readFileSync(path.join(root, 'renderer', 'modules', 'payload.js'), 'utf8');
const state = fs.readFileSync(path.join(root, 'renderer', 'modules', 'state.js'), 'utf8');
assert.match(payload, /persistPort = false/);
assert.match(payload, /if \(persistPort\) await window\.pork\.setSettings/);
assert.match(state, /if \(!settings\.ftpHost\)[^]*services\.ps5NotConfigured[^]*services\.configureProfile[^]*return;/);
});
test('mobile navigation exposes its state to assistive technology', () => {
const root = path.resolve(__dirname, '../..');
const html = fs.readFileSync(path.join(root, 'renderer', 'index.html'), 'utf8');
const state = fs.readFileSync(path.join(root, 'renderer', 'modules', 'state.js'), 'utf8');
assert.match(html, /id="mobile-nav-toggle"[^>]*aria-controls="sidebar"[^>]*aria-expanded="false"/);
assert.match(state, /setAttribute\('aria-expanded', String\(isOpen\)\)/);
assert.match(state, /isOpen \? 'Close navigation' : 'Open navigation'/);
});