Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/confighttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ void saveApp(resp_https_t response, req_https_t request) {
pt::read_json(ss, inputTree);
pt::read_json(config::stream.file_apps, fileTree);

// Moonlight checks the id of an item to determine if an item was changed
// Add a property named "id" to the inputTree with a value of the current timestamp
// Time is in seconds because some Moonlight clients cannot accept more than a 32-bit integer
// Milliseconds would be a better option
time_t id = time(nullptr);
inputTree.put("id", id);

if(inputTree.get_child("prep-cmd").empty()) {
inputTree.erase("prep-cmd");
}
Expand Down
11 changes: 10 additions & 1 deletion src/nvhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,18 @@ void applist(resp_https_t response, req_https_t request) {
for(auto &proc : proc::proc.get_apps()) {
pt::ptree app;

// Check if the "id" field is empty
if(!proc.id.empty()) {
// Use the "id" field if it is not empty
app.put("ID", proc.id);
}
else {
// Otherwise, use the "x" counter to set the ID
app.put("ID", ++x);
}

app.put("IsHdrSupported"s, config::video.hevc_mode == 3 ? 1 : 0);
app.put("AppTitle"s, proc.name);
app.put("ID"s, ++x);

apps.push_back(std::make_pair("App", std::move(app)));
}
Expand Down
1 change: 1 addition & 0 deletions src/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct ctx_t {
std::string working_dir;
std::string output;
std::string image_path;
std::string id;
};

class proc_t {
Expand Down