Skip to content

Commit

Permalink
add boxColorId
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed Apr 29, 2024
1 parent e64b5bb commit 348756b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ typedef struct
uint32_t configVersion;
char *commonName;
char *boxName;
char *boxColorId;
settings_core_t core;
settings_cloud_t cloud;
settings_encode_t encode;
Expand Down
1 change: 1 addition & 0 deletions src/handler_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ error_t handleApiGetBoxes(HttpConnection *connection, const char_t *uri, const c
cJSON_AddStringToObject(jsonEntry, "ID", settings->internal.overlayUniqueId);
cJSON_AddStringToObject(jsonEntry, "commonName", settings->commonName);
cJSON_AddStringToObject(jsonEntry, "boxName", settings->boxName);
cJSON_AddStringToObject(jsonEntry, "boxColorId", settings->boxColorId); // TODO add color name + url

cJSON_AddItemToArray(jsonArray, jsonEntry);
}
Expand Down
4 changes: 3 additions & 1 deletion src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ static void option_map_init(uint8_t settingsId)
OPTION_INTERNAL_UNSIGNED("configVersion", &settings->configVersion, 0, 0, 255, "Config version")
OPTION_INTERNAL_STRING("commonName", &settings->commonName, "default", "common name of the certificate (for overlays)")
OPTION_INTERNAL_STRING("boxName", &settings->boxName, "Toniebox", "Name of the box")
OPTION_INTERNAL_STRING("boxColorId", &settings->boxColorId, "", "Color ID of the box")

OPTION_TREE_DESC("log", "Logging")
OPTION_UNSIGNED("log.level", &settings->log.level, 4, 0, 6, "Loglevel", "0=off - 6=verbose")
Expand Down Expand Up @@ -361,6 +362,7 @@ settings_t *get_settings_cn(const char *commonName)
settings_set_string_id("commonName", boxId, i);
settings_set_string_id("internal.overlayUniqueId", boxId, i);
settings_set_string_id("boxName", boxName, i);
settings_set_string_id("boxColorId", "", i);
settings_get_by_name_id("core.client_cert.file.crt", i)->overlayed = true;
settings_get_by_name_id("core.client_cert.file.key", i)->overlayed = true;
Settings_Overlay[i].internal.config_used = true;
Expand Down Expand Up @@ -660,7 +662,7 @@ error_t settings_save_ovl(bool overlay)
while (option_map[pos].type != TYPE_END)
{
setting_item_t *opt = &option_map[pos];
if (!opt->internal || !osStrcmp(opt->option_name, "configVersion") || (overlay && (!osStrcmp(opt->option_name, "commonName") || !osStrcmp(opt->option_name, "boxName"))))
if (!opt->internal || !osStrcmp(opt->option_name, "configVersion") || (overlay && (!osStrcmp(opt->option_name, "commonName") || !osStrcmp(opt->option_name, "boxName") || !osStrcmp(opt->option_name, "boxColorId"))))
{
char *overlayPrefix;
if (overlay)
Expand Down

0 comments on commit 348756b

Please sign in to comment.