From d0dda48e791e6f08f6be3936623a2c305caacb3c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 8 Sep 2022 20:31:30 +0200 Subject: Peertube: load known instances from config file --- src/Config.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'src/Config.cpp') diff --git a/src/Config.cpp b/src/Config.cpp index c6c2a29..9272939 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -108,6 +108,28 @@ namespace QuickMedia { }); } + static void peertube_known_instances_fallback() { + config->peertube.known_instances.insert(config->peertube.known_instances.end(), { + "https://tube.midov.pl", + "https://videos.lukesmith.xyz", + "https://peertube.se", + "https://bittube.video", + "https://video.nobodyhasthe.biz", + "https://libre.tube", + "https://open.tube", + "https://runtube.re", + "https://tube.kenfm.de", + "https://tcode.kenfm.de", + "https://tube.querdenken-711.de", + "https://peertube.rage.lol", + "https://gegenstimme.tv", + "https://tv.poa.st", + "https://libre.video", + "https://gorf.tube", + "https://neogenesis.tv" + }); + } + static void config_load_fail_fallback() { matrix_known_homeservers_fallback(); } @@ -195,12 +217,12 @@ namespace QuickMedia { if(youtube_json.isObject()) get_json_value(youtube_json, "load_progress", config->youtube.load_progress); - bool has_known_homeservers_config = false; + bool has_known_matrix_homeservers_config = false; const Json::Value &matrix_json = json_root["matrix"]; if(matrix_json.isObject()) { const Json::Value &known_homeservers_json = matrix_json["known_homeservers"]; if(known_homeservers_json.isArray()) { - has_known_homeservers_config = true; + has_known_matrix_homeservers_config = true; for(const Json::Value &known_homeserver : known_homeservers_json) { if(!known_homeserver.isString()) { fprintf(stderr, "Warning: matrix.known_homeservers config contains non string value\n"); @@ -211,9 +233,28 @@ namespace QuickMedia { } } - if(!has_known_homeservers_config) + if(!has_known_matrix_homeservers_config) matrix_known_homeservers_fallback(); + bool has_known_peertube_homeservers_config = false; + const Json::Value &peertube_json = json_root["peertube"]; + if(peertube_json.isObject()) { + const Json::Value &known_instances_json = peertube_json["known_instances"]; + if(known_instances_json.isArray()) { + has_known_peertube_homeservers_config = true; + for(const Json::Value &known_instance : known_instances_json) { + if(!known_instance.isString()) { + fprintf(stderr, "Warning: peertube.known_instances config contains non string value\n"); + continue; + } + config->peertube.known_instances.push_back(known_instance.asString()); + } + } + } + + if(!has_known_peertube_homeservers_config) + peertube_known_instances_fallback(); + get_json_value(json_root, "use_system_fonts", config->use_system_fonts); get_json_value(json_root, "use_system_mpv_config", config->use_system_mpv_config); get_json_value(json_root, "enable_shaders", config->enable_shaders); -- cgit v1.2.3