File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @lgamila/extension" ,
33 "displayName" : " LGamila Live" ,
4- "version" : " 1.1.0 " ,
4+ "version" : " 1.1.1 " ,
55 "description" : " This extension shows you a real-time list of all Moroccan Twitch and Kick streamers who are currently live." ,
66 "author" : " Stormix <hello@stormix.dev>" ,
77 "scripts" : {
Original file line number Diff line number Diff line change @@ -24,3 +24,8 @@ async function createOffscreenDocument() {
2424}
2525
2626createOffscreenDocument ( ) ;
27+
28+ chrome . runtime . onStartup . addListener ( createOffscreenDocument ) ;
29+ self . onmessage = ( _e ) => {
30+ // Keep the offscreen document alive
31+ } ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const showNotification = (parsed: ServerToClient) => {
3434} ;
3535
3636chrome . runtime . onMessage . addListener ( async ( message ) => {
37- logger . info ( 'Received message' , message ) ;
37+ logger . info ( 'Received message' , JSON . stringify ( message ) ) ;
3838 const parsed = serverToClient . safeParse ( message ) ;
3939
4040 if ( ! parsed . success ) {
@@ -69,7 +69,7 @@ chrome.runtime.onMessage.addListener(async (message) => {
6969 return ;
7070 }
7171
72- logger . info ( 'Creating notification' , parsed . data . data ) ;
72+ logger . info ( 'Creating notification' , JSON . stringify ( parsed . data . data ) ) ;
7373 chrome . notifications . create (
7474 {
7575 type : 'basic' ,
@@ -94,6 +94,10 @@ chrome.runtime.onMessage.addListener(async (message) => {
9494 showNotification ( parsed . data ) ;
9595 break ;
9696 }
97+ case 'ping' : {
98+ logger . info ( 'Ping received' , JSON . stringify ( parsed . data . data ) ) ;
99+ break ;
100+ }
97101 default :
98102 return ;
99103 }
Original file line number Diff line number Diff line change 11export const APP_NAME = 'LGamila Live' ;
2- export const APP_VERSION = '1.1.0 ' ;
2+ export const APP_VERSION = '1.1.1 ' ;
33export const APP_DESCRIPTION =
44 'This extension shows you a real-time list of all Moroccan Twitch and Kick streamers who are currently live.' ;
55export const APP_AUTHOR = 'Stormix <hello@s.dev>' ;
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ import { WS_URL } from './lib/constants';
33import { logger } from './lib/logger' ;
44
55logger . info ( 'Offscreen script loaded' ) ;
6+
7+ // Keep the offscreen document alive
8+ setInterval ( async ( ) => {
9+ ( await navigator . serviceWorker . ready ) . active . postMessage ( 'keepAlive' ) ;
10+ } , 10_000 ) ;
11+
612const ws = new WebSocket ( WS_URL ) ;
713
814ws . onopen = ( ) => {
@@ -26,6 +32,12 @@ ws.onmessage = async (event) => {
2632 logger . info ( 'WebSocket connected' , payload . id ) ;
2733 break ;
2834 case 'ping' :
35+ logger . info ( 'WebSocket ping received' , payload . id ) ;
36+ chrome . runtime . sendMessage ( {
37+ type : 'ping' ,
38+ data : { id : payload . id , timestamp : Date . now ( ) } ,
39+ } ) ;
40+
2941 ws . send (
3042 JSON . stringify (
3143 clientToServer . parse ( {
You can’t perform that action at this time.
0 commit comments