Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Version #288

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add settings for tap / track_pos hash checking
SciLor committed Jan 6, 2025
commit d2d29671b1603cd4ef42ff7482217e73c016e76c
2 changes: 2 additions & 0 deletions include/settings.h
Original file line number Diff line number Diff line change
@@ -293,6 +293,8 @@ typedef struct

bool tonies_json_auto_update;
bool full_taf_validation;
bool tap_taf_validation;
bool track_pos_taf_validation;
} settings_core_t;

typedef struct
7 changes: 5 additions & 2 deletions src/handler.c
Original file line number Diff line number Diff line change
@@ -586,9 +586,12 @@ void readTrackPositions(tonie_info_t *tonieInfo, FsFile *file)
osFreeMem(trackPos->pos);
trackPos->pos = NULL;

if (!isValidTaf(tonieInfo->contentPath, true))
if (get_settings()->core.track_pos_taf_validation)
{
TRACE_ERROR("SHA1 not valid or length different for TAF %s\r\n", tonieInfo->contentPath);
if (!isValidTaf(tonieInfo->contentPath, true))
{
TRACE_ERROR("SHA1 not valid or length different for TAF %s\r\n", tonieInfo->contentPath);
}
}
}
}
2 changes: 2 additions & 0 deletions src/settings.c
Original file line number Diff line number Diff line change
@@ -117,6 +117,8 @@ static void option_map_init(uint8_t settingsId)
OPTION_UNSIGNED("core.settings_level", &settings->core.settings_level, 1, 1, 3, "Settings level", "1: Basic, 2: Detail, 3: Expert", LEVEL_BASIC)
OPTION_BOOL("core.tonies_json_auto_update", &settings->core.tonies_json_auto_update, TRUE, "Auto-Update tonies.json", "Auto-Update tonies.json for Tonies information and images.", LEVEL_DETAIL)
OPTION_BOOL("core.full_taf_validation", &settings->core.full_taf_validation, FALSE, "Full TAF validation", "Validate TAFs by checking the audio length and the SHA1 hash. (may be slow, as file needs to be fully read!)", LEVEL_EXPERT)
OPTION_BOOL("core.tap_taf_validation", &settings->core.tap_taf_validation, FALSE, "TAP TAF validation", "Validate TAFs of TAPs by checking the audio length and the SHA1 hash. (may be slow, as file needs to be fully read!)", LEVEL_EXPERT)
OPTION_BOOL("core.track_pos_taf_validation", &settings->core.track_pos_taf_validation, TRUE, "Track position error TAF validation", "Validate TAFs when track position error occurs by checking the audio length and the SHA1 hash. (may be slow, as file needs to be fully read!)", LEVEL_DETAIL)

OPTION_TREE_DESC("security_mit", "Security mitigation", LEVEL_EXPERT)
OPTION_BOOL("security_mit.warnAccess", &settings->security_mit.warnAccess, TRUE, "Warning on unwanted access", "If teddyCloud detects unusal access, warn on frontend until restart. (See on*)", LEVEL_EXPERT)
2 changes: 1 addition & 1 deletion src/tonie_audio_playlist.c
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ error_t tap_load(char *filename, tonie_audio_playlist_t *tap)
cJSON_Delete(tapJson);
if (error == NO_ERROR)
{
if (isValidTaf(tap->_filepath_resolved, true))
if (isValidTaf(tap->_filepath_resolved, get_settings()->core.tap_taf_validation))
{
tap->_cached = true;
// TODO check audio id if different and check settings.