diff --git a/assets/lang/en.php b/assets/lang/en.php index b2a1f6b..97c5889 100644 --- a/assets/lang/en.php +++ b/assets/lang/en.php @@ -2,6 +2,7 @@ define('IndexTitle', 'Welcome to NowPlaying for Spotify!'); define('IndexDescription', 'Please login with your Spotify account.'); define('IndexConnection', 'Login to Spotify'); +define('GenerateMiniPlayer', 'Generate mini player'); define('IndexCookie', 'By clicking on \'LOGIN TO SPOTIFY\', you accept the use of cookies necessary for the proper functioning of the site.'); define('defaultTitleSong', 'No music currently playing'); diff --git a/assets/lang/fr.php b/assets/lang/fr.php index 686e34e..34d40e7 100644 --- a/assets/lang/fr.php +++ b/assets/lang/fr.php @@ -2,6 +2,7 @@ define('IndexTitle', 'Bienvenue sur NowPlaying for Spotify !'); define('IndexDescription', 'Veuillez vous connecter avec votre compte Spotify.'); define('IndexConnection', 'Se connecter à Spotify'); +define('GenerateMiniPlayer', 'Générer un lecteur miniature'); define('IndexCookie', 'En cliquant sur \'SE CONNECTER À SPOTIFY\', vous acceptez l\'utilisation de cookies nécessaires au bon fonctionnement du site.'); define('defaultTitleSong', 'Aucune musique en cours de lecture'); diff --git a/generate_miniplayer.php b/generate_miniplayer.php new file mode 100644 index 0000000..fefce8e --- /dev/null +++ b/generate_miniplayer.php @@ -0,0 +1,191 @@ + + + + + + Generate mini player - NowPlaying + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + Logo + + +
+

+ + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ + + + + diff --git a/index.php b/index.php index 9f7c856..9fac7e2 100644 --- a/index.php +++ b/index.php @@ -97,7 +97,11 @@ class="text-white/50 hover:text-white transition h-6 w-6" - +
+ + + +
diff --git a/lang.php b/lang.php index 9ee494d..96820f0 100644 --- a/lang.php +++ b/lang.php @@ -75,4 +75,7 @@ $lang = 'az'; break; } + +// Default language +include_once 'assets/lang/en.php'; ?> diff --git a/login.php b/login.php index 2a83960..e894155 100644 --- a/login.php +++ b/login.php @@ -1,20 +1,22 @@ load(); - - $session = new SpotifyWebAPI\Session( -$CLIENT_ID = $_ENV['CLIENT_ID'], -$CLIENT_SECRET = $_ENV['CLIENT_SECRET'], -$REDIRECT_URI = $_ENV['REDIRECT_URI'], - - + $CLIENT_ID = $_ENV['CLIENT_ID'], + $CLIENT_SECRET = $_ENV['CLIENT_SECRET'], + $REDIRECT_URI = $_ENV['REDIRECT_URI'], ); +if ($_GET['generateMiniPlayer'] == 'true') { + $_SESSION['generateMiniPlayer'] = true; +} else { + $_SESSION['generateMiniPlayer'] = false; +} + $options = [ 'scope' => [ 'user-read-currently-playing', diff --git a/miniplayer.php b/miniplayer.php index 48fcf86..943ae25 100644 --- a/miniplayer.php +++ b/miniplayer.php @@ -2,7 +2,7 @@ include_once('lang.php'); ?> - + Spotify Connect - Now Playing @@ -82,7 +82,15 @@ class="absolute bottom-[10%] right-[10%] z-30 p-3 bg-black/20 border-2 border-wh
-

+

requestAccessToken($_GET['code']); $accessToken = $session->getAccessToken(); @@ -22,9 +22,7 @@ $refreshToken = $session->getRefreshToken(); $refreshTime = time() + 3600; setcookie('refreshToken', $refreshToken, time() + (3600 * 365)); - } elseif ($_GET['action'] == "refresh") { - $session->refreshAccessToken($refreshToken); $accessToken = $session->getAccessToken(); @@ -43,6 +41,11 @@ )); die(); } else { + if ($_SESSION['generateMiniPlayer'] == true) { + header('Location: generate_miniplayer.php'); + die(); + } + header('Location: playing.php'); die(); }