Loksi 2026.10.0 (Android 3) : source correspondante
Export du dépôt interne d'Aleop, révision 5fbb921.
Cette révision appartient à :
révision
c3608b3938
91 fichiers modifiés
+7297
Aucun fichier ne correspond à votre recherche
@@ -0,0 +1,73 @@
|
||||
// Planche d'essai et planche du jeu complet : régénère les maîtres, rend les illustrations amont pour comparaison,
|
||||
// puis photographie planche.html après contrôle de la police et de chaque image.
|
||||
// AMONT=<dossier ios-2026.9.0-bwpm extrait de l'archive épinglée> node illustrations-mobiles/render.mjs
|
||||
import { chromium } from 'playwright';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { JEU } from './correspondance.mjs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
|
||||
const dir = dirname(fileURLToPath(import.meta.url));
|
||||
execFileSync('node', [join(dir, 'generate.mjs')], { stdio: 'inherit' });
|
||||
|
||||
// Les rendus amont restent hors Git (amont/ est ignoré) : ce sont des dessins Bitwarden.
|
||||
const ILL = 'BitwardenShared/UI/Platform/Application/Support/Images.xcassets/Images/Illustrations';
|
||||
const amont = { items_light: 'items.imageset/items_light.pdf', generate: 'generate.imageset/generate.pdf',
|
||||
'secure-devices': 'secure-devices.imageset/secure-devices.pdf' };
|
||||
// Pictogrammes de la barre d'onglets, clair et sombre. Le PDF clair actif du coffre porte une
|
||||
// faute de frappe en amont (vault-actve-light.pdf), gardée telle quelle.
|
||||
const TAB = 'BitwardenResources/Icons.xcassets/TabBar';
|
||||
for (const o of ['vault', 'generator', 'send', 'settings']) for (const e of ['active', 'idle']) for (const th of ['light', 'dark']) {
|
||||
const fichier = o === 'vault' && e === 'active' && th === 'light' ? 'vault-actve-light.pdf' : `${o}-${e}-${th}.pdf`;
|
||||
amont[`tab-${o}-${e}-${th}`] = `${TAB}/${o}-${e}.imageset/${fichier}`;
|
||||
}
|
||||
mkdirSync(join(dir, 'amont'), { recursive: true });
|
||||
execFileSync('node', [join(dir, 'onglets.mjs')], { stdio: 'inherit' });
|
||||
for (const [nom, pdf] of Object.entries(amont)) {
|
||||
const out = join(dir, 'amont', `${nom}.png`);
|
||||
if (existsSync(out)) continue;
|
||||
if (!process.env.AMONT) throw new Error(`amont/${nom}.png absent : donner AMONT=<extraction de ios.tar.gz>`);
|
||||
// 144 dpi pour un rendu net en 200 px sur un écran à 2x, 576 pour les pictogrammes de 24 pt.
|
||||
execFileSync('pdftoppm', ['-png', '-r', nom.startsWith('tab-') ? '576' : '144', '-singlefile', join(process.env.AMONT, nom.startsWith('tab-') ? '' : ILL, pdf), out.replace(/\.png$/, '')]);
|
||||
}
|
||||
|
||||
// Planche du jeu : une carte par illustration, clair et sombre, puis tout le jeu à 80 px.
|
||||
const esc = (x) => x.replace(/&/g, '&').replace(/</g, '<');
|
||||
const ligne = (k, v) => (v ? `<dt>${k}</dt><dd>${esc(v)}</dd>` : '');
|
||||
const cartes = JEU.map((j) => `<article><h3>${j.nom}</h3><p>${esc(j.ecran)}</p>
|
||||
<div class="duo"><div class="clair"><img src="sources/${j.nom}-clair.svg" width="140" height="140" alt="${j.nom} clair"></div><div class="sombre"><img src="sources/${j.nom}-sombre.svg" width="140" height="140" alt="${j.nom} sombre"></div></div>
|
||||
<dl>${ligne('iOS', j.ios)}${ligne('Android', j.android)}${ligne('Extension', j.extension)}</dl></article>`).join('\n');
|
||||
const petits = (theme) => JEU.map((j) => `<img src="sources/${j.nom}-${theme}.svg" width="80" height="80" alt="${j.nom} ${theme} 80">`).join('');
|
||||
writeFileSync(join(dir, 'planche-jeu.html'), readFileSync(join(dir, 'planche-jeu.gabarit.html'), 'utf8')
|
||||
.replace('{{nombre}}', String(JEU.length)).replace('{{cartes}}', cartes)
|
||||
.replace('{{petits-clair}}', petits('clair')).replace('{{petits-sombre}}', petits('sombre')));
|
||||
|
||||
// Table du README, entre les deux marqueurs, tirée de la même correspondance.
|
||||
const readme = join(dir, 'README.md');
|
||||
const table = ['| Loksi | Écran | iOS | Android | Extension |', '|---|---|---|---|---|',
|
||||
...JEU.map((j) => `| \`${j.nom}\` | ${j.ecran} | ${j.ios || 'aucun'} | ${j.android || 'aucun'} | ${j.extension || 'aucun'} |`)].join('\n');
|
||||
const r = readFileSync(readme, 'utf8');
|
||||
if (!/<!-- jeu:debut -->[\s\S]*<!-- jeu:fin -->/.test(r)) throw new Error('README : marqueurs jeu:debut et jeu:fin absents');
|
||||
writeFileSync(readme, r.replace(/<!-- jeu:debut -->[\s\S]*<!-- jeu:fin -->/, `<!-- jeu:debut -->\n${table}\n<!-- jeu:fin -->`));
|
||||
|
||||
const browser = await chromium.launch();
|
||||
try {
|
||||
for (const [html, png] of [['planche.html', 'planche-essai.png'], ['planche-jeu.html', 'planche-jeu.png'], ['planche-onglets.html', 'planche-onglets.png']]) {
|
||||
const page = await browser.newPage({ viewport: { width: 1400, height: 1000 }, deviceScaleFactor: 2 });
|
||||
await page.route('**/*', (r) => (r.request().url().startsWith('file:') ? r.continue() : r.abort()));
|
||||
await page.goto(pathToFileURL(join(dir, html)).href);
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
const checks = await page.evaluate(() => ({
|
||||
police: [...document.fonts].some((f) => f.family === 'Raleway' && f.status === 'loaded'),
|
||||
images: [...document.images].map((i) => ({ src: i.getAttribute('src'), ok: i.complete && i.naturalWidth > 0 })),
|
||||
}));
|
||||
const ko = checks.images.filter((i) => !i.ok);
|
||||
if (!checks.police || ko.length) throw new Error(`${html} incomplète : ${JSON.stringify({ police: checks.police, ko })}`);
|
||||
await page.locator('.page').screenshot({ path: join(dir, png) });
|
||||
console.log(`${png} : Raleway chargée, ${checks.images.length} images chargées`);
|
||||
await page.close();
|
||||
}
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur