Skip to content

Commit 102c7b2

Browse files
Add UUID to app list response
1 parent 92f27fd commit 102c7b2

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

src/crypto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace crypto {
4545
input_touch = _input << 1, // Allow touch input
4646
input_pen = _input << 2, // Allow pen input
4747
input_mouse = _input << 3, // Allow mouse input
48-
input_kbd = _input << 4, // Allow keyboard input
48+
input_kbd = _input << 4, // Allow keyboard input
4949
_all_inputs = input_controller | input_touch | input_pen | input_mouse | input_kbd,
5050

5151
_operation = _input << 8, // Operation permission group

src/nvhttp.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -957,25 +957,27 @@ namespace nvhttp {
957957

958958
auto named_cert_p = get_verified_cert(request);
959959
if (!!(named_cert_p->perm & PERM::_all_actions)) {
960-
for (auto &proc : proc::proc.get_apps()) {
961-
pt::ptree app;
960+
for (auto &app : proc::proc.get_apps()) {
961+
pt::ptree app_node;
962962

963-
app.put("IsHdrSupported"s, video::active_hevc_mode == 3 ? 1 : 0);
964-
app.put("AppTitle"s, proc.name);
965-
app.put("ID", proc.id);
963+
app_node.put("IsHdrSupported"s, video::active_hevc_mode == 3 ? 1 : 0);
964+
app_node.put("AppTitle"s, app.name);
965+
app_node.put("UUID", app.uuid);
966+
app_node.put("ID", app.id);
966967

967-
apps.push_back(std::make_pair("App", std::move(app)));
968+
apps.push_back(std::make_pair("App", std::move(app_node)));
968969
}
969970
} else {
970971
BOOST_LOG(debug) << "Permission ListApp denied for [" << named_cert_p->name << "] (" << (uint32_t)named_cert_p->perm << ")";
971972

972-
pt::ptree app;
973+
pt::ptree app_node;
973974

974-
app.put("IsHdrSupported"s, 0);
975-
app.put("AppTitle"s, "Permission Denied");
976-
app.put("ID", "1145141919810");
975+
app_node.put("IsHdrSupported"s, 0);
976+
app_node.put("AppTitle"s, "Permission Denied");
977+
app_node.put("UUID", "");
978+
app_node.put("ID", "114514");
977979

978-
apps.push_back(std::make_pair("App", std::move(app)));
980+
apps.push_back(std::make_pair("App", std::move(app_node)));
979981

980982
return;
981983
}

src/process.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,6 @@ namespace proc {
802802
std::string new_app_uuid;
803803

804804
if (inputTree_p) {
805-
auto inputTree = *inputTree_p;
806805
auto input_uuid = inputTree_p->get_optional<std::string>("uuid"s);
807806
if (input_uuid && !input_uuid.value().empty()) {
808807
new_app_uuid = input_uuid.value();
@@ -834,13 +833,13 @@ namespace proc {
834833
kv.second.erase("uuid");
835834
kv.second.put("uuid", uuid_util::uuid_t::generate().string());
836835
kv.second.erase("launching");
837-
newApps.push_back(std::make_pair("", kv.second));
836+
newApps.push_back(std::make_pair("", std::move(kv.second)));
838837
} else {
839838
if (!new_app_uuid.empty() && app_uuid.value() == new_app_uuid) {
840839
newApps.push_back(std::make_pair("", *inputTree_p));
841840
new_app_uuid.clear();
842841
} else {
843-
newApps.push_back(std::make_pair("", kv.second));
842+
newApps.push_back(std::make_pair("", std::move(kv.second)));
844843
}
845844
}
846845
}
@@ -881,8 +880,10 @@ namespace proc {
881880
if (!app_uuid) {
882881
// We need an upgrade to the app list
883882
try {
883+
BOOST_LOG(info) << "Migrating app list...";
884884
migrate_apps(&tree, nullptr);
885885
pt::write_json(file_name, tree);
886+
BOOST_LOG(info) << "Migration complete.";
886887
return parse(file_name);
887888
} catch (std::exception &e) {
888889
BOOST_LOG(warning) << "Error happened wilie migrating the app list: "sv << e.what();

0 commit comments

Comments
 (0)