From 7dd89a3d9baf3077e0324d48e38a95065e41fa67 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 25 Jan 2021 01:28:52 +0100 Subject: [PATCH] =?UTF-8?q?Add=20field=20=E2=80=9Cunreachable=E2=80=9D=20t?= =?UTF-8?q?o=20JSON=20and=20entry=5Ftype.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If unreachable is true, the instance is down. --- src/json.cpp | 6 ++++-- src/types.hpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/json.cpp b/src/json.cpp index c182421..69205b2 100644 --- a/src/json.cpp +++ b/src/json.cpp @@ -1,5 +1,5 @@ /* This file is part of FediBlock-backend. - * Copyright © 2020 tastytea + * Copyright © 2020, 2021 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -37,7 +37,8 @@ string to_json(const entry_type &entry) {"receipts", entry.receipts}, {"description", entry.description}, {"screenshots", filenames}, - {"report_time", entry.report_time}}; + {"report_time", entry.report_time}, + {"unreachable", entry.unreachable}}; // clang-format on return json.dump(4); } @@ -81,6 +82,7 @@ entry_type from_json(const string_view json_string) {} entry.tags = json[0].at("tags").get>(); entry.report_time = json[0].at("report_time").get(); + entry.unreachable = json[0].value("unreachable", false); return entry; } diff --git a/src/types.hpp b/src/types.hpp index 60cd8b1..83ba70f 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -35,6 +35,7 @@ struct entry_type vector screenshot_filepaths; string report_time; string json_url; + bool unreachable{false}; }; enum class http_method