mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-12-01 17:41:12 +00:00
feat(permissions): expose platform access and restart after grants (#5820)
This commit is contained in:
1 parent
8ed7f5bc51
commit
052b413216
29 files changed
+1416
-42
No files matched your search
@@ -24,6 +24,7 @@
|
||||
// platform includes
|
||||
#include <arpa/inet.h>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <gio/gio.h> // For RTKit
|
||||
#include <ifaddrs.h>
|
||||
#include <netinet/in.h>
|
||||
@@ -31,6 +32,7 @@
|
||||
#include <pwd.h>
|
||||
#include <sys/resource.h> // For setpriority
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(__FreeBSD__)
|
||||
#include <sys/capability.h>
|
||||
@@ -45,9 +47,7 @@
|
||||
// lib includes
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
#include <fcntl.h>
|
||||
#include <lizardbyte/common/env.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef SUNSHINE_BUILD_DRM
|
||||
#include <dirent.h>
|
||||
@@ -64,6 +64,7 @@
|
||||
#include "src/globals.h"
|
||||
#include "src/logging.h"
|
||||
#include "src/platform/common.h"
|
||||
#include "src/platform/permissions.h"
|
||||
#include "vaapi.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
@@ -153,6 +154,22 @@ namespace dyn {
|
||||
} // namespace dyn
|
||||
|
||||
namespace platf {
|
||||
std::vector<permission_status_t> get_permission_statuses() {
|
||||
// Match libvirtualhid's device paths and its read/write access check.
|
||||
bool input_access = access("/dev/uinput", R_OK | W_OK) == 0;
|
||||
#ifndef __FreeBSD__
|
||||
input_access = input_access || access("/dev/input/uinput", R_OK | W_OK) == 0;
|
||||
#endif
|
||||
return {{"input", input_access ? "granted" : "denied", config::input.keyboard || config::input.mouse || config::input.controller, true}};
|
||||
}
|
||||
|
||||
bool request_permission(std::string_view id) {
|
||||
// Unix device access has no process-local permission prompt. The Web UI
|
||||
// presents the group/device setup steps for this known permission.
|
||||
(void) id;
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace {
|
||||
constexpr std::array privileged_gui_environment_variables {
|
||||
"GDK_PIXBUF_MODULEDIR",
|
||||
|
||||
Reference in new issue
Block a user