fix(extension): masquer le diagnostic en builds Store v0.4.6
- Ajout du flag ALLOW_DIAGNOSTICS dans sidepanel.js. - En prod (builds Chrome Store / Firefox) ALLOW_DIAGNOSTICS = false : le bouton ? et le panneau diagnostic sont masqués, logDiag reste silencieux. - Mise à jour des scripts de build pour appliquer ALLOW_DIAGNOSTICS = false. - Bump version 0.4.6.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
/** Mettre à false pour le build Chrome Web Store (URL production en dur). */
|
||||
const ALLOW_INSTANCE_CONFIG = false
|
||||
/** Mettre à false pour masquer le panneau de diagnostic en production. */
|
||||
const ALLOW_DIAGNOSTICS = false
|
||||
const DEFAULT_BASE = 'https://memento-note.com'
|
||||
const STORAGE_KEYS = { baseUrl: 'memento_clipper_base_url', notebookId: 'memento_clipper_notebook_id' }
|
||||
const SESSION_KEY = 'memento_clipper_session'
|
||||
@@ -153,6 +155,11 @@ function rtlAttrs(text) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function logDiag(label, detail = '') {
|
||||
if (!ALLOW_DIAGNOSTICS) {
|
||||
// En prod on garde uniquement la console native, jamais l'UI.
|
||||
console.debug('[memento-diag]', label, detail)
|
||||
return
|
||||
}
|
||||
const line = `[${new Date().toLocaleTimeString()}] ${label}${detail ? ` — ${detail}` : ''}`
|
||||
diagLogs.push(line)
|
||||
if (diagLogs.length > 80) diagLogs.shift()
|
||||
@@ -161,11 +168,17 @@ function logDiag(label, detail = '') {
|
||||
}
|
||||
|
||||
function renderDiag() {
|
||||
if (!els.diagBody) return
|
||||
if (!ALLOW_DIAGNOSTICS || !els.diagBody) return
|
||||
els.diagBody.innerHTML = diagLogs.map((l) => `<div class="diag-line">${escapeHtml(l)}</div>`).join('')
|
||||
els.diagBody.scrollTop = els.diagBody.scrollHeight
|
||||
}
|
||||
|
||||
function hideDiagnosticsIfNeeded() {
|
||||
if (ALLOW_DIAGNOSTICS) return
|
||||
els.diagToggle?.setAttribute('hidden', '')
|
||||
els.diagPanel?.setAttribute('hidden', '')
|
||||
}
|
||||
|
||||
async function copyDiagnostics() {
|
||||
try {
|
||||
const text = diagLogs.join('\n')
|
||||
@@ -886,6 +899,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
applyDocumentLocale()
|
||||
applyInstanceConfigVisibility()
|
||||
applyShellI18n()
|
||||
hideDiagnosticsIfNeeded()
|
||||
await loadSettings()
|
||||
try {
|
||||
await ensureApiPermission()
|
||||
|
||||
Reference in New Issue
Block a user