greyhound.php
changeset 58 05a69bab5f10
parent 55 b8a3c9c54fbe
child 64 ee64bb096f56
equal deleted inserted replaced
57:31ce64a3ff6c 58:05a69bab5f10
   110 $playlist = array();
   110 $playlist = array();
   111 $amarok_home = false;
   111 $amarok_home = false;
   112 rebuild_playlist();
   112 rebuild_playlist();
   113 
   113 
   114 // startup webserver
   114 // startup webserver
   115 $ip = ( $public ) ? '0.0.0.0' : '127.0.0.1';
   115 $ip = array();
       
   116 if ( !$enable_ipv4 && !$enable_ipv6 )
       
   117 {
       
   118   warning('Both IPv4 and IPv6 are disabled, enabling IPv4 access');
       
   119   $enable_ipv4 = true;
       
   120 }
       
   121 if ( $public )
       
   122 {
       
   123   if ( $enable_ipv6 )
       
   124     $ip[] = '::';
       
   125   if ( $enable_ipv4 )
       
   126     $ip[] = '0.0.0.0';
       
   127 }
       
   128 else
       
   129 {
       
   130   if ( $enable_ipv6 )
       
   131     $ip[] = '::1';
       
   132   if ( $enable_ipv4 )
       
   133     $ip[] = '127.0.0.1';
       
   134 }
       
   135 
   116 $port = 7447;
   136 $port = 7447;
   117 
   137 
   118 try
   138 try
   119 {
   139 {
   120   status('starting PhpHttpd');
   140   status('starting PhpHttpd');
   158   $httpd->add_handler('api',                  'function', 'api_request_handler');
   178   $httpd->add_handler('api',                  'function', 'api_request_handler');
   159   $httpd->add_handler('scripts',              'dir',      GREY_ROOT . '/scripts');
   179   $httpd->add_handler('scripts',              'dir',      GREY_ROOT . '/scripts');
   160   $httpd->add_handler('favicon.ico',          'file',     GREY_ROOT . '/amarok_icon.ico');
   180   $httpd->add_handler('favicon.ico',          'file',     GREY_ROOT . '/amarok_icon.ico');
   161   $httpd->add_handler('apple-touch-icon.png', 'file',     GREY_ROOT . '/apple-touch-icon.png');
   181   $httpd->add_handler('apple-touch-icon.png', 'file',     GREY_ROOT . '/apple-touch-icon.png');
   162   $httpd->add_handler('spacer.gif',           'file',     GREY_ROOT . '/spacer.gif');
   182   $httpd->add_handler('spacer.gif',           'file',     GREY_ROOT . '/spacer.gif');
       
   183   $httpd->add_handler('trans80.png',          'file',     GREY_ROOT . '/trans80.png');
   163   $httpd->threader->ipc_register('reloadconfig', 'grey_reload_config');
   184   $httpd->threader->ipc_register('reloadconfig', 'grey_reload_config');
   164   // load all themes if forking is enabled
   185   // load all themes if forking is enabled
   165   // Themes are loaded when the playlist is requested. This is fine for
   186   // Themes are loaded when the playlist is requested. This is fine for
   166   // single-threaded operation, but if the playlist handler is only loaded
   187   // single-threaded operation, but if the playlist handler is only loaded
   167   // in a child process, we need to preload all themes into the parent before
   188   // in a child process, we need to preload all themes into the parent before