@@ -221,6 +221,12 @@ app.get("/widgets", (_req, res) => {
221221
222222// Plugin store
223223const REGISTRY_URL = "https://raw.githubusercontent.com/florextech/deck-plugins/main/registry.json" ;
224+ const LOCAL_REGISTRY = [
225+ { id : "clock" , name : "Clock" , description : "Shows current time and date" , author : "Deck" , version : "1.0.0" , official : true , tags : [ "widget" , "utility" ] , platforms : [ "macos" , "windows" , "linux" ] , url : "https://raw.githubusercontent.com/florextech/deck/main/plugins-available/clock.js" } ,
226+ { id : "system-monitor" , name : "System Monitor" , description : "CPU, RAM usage and uptime widget" , author : "Deck" , version : "1.0.0" , official : true , tags : [ "widget" , "system" ] , platforms : [ "macos" , "windows" , "linux" ] , url : "https://raw.githubusercontent.com/florextech/deck/main/plugins-available/system-monitor.js" } ,
227+ { id : "spotify" , name : "Spotify" , description : "Control Spotify playback and see now playing" , author : "Deck" , version : "1.0.0" , official : true , tags : [ "media" , "music" ] , platforms : [ "macos" ] , url : "https://raw.githubusercontent.com/florextech/deck/main/plugins-available/spotify.js" } ,
228+ { id : "pomodoro" , name : "Pomodoro Timer" , description : "25 min focus timer with notification" , author : "Deck" , version : "1.0.0" , official : true , tags : [ "productivity" , "timer" ] , platforms : [ "macos" , "windows" , "linux" ] , url : "https://raw.githubusercontent.com/florextech/deck/main/plugins-available/pomodoro.js" } ,
229+ ] ;
224230
225231function currentPlatform ( ) : string {
226232 const p = process . platform ;
@@ -234,22 +240,19 @@ app.get("/plugins/store", async (_req, res) => {
234240 const installed = existsSync ( pluginsDir ) ? readdirSync ( pluginsDir ) . filter ( f => f . endsWith ( ".js" ) ) . map ( f => f . replace ( ".js" , "" ) ) : [ ] ;
235241 const state = loadPluginsState ( ) ;
236242 const platform = currentPlatform ( ) ;
243+ let registryPlugins : Array < { id : string ; platforms ?: string [ ] ; [ k : string ] : unknown } > = LOCAL_REGISTRY ;
237244 try {
238245 const r = await fetch ( REGISTRY_URL , { signal : AbortSignal . timeout ( 5000 ) } ) ;
239- const data = await r . json ( ) as { plugins : unknown [ ] } ;
240- const plugins = ( data . plugins as Array < { id : string ; platforms ?: string [ ] } > ) . map ( p => ( { ... p , installed : installed . includes ( p . id ) , disabled : ! ! state [ p . id ] ?. disabled , currentPlatform : platform } ) ) ;
241- // Add local-only plugins not in registry
242- for ( const id of installed ) {
243- if ( ! plugins . find ( p => p . id === id ) ) {
244- plugins . push ( { id , name : id , description : "Installed locally" , installed : true , disabled : ! ! state [ id ] ?. disabled , currentPlatform : platform } as never ) ;
245- }
246+ const data = await r . json ( ) as { plugins : Array < { id : string ; platforms ?: string [ ] } > } ;
247+ if ( data . plugins && data . plugins . length ) registryPlugins = data . plugins ;
248+ } catch { /* use local fallback */ }
249+ const plugins = registryPlugins . map ( p => ( { ... p , installed : installed . includes ( p . id ) , disabled : ! ! state [ p . id ] ?. disabled , currentPlatform : platform } ) ) ;
250+ for ( const id of installed ) {
251+ if ( ! plugins . find ( p => p . id === id ) ) {
252+ plugins . push ( { id , name : id , description : "Installed locally" , installed : true , disabled : ! ! state [ id ] ?. disabled , currentPlatform : platform } as never ) ;
246253 }
247- res . json ( { plugins } ) ;
248- } catch {
249- // Fallback: show installed plugins even if registry is unreachable
250- const plugins = installed . map ( id => ( { id, name : id , description : "Installed locally" , installed : true , disabled : ! ! state [ id ] ?. disabled , currentPlatform : platform } ) ) ;
251- res . json ( { plugins, offline : true } ) ;
252254 }
255+ res . json ( { plugins } ) ;
253256} ) ;
254257
255258app . post ( "/plugins/toggle" , ( req , res ) => {
0 commit comments