Merge branch 'master' into kmsgrab

This commit is contained in:
loki 2021-08-12 22:08:06 +02:00
commit 446c8ace82
7 changed files with 44 additions and 37 deletions

View file

@ -89,15 +89,11 @@ if(WIN32)
libstdc++.a
libwinpthread.a
libssp.a
Qwave
winmm
ksuser
wsock32
ws2_32
iphlpapi
d3d11 dxgi D3DCompiler
setupapi
dnsapi
)
set_source_files_properties(third-party/ViGEmClient/src/ViGEmClient.cpp PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650")

View file

@ -65,7 +65,9 @@ sunshine needs access to uinput to create mouse and gamepad events:
### Requirements:
mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git mingw-w64-x86_64-make
First you need to install [MSYS2](https://www.msys2.org), then startup "MSYS2 MinGW 64-bit" and install the following packages using `pacman -S`:
mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git mingw-w64-x86_64-make cmake make gcc
### Compilation:
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recursive`

View file

@ -13,11 +13,11 @@
</div>
<div class="mb-2">
<label for="" class="form-label">Password: </label>
<input type="password" class="form-control" v-model="passwordData.newPassword">
<input type="password" class="form-control" v-model="passwordData.newPassword" required>
</div>
<div class="mb-2">
<label for="" class="form-label">Password: </label>
<input type="password" class="form-control" v-model="passwordData.confirmNewPassword">
<input type="password" class="form-control" v-model="passwordData.confirmNewPassword" required>
</div>
<button class="mb-2 btn btn-primary" style="margin: 1em auto;">Login</button>
<div class="alert alert-danger" v-if="error"><b>Error: </b>{{error}}</div>

View file

@ -742,7 +742,7 @@ void apply_config(std::unordered_map<std::string, std::string> &&vars) {
}
std::string log_level_string;
string_restricted_f(vars, "min_log_level", log_level_string, { "verbose"sv, "debug"sv, "info"sv, "warning"sv, "error"sv, "fatal"sv, "none"sv });
string_f(vars, "min_log_level", log_level_string);
if(!log_level_string.empty()) {
if(log_level_string == "verbose"sv) {

View file

@ -419,8 +419,8 @@ void savePassword(resp_https_t response, req_https_t request) {
auto username = inputTree.count("currentUsername") > 0 ? inputTree.get<std::string>("currentUsername") : "";
auto newUsername = inputTree.get<std::string>("newUsername");
auto password = inputTree.count("currentPassword") > 0 ? inputTree.get<std::string>("currentPassword") : "";
auto newPassword = inputTree.get<std::string>("newPassword");
auto confirmPassword = inputTree.get<std::string>("confirmNewPassword");
auto newPassword = inputTree.count("newPassword") > 0 ? inputTree.get<std::string>("newPassword") : "";
auto confirmPassword = inputTree.count("confirmNewPassword") > 0 ? inputTree.get<std::string>("confirmNewPassword") : "";
if(newUsername.length() == 0) newUsername = username;
if(newUsername.length() == 0){
outputTree.put("status", false);
@ -428,7 +428,7 @@ void savePassword(resp_https_t response, req_https_t request) {
} else {
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string();
if(config::sunshine.username.empty() || (username == config::sunshine.username && hash == config::sunshine.password)) {
if(newPassword != confirmPassword) {
if(newPassword.empty() || newPassword != confirmPassword) {
outputTree.put("status", false);
outputTree.put("error", "Password Mismatch");
} else {

View file

@ -132,7 +132,7 @@ void save_state() {
void load_state() {
if(!fs::exists(config::nvhttp.file_state)) {
BOOST_LOG(info) << "DOENST EXIST"sv;
BOOST_LOG(info) << "File "sv << config::nvhttp.file_state << " doesn't exist"sv;
http::unique_id = util::uuid_t::generate().string();
return;
}

View file

@ -15,6 +15,9 @@
#include "sunshine/platform/common.h"
#include "sunshine/thread_safe.h"
#define _FN(x, ret, args) \
typedef ret(*x##_fn) args; \
static x##_fn x
using namespace std::literals;
@ -72,28 +75,9 @@ typedef struct _DNS_SERVICE_REGISTER_REQUEST {
BOOL unicastEnabled;
} DNS_SERVICE_REGISTER_REQUEST, *PDNS_SERVICE_REGISTER_REQUEST;
VOID DnsServiceFreeInstance(
_In_ PDNS_SERVICE_INSTANCE pInstance);
DWORD DnsServiceDeRegister(
_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest,
_Inout_opt_ PDNS_SERVICE_CANCEL pCancel);
DWORD DnsServiceRegister(
_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest,
_Inout_opt_ PDNS_SERVICE_CANCEL pCancel);
PDNS_SERVICE_INSTANCE DnsServiceConstructInstance(
_In_ PCWSTR pServiceName,
_In_ PCWSTR pHostName,
_In_opt_ PIP4_ADDRESS pIp4,
_In_opt_ PIP6_ADDRESS pIp6,
_In_ WORD wPort,
_In_ WORD wPriority,
_In_ WORD wWeight,
_In_ DWORD dwPropertiesCount,
_In_reads_(dwPropertiesCount) PCWSTR *keys,
_In_reads_(dwPropertiesCount) PCWSTR *values);
_FN(_DnsServiceFreeInstance, VOID, (_In_ PDNS_SERVICE_INSTANCE pInstance));
_FN(_DnsServiceDeRegister, DWORD, (_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest, _Inout_opt_ PDNS_SERVICE_CANCEL pCancel));
_FN(_DnsServiceRegister, DWORD, (_In_ PDNS_SERVICE_REGISTER_REQUEST pRequest, _Inout_opt_ PDNS_SERVICE_CANCEL pCancel));
} /* extern "C" */
namespace platf::publish {
@ -102,7 +86,7 @@ VOID WINAPI register_cb(DWORD status, PVOID pQueryContext, PDNS_SERVICE_INSTANCE
auto fg = util::fail_guard([&]() {
if(pInstance) {
DnsServiceFreeInstance(pInstance);
_DnsServiceFreeInstance(pInstance);
}
});
@ -140,10 +124,10 @@ static int service(bool enable) {
DNS_STATUS status {};
if(enable) {
status = DnsServiceRegister(&req, nullptr);
status = _DnsServiceRegister(&req, nullptr);
}
else {
status = DnsServiceDeRegister(&req, nullptr);
status = _DnsServiceDeRegister(&req, nullptr);
}
alarm->wait();
@ -168,7 +152,32 @@ public:
}
};
int load_funcs(HMODULE handle) {
auto fg = util::fail_guard([handle]() {
FreeLibrary(handle);
});
_DnsServiceFreeInstance = (_DnsServiceFreeInstance_fn)GetProcAddress(handle, "DnsServiceFreeInstance");
_DnsServiceDeRegister = (_DnsServiceDeRegister_fn)GetProcAddress(handle, "DnsServiceDeRegister");
_DnsServiceRegister = (_DnsServiceRegister_fn)GetProcAddress(handle, "DnsServiceRegister");
if(!(_DnsServiceFreeInstance && _DnsServiceDeRegister && _DnsServiceRegister)) {
BOOST_LOG(error) << "mDNS service not available in dnsapi.dll"sv;
return -1;
}
fg.disable();
return 0;
}
std::unique_ptr<::platf::deinit_t> start() {
HMODULE handle = LoadLibrary("dnsapi.dll");
if(!handle || load_funcs(handle)) {
BOOST_LOG(error) << "Couldn't load dnsapi.dll, You'll need to add PC manually from Moonlight"sv;
return nullptr;
}
if(service(true)) {
return nullptr;
}