How joystrife/context-restorer-for-freshservice works
This Chromium extension preserves Freshservice navigation context per tab and restores it after authentication is positively observed. The workflow detects and classifies portal navigation, records useful destinations and session-loss state, waits for authentication, then restores the affected tab or tabs. The popup exposes status, portal controls, counters, and a manual fallback. The sampled code shows the background worker importing the URL rules and using browser storage; finer restore and message-handler details are not fully excerpted, so unsupported internal links are omitted.
Main entry points: popup.js Popup interface · background.js Navigation observer · popup.html Popup layout · popup.css Popup styling
Components 16
Detection and rules
- URL classification
extension/rules.js - Navigation observer
extension/background.js
Context recovery
- Tab context tracking
extension/background.js - Authentication waiting
extension/background.js - Tab restoration
extension/background.js
Local state
- Portal registry
extension/background.js - Session tab state
extension/background.js - Restore counters
extension/background.js - Session debug log
extension/background.js
Popup controls
- Popup interface
extension/popup.js - Popup layout
extension/popup.html - Popup styling
extension/popup.css
Other components
- Extension user
- Chromium browser
- Freshservice portal
- Freshworks authentication
Connections 21
- Chromium browser → Navigation observer: emits navigation
extension/background.js - Navigation observer → URL classification: classifies URLs
extension/background.js - Navigation observer → Tab context tracking: updates context
extension/background.js - Tab context tracking → Session tab state: reads/writes
extension/background.js - Tab context tracking → Portal registry: updates portal
extension/background.js - Navigation observer → Session debug log: records events
extension/background.js - Freshworks authentication → Navigation observer: signals auth
- Authentication waiting → Tab restoration: dispatches recovery
extension/background.js - Tab restoration → Chromium browser: navigates tab
- Tab restoration → Restore counters: records success
extension/background.js - Popup layout → Popup interface: provides controls
extension/popup.js - Popup styling → Popup interface: styles interface
- Extension user → Popup interface: opens controls
- Popup interface → Chromium browser: queries active tab
extension/popup.js - Popup interface → Navigation observer: requests inspection
extension/popup.js - Popup interface → Session tab state: reads status
extension/popup.js - Popup interface → Portal registry: reads registry
extension/popup.js - Popup interface → Restore counters: reads counters
extension/popup.js - Popup interface → Session debug log: reads events
extension/popup.js - Popup interface → Tab context tracking: sends controls
extension/popup.js - Freshservice portal → Navigation observer: provides page URLs