From d7093b0babaa56b27230ab7df4566a360e5f5d37 Mon Sep 17 00:00:00 2001 From: philippe44 Date: Fri, 26 Dec 2025 18:02:29 +0100 Subject: [PATCH] Spotify secrets --- components/spotify/CMakeLists.txt | 6 ++++++ components/spotify/Shim.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/components/spotify/CMakeLists.txt b/components/spotify/CMakeLists.txt index 9b78f37a..f2b2c0e4 100644 --- a/components/spotify/CMakeLists.txt +++ b/components/spotify/CMakeLists.txt @@ -21,6 +21,12 @@ set(BELL_DISABLE_MQTT ON) set(BELL_DISABLE_WEBSERVER ON) set(CSPOT_TARGET_ESP32 ON) +set(_secret $ENV{SPOTIFY_SECRET}) +if(_secret) + separate_arguments(_secret) + set_source_files_properties(shim.cpp PROPERTIES COMPILE_OPTIONS "${_secret}") +endif() + # because CMake is so broken, the cache set below overrides a normal "set" for the first build set(BELL_EXTERNAL_VORBIS "idf::codecs" CACHE STRING "provide own codecs") set(BELL_EXTERNAL_CJSON "idf::json" CACHE STRING "provide own CJSON") diff --git a/components/spotify/Shim.cpp b/components/spotify/Shim.cpp index 261509ac..abcc41de 100644 --- a/components/spotify/Shim.cpp +++ b/components/spotify/Shim.cpp @@ -32,16 +32,16 @@ #include "platform_config.h" #include "nvs_utilities.h" #include "tools.h" - + +#if !defined(CLIENT_ID) || !defined(CLIENT_SECRET) #if __has_include("client_info.h") #include "client_info.h" -#endif - -#if !defined(CLIENT_ID) || !defined(CLIENT_SECRET) +#else #warning "missing Spotify's CLIENT_ID and/or CLIENT_SECRET (set env varibles or in client_info.h" #define CLIENT_ID "" #define CLIENT_SECRET "" #endif +#endif static class cspotPlayer *player;