mirror of
https://github.com/Goldenkrew3000/OSSP_OpenSource.git
synced 2025-12-18 15:54:44 +10:00
Added config option to not leak OS information over discord RPC and temporarially fixed macOS builds
This commit is contained in:
@@ -15,10 +15,16 @@ pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
|
||||
|
||||
add_subdirectory(external/discord-rpc)
|
||||
|
||||
if(APPLE)
|
||||
link_directories(/opt/homebrew/Cellar/glib/2.86.0/lib)
|
||||
link_directories(/opt/homebrew/lib)
|
||||
endif()
|
||||
|
||||
add_executable(ossp MACOSX_BUNDLE
|
||||
main.c
|
||||
gui/gui_entry.cpp
|
||||
configHandler.c
|
||||
discordrpc.c
|
||||
gui/gui_entry.cpp
|
||||
player/player.c
|
||||
player/playQueue.cpp
|
||||
libopensubsonic/crypto.c
|
||||
|
||||
20
src/build.sh
20
src/build.sh
@@ -1,20 +0,0 @@
|
||||
gcc main.c \
|
||||
configHandler.c \
|
||||
libopensubsonic/httpclient.c \
|
||||
external/cJSON.c \
|
||||
external/md5.c \
|
||||
libopensubsonic/utils.c \
|
||||
libopensubsonic/logger.c \
|
||||
libopensubsonic/crypto.c \
|
||||
libopensubsonic/endpoint_ping.c \
|
||||
libopensubsonic/endpoint_getAlbum.c \
|
||||
libopensubsonic/endpoint_getSong.c \
|
||||
libopensubsonic/endpoint_getPlaylists.c \
|
||||
libopensubsonic/endpoint_getPlaylist.c \
|
||||
libopensubsonic/endpoint_getArtists.c \
|
||||
libopensubsonic/endpoint_getArtist.c \
|
||||
libopensubsonic/endpoint_getLyricsBySongId.c \
|
||||
libopensubsonic/endpoint_getAlbumList.c \
|
||||
libopensubsonic/endpoint_getStarred.c \
|
||||
libopensubsonic/endpoint_scrobble.c \
|
||||
-o main -lcurl
|
||||
@@ -39,6 +39,7 @@ int configHandler_Read(configHandler_config_t** configObj) {
|
||||
(*configObj)->lastfm_api_session_key = NULL;
|
||||
(*configObj)->discordrpc_enable = false;
|
||||
(*configObj)->discordrpc_method = 0;
|
||||
(*configObj)->discordrpc_showSysDetails = false;
|
||||
(*configObj)->audio_equalizer_enable = false;
|
||||
(*configObj)->audio_equalizer_followPitch = false;
|
||||
(*configObj)->audio_equalizer_graphCount = 0;
|
||||
@@ -234,6 +235,13 @@ int configHandler_Read(configHandler_config_t** configObj) {
|
||||
(*configObj)->discordrpc_method = discordrpc_method->valueint;
|
||||
}
|
||||
|
||||
cJSON* discordrpc_showSysDetails = cJSON_GetObjectItemCaseSensitive(discordrpc_root, "showSystemDetails");
|
||||
if (cJSON_IsBool(discordrpc_showSysDetails)) {
|
||||
if (cJSON_IsTrue(discordrpc_showSysDetails)) {
|
||||
(*configObj)->discordrpc_showSysDetails = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Make an object from audio
|
||||
cJSON* audio_root = cJSON_GetObjectItemCaseSensitive(root, "audio");
|
||||
if (audio_root == NULL) {
|
||||
|
||||
@@ -33,6 +33,7 @@ typedef struct {
|
||||
// Discord RPC Settings
|
||||
bool discordrpc_enable; // Enable Discord RPC
|
||||
int discordrpc_method; // Discord RPC Method (0 = Regular, 1 = DscrdRPC)
|
||||
bool discordrpc_showSysDetails; // Show 'on OS ARCH VERSION' in RPC
|
||||
|
||||
// Audio Settings
|
||||
bool audio_equalizer_enable;
|
||||
|
||||
@@ -10,8 +10,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "external/discord-rpc/include/discord_rpc.h"
|
||||
#include "libopensubsonic/logger.h"
|
||||
#include "configHandler.h"
|
||||
#include "discordrpc.h"
|
||||
|
||||
extern configHandler_config_t* configObj;
|
||||
const char* discordrpc_appid = "1407025303779278980";
|
||||
char* discordrpc_osString = NULL;
|
||||
static int rc = 0;
|
||||
@@ -64,6 +67,8 @@ void discordrpc_init() {
|
||||
discordrpc_osString = discordrpc_getOS();
|
||||
}
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
void discordrpc_update(discordrpc_data** discordrpc_struct) {
|
||||
printf("[DiscordRPC] Updating...\n");
|
||||
DiscordRichPresence presence;
|
||||
@@ -81,7 +86,9 @@ void discordrpc_update(discordrpc_data** discordrpc_struct) {
|
||||
presence.state = stateString;
|
||||
// TODO: Discord is currently broken for this rn
|
||||
//presence.largeImageKey = (*discordrpc_struct)->coverArtUrl;
|
||||
presence.largeImageText = discordrpc_osString;
|
||||
if (configObj->discordrpc_showSysDetails) {
|
||||
presence.largeImageText = discordrpc_osString;
|
||||
}
|
||||
} else if ((*discordrpc_struct)->state == DISCORDRPC_STATE_PAUSED) {
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user