fix: activity log now records from injector + dynamic icon colors
Activity log fix: - Injector now writes directly to storage.local in addition to sending runtime messages to the background worker. This fixes the issue where MV3 service worker sleep caused messages to be silently dropped. Dynamic icon colors: - Black "SS" = active, normal - Blue "SS" = reveal mode on - Red "SS" = Silent Send disabled - Icons generated via OffscreenCanvas in the service worker - Updates on every settings change and keyboard shortcut toggle Also adds keyboard shortcuts section to Options page showing current bindings and how to customize them per browser. https://claude.ai/code/session_01Dvgwe7XMoSxnWXkih8p1Cw
This commit is contained in:
+23
-1
@@ -38,14 +38,36 @@
|
||||
script.onload = () => script.remove();
|
||||
|
||||
// Listen for substitution events from the page script
|
||||
window.addEventListener('message', (event) => {
|
||||
window.addEventListener('message', async (event) => {
|
||||
if (event.source !== window) return;
|
||||
if (event.data?.type === 'ss:substitution-performed') {
|
||||
// Try to notify background for badge update
|
||||
api.runtime.sendMessage({
|
||||
type: 'substitution:performed',
|
||||
count: event.data.count,
|
||||
replacements: event.data.replacements,
|
||||
}).catch(() => {});
|
||||
|
||||
// Also log directly from the injector (content script world)
|
||||
// in case the background worker is asleep
|
||||
const replacements = event.data.replacements || [];
|
||||
for (const r of replacements) {
|
||||
const log = (await api.storage.local.get('ss_activity_log')).ss_activity_log || [];
|
||||
log.unshift({
|
||||
id: crypto.randomUUID(),
|
||||
timestamp: Date.now(),
|
||||
type: 'substitution',
|
||||
direction: 'outbound',
|
||||
original: r.original,
|
||||
replaced: r.replaced,
|
||||
category: r.category || 'general',
|
||||
pattern: r.pattern || '',
|
||||
url: location.href,
|
||||
});
|
||||
// Trim
|
||||
if (log.length > 200) log.length = 200;
|
||||
await api.storage.local.set({ ss_activity_log: log });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user