git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit bf58c8b4 authored by Jonas Haraldsson's avatar Jonas Haraldsson

Add gnufm_key to config

Add $gnufm_key = 'default_gnufm_32_char_identifier' to config.php,
and use it when getting a scrobble session id in login.php and when
scrobbling from the website player.
This lets us re-use the session id we set at login time, and avoid
creating another session id for the player.
parent 32b88f33
......@@ -68,7 +68,7 @@ $clients = array(
array('code' => 'isp', 'api_key' => $free_apikey, 'name' => 'iSproggler', 'url' => 'http://iSproggler.org/', 'free' => True),
array('code' => 'jaj', 'api_key' => $free_apikey, 'name' => 'Jajuk', 'url' => 'http://jajuk.info/', 'free' => True),
array('code' => 'ldr', 'api_key' => $free_apikey, 'name' => 'Libre Droid', 'url' => 'http://linux.mikeasoft.com/libredroid/', 'free' => True),
array('code' => 'lfm', 'api_key' => 'hellothisisthegnufmwebsiteplayer', 'name' => $site_name, 'url' => $base_url, 'free' => True),
array('code' => 'lfm', 'api_key' => 'default_gnufm_32_char_identifier', 'name' => $site_name, 'url' => $base_url, 'free' => True),
array('code' => 'lib', 'api_key' => $free_apikey, 'name' => 'LibreTunes', 'url' => 'http://libretunes.sourceforge.net/', 'free' => True),
array('code' => 'liv', 'api_key' => $free_apikey, 'name' => 'Livewwwire', 'url' => 'http://ciarang.com', 'free' => True),
array('code' => 'lpd', 'api_key' => $free_apikey, 'name' => 'lastPod', 'url' => 'http://www.lastpod.org', 'free' => True),
......
......@@ -62,7 +62,7 @@ if (isset($_POST['install'])) {
$submissions_server = $_POST['submissions_server'];
//Write out the configuration
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$default_theme = '" . $default_theme . "';\n\$site_name = '" . $site_name . "';\n \$base_url = '" . $base_url . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "';\n \$adodb_connect_string = '" . $adodb_connect_string . "'; ";
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$default_theme = '" . $default_theme . "';\n \$site_name = '" . $site_name . "';\n \$base_url = '" . $base_url . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "';\n \$adodb_connect_string = '" . $adodb_connect_string . "';\n \$gnufm_key = 'default_gnufm_32_char_identifier'; ";
$conf_file = fopen('config.php', 'w');
$result = fwrite($conf_file, $config);
......
......@@ -25,7 +25,7 @@
var audio;
var scrobbled, now_playing, tracktoptags;
var artist, album, track, trackpage, radio_key, ws_key, station;
var artist, album, track, trackpage, radio_key, ws_key, api_key, station;
var playlist = [], current_song = 0;
var player_ready = false;
var playable_songs = false;
......@@ -37,17 +37,19 @@ var base_url = base_url || "";
* Initialises the javascript player (player.tpl must also be included on the target page)
*
* @param array list A playlist in the form ([artist, album, track, trackurl, trackpage], [...]) or false if playing a radio stream
* @param string sk Scrobble session key or false if the user isn't logged in
* @param string rk Radio session key or false if streaming isn't required
* @param string wk Web service session key or false if the user isn't logged in
* @param string rk Radio session key or false if streaming isn't required or user is logged in
* @param string stationurl Station to tune to if user is logged in.
* @param string gnufm_key GNU FM api key (should be set in config.php)
*/
function playerInit(list, ws, rk, stationurl) {
function playerInit(list, ws, rk, stationurl, gnufm_key) {
audio = document.getElementById("audio");
if (!list) {
// We're playing a stream instead of a playlist
streaming = true;
}
api_key = 'hellothisisthegnufmwebsiteplayer';
api_key = gnufm_key;
ws_key = ws;
radio_key = ws_key || rk;
station = stationurl || false;
......
......@@ -64,6 +64,7 @@ $smarty->config_dir = array($install_path . '/themes/' . $theme . '/config/', $i
$current_lang = preg_replace('/.UTF-8/', '', $current_lang);
$smarty->assign('lang_selector_array', array(($current_lang) => 1));
$smarty->assign('base_url', $base_url);
$smarty->assign('gnufm_key', $gnufm_key);
$smarty->assign('default_theme', $default_theme);
$smarty->assign('site_name', $site_name);
$smarty->assign('img_url', $base_url . '/themes/' . $theme . '/img/');
......
......@@ -74,9 +74,9 @@
var station = "{$station}";
{/if}
{if isset($this_user)}
playerInit(playlist, "{$this_user->getWebServiceSession()}", false, station);
playerInit(playlist, "{$this_user->getWebServiceSession()}", false, station, "{$gnufm_key}");
{else}
playerInit(playlist, false, radio_session, false);
playerInit(playlist, false, radio_session, false, "{$gnufm_key}");
{/if}
{rdelim});
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment