Add UUID to app list response
This commit is contained in:
@@ -45,7 +45,7 @@ namespace crypto {
|
||||
input_touch = _input << 1, // Allow touch input
|
||||
input_pen = _input << 2, // Allow pen input
|
||||
input_mouse = _input << 3, // Allow mouse input
|
||||
input_kbd = _input << 4, // Allow keyboard input
|
||||
input_kbd = _input << 4, // Allow keyboard input
|
||||
_all_inputs = input_controller | input_touch | input_pen | input_mouse | input_kbd,
|
||||
|
||||
_operation = _input << 8, // Operation permission group
|
||||
|
||||
@@ -957,25 +957,27 @@ namespace nvhttp {
|
||||
|
||||
auto named_cert_p = get_verified_cert(request);
|
||||
if (!!(named_cert_p->perm & PERM::_all_actions)) {
|
||||
for (auto &proc : proc::proc.get_apps()) {
|
||||
pt::ptree app;
|
||||
for (auto &app : proc::proc.get_apps()) {
|
||||
pt::ptree app_node;
|
||||
|
||||
app.put("IsHdrSupported"s, video::active_hevc_mode == 3 ? 1 : 0);
|
||||
app.put("AppTitle"s, proc.name);
|
||||
app.put("ID", proc.id);
|
||||
app_node.put("IsHdrSupported"s, video::active_hevc_mode == 3 ? 1 : 0);
|
||||
app_node.put("AppTitle"s, app.name);
|
||||
app_node.put("UUID", app.uuid);
|
||||
app_node.put("ID", app.id);
|
||||
|
||||
apps.push_back(std::make_pair("App", std::move(app)));
|
||||
apps.push_back(std::make_pair("App", std::move(app_node)));
|
||||
}
|
||||
} else {
|
||||
BOOST_LOG(debug) << "Permission ListApp denied for [" << named_cert_p->name << "] (" << (uint32_t)named_cert_p->perm << ")";
|
||||
|
||||
pt::ptree app;
|
||||
pt::ptree app_node;
|
||||
|
||||
app.put("IsHdrSupported"s, 0);
|
||||
app.put("AppTitle"s, "Permission Denied");
|
||||
app.put("ID", "1145141919810");
|
||||
app_node.put("IsHdrSupported"s, 0);
|
||||
app_node.put("AppTitle"s, "Permission Denied");
|
||||
app_node.put("UUID", "");
|
||||
app_node.put("ID", "114514");
|
||||
|
||||
apps.push_back(std::make_pair("App", std::move(app)));
|
||||
apps.push_back(std::make_pair("App", std::move(app_node)));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -802,7 +802,6 @@ namespace proc {
|
||||
std::string new_app_uuid;
|
||||
|
||||
if (inputTree_p) {
|
||||
auto inputTree = *inputTree_p;
|
||||
auto input_uuid = inputTree_p->get_optional<std::string>("uuid"s);
|
||||
if (input_uuid && !input_uuid.value().empty()) {
|
||||
new_app_uuid = input_uuid.value();
|
||||
@@ -834,13 +833,13 @@ namespace proc {
|
||||
kv.second.erase("uuid");
|
||||
kv.second.put("uuid", uuid_util::uuid_t::generate().string());
|
||||
kv.second.erase("launching");
|
||||
newApps.push_back(std::make_pair("", kv.second));
|
||||
newApps.push_back(std::make_pair("", std::move(kv.second)));
|
||||
} else {
|
||||
if (!new_app_uuid.empty() && app_uuid.value() == new_app_uuid) {
|
||||
newApps.push_back(std::make_pair("", *inputTree_p));
|
||||
new_app_uuid.clear();
|
||||
} else {
|
||||
newApps.push_back(std::make_pair("", kv.second));
|
||||
newApps.push_back(std::make_pair("", std::move(kv.second)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -881,8 +880,10 @@ namespace proc {
|
||||
if (!app_uuid) {
|
||||
// We need an upgrade to the app list
|
||||
try {
|
||||
BOOST_LOG(info) << "Migrating app list...";
|
||||
migrate_apps(&tree, nullptr);
|
||||
pt::write_json(file_name, tree);
|
||||
BOOST_LOG(info) << "Migration complete.";
|
||||
return parse(file_name);
|
||||
} catch (std::exception &e) {
|
||||
BOOST_LOG(warning) << "Error happened wilie migrating the app list: "sv << e.what();
|
||||
|
||||
Reference in New Issue
Block a user