webcontrol.php
changeset 3 e7447a6044ec
parent 2 860ba7141641
child 4 cde92f6ec29f
equal deleted inserted replaced
2:860ba7141641 3:e7447a6044ec
    52 $playlist = array();
    52 $playlist = array();
    53 rebuild_playlist();
    53 rebuild_playlist();
    54 
    54 
    55 // startup webserver
    55 // startup webserver
    56 $ip = ( $public ) ? '0.0.0.0' : '127.0.0.1';
    56 $ip = ( $public ) ? '0.0.0.0' : '127.0.0.1';
    57 $port = mt_rand(1025, 65534); // 7447;
    57 $port = 7447;
    58 
    58 
    59 try
    59 try
    60 {
    60 {
    61   status('starting PhpHttpd');
    61   status('starting PhpHttpd');
    62   $httpd = new WebServer($ip, $port);
    62   $httpd = new WebServer($ip, $port);
    64   // setup handlers
    64   // setup handlers
    65   status('initializing handlers');
    65   status('initializing handlers');
    66   $httpd->add_handler('index', 'function', 'amarok_playlist');
    66   $httpd->add_handler('index', 'function', 'amarok_playlist');
    67   $httpd->add_handler('action.json', 'function', 'ajax_request_handler');
    67   $httpd->add_handler('action.json', 'function', 'ajax_request_handler');
    68   $httpd->add_handler('scripts', 'dir', './scripts');
    68   $httpd->add_handler('scripts', 'dir', './scripts');
       
    69   $httpd->add_handler('favicon.ico', 'file', './amarok_icon.ico');
       
    70   $httpd->add_handler('apple-touch-icon.png', 'file', './apple-touch-icon.png');
    69   $httpd->add_handler("themes/$theme", 'dir', "./themes/$theme");
    71   $httpd->add_handler("themes/$theme", 'dir', "./themes/$theme");
    70   $httpd->allow_dir_list = true;
    72   $httpd->allow_dir_list = true;
    71   $httpd->default_document = 'index';
    73   $httpd->default_document = 'index';
    72   
    74   
    73   status("Entering main server loop - ^C to interrupt, listening on port $port");
    75   status("Entering main server loop - ^C to interrupt, listening on port $port");