From d8212c261f1c8976ebbc9ec1023ed10cf3c5080d Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 9 Jan 2021 14:35:58 +0100 Subject: [PATCH] Write URL to JSON file into entries. --- src/files.cpp | 9 ++++++++- src/types.hpp | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/files.cpp b/src/files.cpp index 7c00394..e32fae2 100644 --- a/src/files.cpp +++ b/src/files.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 @@ -15,6 +15,7 @@ */ #include "files.hpp" +#include "config.hpp" #include "fs-compat.hpp" #include "json.hpp" #include "types.hpp" @@ -152,6 +153,8 @@ string get_access_token() vector read_json_files(const bool cache) { + using namespace FediBlock::config; + vector entries; // clang-format off @@ -210,6 +213,10 @@ vector read_json_files(const bool cache) } } } + entry.json_url = format("https://{:s}/{:s}/{:s}/raw/branch/{:s}/{:s}", + forge_domain, forge_org, forge_repo_data, + forge_repo_data_branch, + path.filename().string()); entries.push_back(entry); } diff --git a/src/types.hpp b/src/types.hpp index 1cb8bc3..60cd8b1 100644 --- a/src/types.hpp +++ b/src/types.hpp @@ -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 @@ -34,6 +34,7 @@ struct entry_type string description; vector screenshot_filepaths; string report_time; + string json_url; }; enum class http_method