Initial curated chimera source from a8ae5b1db07fb49926c94585e2718e5130330974
This commit is contained in:
commit
c737a37f71
531 files changed
+119270
No files matched your search
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
'use strict';
|
||||
|
||||
(function bootstrapChimera() {
|
||||
const loaded = new Map();
|
||||
const featureModules = Object.freeze({
|
||||
games: ['modules/games.js', 'modules/game-source-scan.js', 'modules/ftpbrowser.js', 'modules/backpork-gen.js', 'modules/hash.js', 'modules/manage.js', 'modules/compatibility-guidance.js', 'modules/title-workspace.js', '../src/renderer/recipe-editor.js', 'modules/install-destination.js', 'modules/cheats.js', 'modules/modal.js'],
|
||||
packages: ['modules/packages.js'],
|
||||
backporks: ['modules/backporks.js', 'modules/backpork-gen.js', 'modules/ftpbrowser.js'],
|
||||
backups: ['modules/protection-model.js', 'modules/backups.js', 'modules/ftpbrowser.js'],
|
||||
trophies: ['../src/renderer/trophies.js'],
|
||||
database: ['modules/database.js'],
|
||||
settings: ['modules/payload.js', 'modules/settings.js'],
|
||||
jailbreak: ['modules/payload.js', 'modules/y2jb-generator.js', 'modules/bdjb-generator.js', 'modules/system-state.js', 'modules/autoloader.js'],
|
||||
psnotify: ['modules/psnotify.js'],
|
||||
xavatar: [{ src: '../src/xavatarElectronModule/renderer/xavatarRenderer.js', type: 'module' }, 'modules/xavatar.js'],
|
||||
'system-view': ['gif-encoder.js', 'modules/system-view.js', 'modules/hotkeys.js'],
|
||||
transfers: ['modules/transfers.js'],
|
||||
media: ['modules/media.js'],
|
||||
cheats: ['modules/cheats.js'],
|
||||
garlic: ['modules/cheats.js'],
|
||||
'elf-arsenal': ['modules/elf-arsenal.js'],
|
||||
'pfs-ripper': ['modules/pfs-ripper.js'],
|
||||
savemgr: ['modules/savemgr.js'],
|
||||
ecosystem: ['modules/etahen-link-ux.js', 'modules/ecosystem.js'],
|
||||
operations: ['modules/operations.js'],
|
||||
});
|
||||
const coreModules = [
|
||||
'pork-web-shim.js',
|
||||
'pork-evidence-bridge.js',
|
||||
'modules/i18n.js',
|
||||
'modules/state.js',
|
||||
'modules/library-model.js',
|
||||
'modules/helpers.js',
|
||||
'modules/connection.js',
|
||||
'modules/navigation-routes.js',
|
||||
'modules/navigation.js',
|
||||
'modules/premium-illustrations.js?v=sol-ultra-1',
|
||||
'modules/dashboard-widgets.js',
|
||||
'modules/init.js',
|
||||
'modules/pwa.js',
|
||||
];
|
||||
|
||||
function descriptor(value) {
|
||||
return typeof value === 'string' ? { src: value, type: 'text/javascript' } : value;
|
||||
}
|
||||
|
||||
function load(value) {
|
||||
const item = descriptor(value);
|
||||
if (loaded.has(item.src)) return loaded.get(item.src);
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
const script = document.createElement('script');
|
||||
script.src = item.src;
|
||||
script.type = item.type || 'text/javascript';
|
||||
script.dataset.chimeraModule = item.src;
|
||||
script.addEventListener('load', () => resolve(item.src), { once: true });
|
||||
script.addEventListener('error', () => {
|
||||
loaded.delete(item.src);
|
||||
reject(new Error(`Could not load ${item.src}.`));
|
||||
}, { once: true });
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
loaded.set(item.src, promise);
|
||||
return promise;
|
||||
}
|
||||
|
||||
async function loadSequence(items) {
|
||||
for (const item of items) await load(item);
|
||||
}
|
||||
|
||||
window.ChimeraModuleLoader = Object.freeze({
|
||||
ensureForPage: page => loadSequence(featureModules[page] || []),
|
||||
isLoaded: src => loaded.has(src),
|
||||
loadedModules: () => [...loaded.keys()],
|
||||
});
|
||||
|
||||
loadSequence(coreModules).catch(error => {
|
||||
console.error('[bootstrap]', error);
|
||||
const status = document.getElementById('sb-msg');
|
||||
if (status) {
|
||||
status.textContent = `Chimera could not start: ${error.message}`;
|
||||
status.style.color = 'var(--red)';
|
||||
}
|
||||
document.body.dataset.bootstrapFailed = 'true';
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user