Skip to content

Commit

Permalink
v4.1.4
Browse files Browse the repository at this point in the history
Fixing reload problems in spotify.php (GET)
  • Loading branch information
splitti committed Aug 24, 2024
1 parent 06e62fc commit 010e16f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
Binary file modified AdminInterface/release/www.zip
Binary file not shown.
28 changes: 25 additions & 3 deletions AdminInterface/www/spotify.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$SCOPE = urlencode($SCOPELIST);


if ($_POST['saveSettings']) {
if ( $_POST['saveSettings']) {
if ($_POST['spotifycache_active'] == "on") {
$data["spotify"]["cachestate"] = true;
} else {
Expand All @@ -20,14 +20,36 @@
$change = 1;
}

if ( $_POST['spotifyget'] ) {
$CHANGE_TXT = $CHANGE_TXT . "<li>Token-Data generated and saved</li>";
$change = 1;
}

if ($_GET['code']) {
$command = "curl -d client_id=" . $data["spotify"]["clientId"] . " -d client_secret=" . $data["spotify"]["clientSecret"] . " -d grant_type=authorization_code -d code=" . $_GET['code'] . " -d redirect_uri=" . $REDIRECT_URI . " https://accounts.spotify.com/api/token";
exec($command, $Tokenoutput, $result);
$tokendata = json_decode($Tokenoutput[0], true);
$data["spotify"]["accessToken"] = $tokendata["access_token"];
$data["spotify"]["refreshToken"] = $tokendata["refresh_token"];
$CHANGE_TXT = $CHANGE_TXT . "<li>Token-Data generated and saved</li>";
$change = 1;
$json_object = json_encode($data);
$save_rc = file_put_contents('/tmp/.mupiboxconfig.json', $json_object);
exec("sudo mv /tmp/.mupiboxconfig.json /etc/mupibox/mupiboxconfig.json");
?>
<form class="appnitro" method="post" action="spotify.php" id="form">
<div class="description">
<h2>Please wait... Data will be saved, page will reload automatically!!!</h2>
</div><p></p>
<input id="spotifyget" name="spotifyget" class="element readonly large" type="hidden" maxlength="255" value="saving" />
</form>
<p></p>
<?php
include('includes/footer.php');
?>
<script type="text/javascript">
document.getElementById('form').submit();
</script>
<?php
exit();
}

if ($_POST['setDevID']) {
Expand Down
5 changes: 5 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@
"version": "4.1.3",
"url": "https://github.com/splitti/MuPiBox/archive/refs/tags/4.1.3.zip",
"releaseinfo": "Fixed Spotify connection problems..."
},
{
"version": "4.1.4",
"url": "https://github.com/splitti/MuPiBox/archive/refs/tags/4.1.4.zip",
"releaseinfo": "Fixed Spotify connection problems..."
}
]
}
Expand Down

0 comments on commit 010e16f

Please sign in to comment.