Add field “unreachable” to JSON and entry_type.
If unreachable is true, the instance is down.
This commit is contained in:
parent
2816116136
commit
7dd89a3d9b
|
@ -1,5 +1,5 @@
|
|||
/* This file is part of FediBlock-backend.
|
||||
* Copyright © 2020 tastytea <tastytea@tastytea.de>
|
||||
* Copyright © 2020, 2021 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* 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<vector<string>>();
|
||||
entry.report_time = json[0].at("report_time").get<string>();
|
||||
entry.unreachable = json[0].value("unreachable", false);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ struct entry_type
|
|||
vector<string> screenshot_filepaths;
|
||||
string report_time;
|
||||
string json_url;
|
||||
bool unreachable{false};
|
||||
};
|
||||
|
||||
enum class http_method
|
||||
|
|
Reference in New Issue