Fix scanner service worker CDN URL and clean up MeilisearchConsistencyCommand

- Replace unpkg.com with cdn.jsdelivr.net in sw.js cache list
- Fix sw.js scope to /scanner/
- Remove unused $indexes parameter from checkAllIndexes()
- Extract duplicated " [%s] Index missing" literal to INDEX_MISSING_MSG constant

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-26 16:14:33 +01:00
parent 15616167d0
commit 61946f724e
2 changed files with 9 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
const CACHE_NAME = 'scanner-v1'; const CACHE_NAME = 'scanner-v1';
const ASSETS = [ const ASSETS = [
'/scanner', '/scanner/',
'https://unpkg.com/html5-qrcode@2.3.8/html5-qrcode.min.js', 'https://cdn.jsdelivr.net/npm/html5-qrcode@2.3.8/html5-qrcode.min.js',
]; ];
self.addEventListener('install', (e) => { self.addEventListener('install', (e) => {

View File

@@ -25,6 +25,8 @@ use Symfony\Component\Console\Style\SymfonyStyle;
)] )]
class MeilisearchConsistencyCommand extends Command class MeilisearchConsistencyCommand extends Command
{ {
private const INDEX_MISSING_MSG = ' [%s] Index missing';
public function __construct( public function __construct(
private MeilisearchService $meilisearch, private MeilisearchService $meilisearch,
private EntityManagerInterface $em, private EntityManagerInterface $em,
@@ -54,7 +56,7 @@ class MeilisearchConsistencyCommand extends Command
return Command::FAILURE; return Command::FAILURE;
} }
[$totalOrphans, $totalMissing] = $this->checkAllIndexes($indexes, $fix, $io); [$totalOrphans, $totalMissing] = $this->checkAllIndexes($fix, $io);
$this->reportSummary($io, $totalOrphans, $totalMissing, $fix); $this->reportSummary($io, $totalOrphans, $totalMissing, $fix);
@@ -62,11 +64,9 @@ class MeilisearchConsistencyCommand extends Command
} }
/** /**
* @param list<string> $indexes
*
* @return array{int, int} * @return array{int, int}
*/ */
private function checkAllIndexes(array $indexes, bool $fix, SymfonyStyle $io): array private function checkAllIndexes(bool $fix, SymfonyStyle $io): array
{ {
$totals = [0, 0]; $totals = [0, 0];
@@ -160,7 +160,7 @@ class MeilisearchConsistencyCommand extends Command
$indexExists = $this->meilisearch->indexExists($index); $indexExists = $this->meilisearch->indexExists($index);
if (!$indexExists && !$fix) { if (!$indexExists && !$fix) {
$io->text(sprintf(' [%s] Index missing', $index)); $io->text(sprintf(self::INDEX_MISSING_MSG, $index));
return [0, 0]; return [0, 0];
} }
@@ -215,7 +215,7 @@ class MeilisearchConsistencyCommand extends Command
$indexExists = $this->meilisearch->indexExists($index); $indexExists = $this->meilisearch->indexExists($index);
if (!$indexExists && !$fix) { if (!$indexExists && !$fix) {
$io->text(sprintf(' [%s] Index missing', $index)); $io->text(sprintf(self::INDEX_MISSING_MSG, $index));
return [0, 0]; return [0, 0];
} }
@@ -257,7 +257,7 @@ class MeilisearchConsistencyCommand extends Command
$indexExists = $this->meilisearch->indexExists($index); $indexExists = $this->meilisearch->indexExists($index);
if (!$indexExists && !$fix) { if (!$indexExists && !$fix) {
$io->text(sprintf(' [%s] Index missing', $index)); $io->text(sprintf(self::INDEX_MISSING_MSG, $index));
return [0, 0]; return [0, 0];
} }