mirror of
				https://github.com/billz/raspap-webgui.git
				synced 2025-03-01 10:31:47 +00:00 
			
		
		
		
	Use callbackTimeout w/ getUserPlugins(), handle err if >2000ms
This commit is contained in:
		@@ -117,8 +117,20 @@ function DisplaySystem(&$extraFooterScripts)
 | 
				
			|||||||
    $extraFooterScripts[] = array('src'=>'app/js/huebee.js', 'defer'=>false);
 | 
					    $extraFooterScripts[] = array('src'=>'app/js/huebee.js', 'defer'=>false);
 | 
				
			||||||
    $logLimit = isset($_SESSION['log_limit']) ? $_SESSION['log_limit'] : RASPI_LOG_SIZE_LIMIT;
 | 
					    $logLimit = isset($_SESSION['log_limit']) ? $_SESSION['log_limit'] : RASPI_LOG_SIZE_LIMIT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $plugins = $pluginInstaller->getUserPlugins();
 | 
					    try {
 | 
				
			||||||
    $pluginsTable = $pluginInstaller->getHTMLPluginsTable($plugins);
 | 
					        $plugins = callbackTimeout(fn() => $pluginInstaller->getUserPlugins(), 2000);
 | 
				
			||||||
 | 
					        $pluginsTable = $pluginInstaller->getHTMLPluginsTable($plugins);
 | 
				
			||||||
 | 
					    } catch (\Exception $e) {
 | 
				
			||||||
 | 
					        $errResponse = sprintf(
 | 
				
			||||||
 | 
					            '<div class="mt-3 mb-2"><strong>%s:</strong> %s. <strong>%s</strong> %s.</div>',
 | 
				
			||||||
 | 
					            _('Error'),
 | 
				
			||||||
 | 
					            _('Unable to load plugins'),
 | 
				
			||||||
 | 
					            _('Reload'),
 | 
				
			||||||
 | 
					            _('and try again')
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					        $errResponse.= '<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> '. _("Reload") .'</a>';
 | 
				
			||||||
 | 
					        $pluginsTable = $errResponse;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    echo renderTemplate("system", compact(
 | 
					    echo renderTemplate("system", compact(
 | 
				
			||||||
        "arrLocales",
 | 
					        "arrLocales",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user