ghdl: display timestamp for each release and asset
This commit is contained in:
@@ -32,12 +32,15 @@ struct GhApiAsset {
|
|||||||
std::string content_type{};
|
std::string content_type{};
|
||||||
u64 size{};
|
u64 size{};
|
||||||
u64 download_count{};
|
u64 download_count{};
|
||||||
|
std::string updated_at{};
|
||||||
std::string browser_download_url{};
|
std::string browser_download_url{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GhApiEntry {
|
struct GhApiEntry {
|
||||||
std::string tag_name{};
|
std::string tag_name{};
|
||||||
std::string name{};
|
std::string name{};
|
||||||
|
std::string published_at{};
|
||||||
|
bool prerelease{};
|
||||||
std::vector<GhApiAsset> assets{};
|
std::vector<GhApiAsset> assets{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -72,23 +72,17 @@ void from_json(yyjson_val* json, GhApiAsset& e) {
|
|||||||
JSON_SET_STR(content_type);
|
JSON_SET_STR(content_type);
|
||||||
JSON_SET_UINT(size);
|
JSON_SET_UINT(size);
|
||||||
JSON_SET_UINT(download_count);
|
JSON_SET_UINT(download_count);
|
||||||
|
JSON_SET_STR(updated_at);
|
||||||
JSON_SET_STR(browser_download_url);
|
JSON_SET_STR(browser_download_url);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// void from_json(const fs::FsPath& path, GhApiEntry& e) {
|
|
||||||
// JSON_INIT_VEC_FILE(path, nullptr, nullptr);
|
|
||||||
// JSON_OBJ_ITR(
|
|
||||||
// JSON_SET_STR(tag_name);
|
|
||||||
// JSON_SET_STR(name);
|
|
||||||
// JSON_SET_ARR_OBJ(assets);
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
void from_json(yyjson_val* json, GhApiEntry& e) {
|
void from_json(yyjson_val* json, GhApiEntry& e) {
|
||||||
JSON_OBJ_ITR(
|
JSON_OBJ_ITR(
|
||||||
JSON_SET_STR(tag_name);
|
JSON_SET_STR(tag_name);
|
||||||
JSON_SET_STR(name);
|
JSON_SET_STR(name);
|
||||||
|
JSON_SET_STR(published_at);
|
||||||
|
JSON_SET_BOOL(prerelease);
|
||||||
JSON_SET_ARR_OBJ(assets);
|
JSON_SET_ARR_OBJ(assets);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -362,7 +356,18 @@ void Menu::DownloadEntries() {
|
|||||||
|
|
||||||
PopupList::Items entry_items;
|
PopupList::Items entry_items;
|
||||||
for (const auto& e : gh_entries) {
|
for (const auto& e : gh_entries) {
|
||||||
entry_items.emplace_back(e.name);
|
std::string str;
|
||||||
|
if (!e.name.empty()) {
|
||||||
|
str += e.name + " | ";
|
||||||
|
} else {
|
||||||
|
str += e.tag_name + " | ";
|
||||||
|
}
|
||||||
|
if (e.prerelease) {
|
||||||
|
str += " (Pre-Release)";
|
||||||
|
}
|
||||||
|
str += " [" + e.published_at.substr(0, 10) + "]";
|
||||||
|
|
||||||
|
entry_items.emplace_back(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
App::Push<PopupList>("Select release to download for "_i18n + GetEntry().repo, entry_items, [this](auto op_index){
|
App::Push<PopupList>("Select release to download for "_i18n + GetEntry().repo, entry_items, [this](auto op_index){
|
||||||
@@ -393,7 +398,10 @@ void Menu::DownloadEntries() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!using_name || found) {
|
if (!using_name || found) {
|
||||||
asset_items.emplace_back(p.name);
|
std::string str = p.name + " | ";
|
||||||
|
str += " [" + p.updated_at.substr(0, 10) + "]";
|
||||||
|
|
||||||
|
asset_items.emplace_back(str);
|
||||||
api_assets.emplace_back(p);
|
api_assets.emplace_back(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <yyjson.h>
|
#include <yyjson.h>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
namespace sphaira::ui::menu::main {
|
namespace sphaira::ui::menu::main {
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
Reference in New Issue
Block a user