MCPcopy Create free account
hub / github.com/ClassicOldSong/Apollo / applist

Function applist

src/nvhttp.cpp:1069–1149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1067 }
1068
1069 void applist(resp_https_t response, req_https_t request) {
1070 print_req<SunshineHTTPS>(request);
1071
1072 pt::ptree tree;
1073
1074 auto g = util::fail_guard([&]() {
1075 std::ostringstream data;
1076
1077 pt::write_xml(data, tree);
1078 response->write(data.str());
1079 response->close_connection_after_response = true;
1080 });
1081
1082 auto &apps = tree.add_child("root", pt::ptree {});
1083
1084 apps.put("<xmlattr>.status_code", 200);
1085
1086 auto named_cert_p = get_verified_cert(request);
1087 if (!!(named_cert_p->perm & PERM::_all_actions)) {
1088 auto current_appid = proc::proc.running();
1089 auto should_hide_inactive_apps = config::input.enable_input_only_mode && current_appid > 0 && current_appid != proc::input_only_app_id;
1090
1091 auto app_list = proc::proc.get_apps();
1092
1093 bool enable_legacy_ordering = config::sunshine.legacy_ordering && named_cert_p->enable_legacy_ordering;
1094 size_t bits;
1095 if (enable_legacy_ordering) {
1096 bits = zwpad::pad_width_for_count(app_list.size());
1097 }
1098
1099 for (size_t i = 0; i < app_list.size(); i++) {
1100 auto& app = app_list[i];
1101 auto appid = util::from_view(app.id);
1102 if (should_hide_inactive_apps) {
1103 if (
1104 appid != current_appid
1105 && appid != proc::input_only_app_id
1106 && appid != proc::terminate_app_id
1107 ) {
1108 continue;
1109 }
1110 } else {
1111 if (appid == proc::terminate_app_id) {
1112 continue;
1113 }
1114 }
1115
1116 std::string app_name;
1117 if (enable_legacy_ordering) {
1118 app_name = zwpad::pad_for_ordering(app.name, bits, i);
1119 } else {
1120 app_name = app.name;
1121 }
1122
1123 pt::ptree app_node;
1124
1125 app_node.put("IsHdrSupported"s, video::active_hevc_mode == 3 ? 1 : 0);
1126 app_node.put("AppTitle"s, app_name);

Callers

nothing calls this directly

Calls 9

fail_guardFunction · 0.85
get_verified_certFunction · 0.85
pad_width_for_countFunction · 0.85
pad_for_orderingFunction · 0.85
moveFunction · 0.85
writeMethod · 0.80
from_viewFunction · 0.70
runningMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected