Migrated jwt-cpp to stable release, style fixes

This commit is contained in:
Elia Zammuto
2024-03-16 15:02:26 +01:00
committed by TheElixZammuto
parent 61df838356
commit 968b7963ee
5 changed files with 14 additions and 16 deletions

7
.gitmodules vendored
View File

@@ -2,6 +2,10 @@
path = third-party/build-deps
url = https://github.com/LizardByte/build-deps.git
branch = dist
[submodule "third-party/jwt-cpp"]
path = third-party/jwt-cpp
url = https://github.com/Thalhammer/jwt-cpp.git
branch = master
[submodule "third-party/moonlight-common-c"]
path = third-party/moonlight-common-c
url = https://github.com/moonlight-stream/moonlight-common-c.git
@@ -42,6 +46,3 @@
path = third-party/wlr-protocols
url = https://gitlab.freedesktop.org/wlroots/wlr-protocols
branch = master
[submodule "third-party/jwt-cpp"]
path = third-party/jwt-cpp
url = https://github.com/Thalhammer/jwt-cpp.git

View File

@@ -25,6 +25,7 @@
#include <Simple-Web-Server/crypto.hpp>
#include <Simple-Web-Server/server_https.hpp>
#include <boost/asio/ssl/context_base.hpp>
#include <jwt-cpp/jwt.h>
#include "config.h"
#include "confighttp.h"
@@ -32,7 +33,6 @@
#include "file_handler.h"
#include "globals.h"
#include "httpcommon.h"
#include "jwt-cpp/jwt.h"
#include "logging.h"
#include "network.h"
#include "nvhttp.h"
@@ -784,7 +784,12 @@ namespace confighttp {
return;
}
outputTree.put("status", "true");
auto token = jwt::create().set_type("JWS").set_issued_now().set_expires_in(std::chrono::seconds { 3600 }).set_issuer("sunshine-" + http::unique_id).set_payload_claim("sub", jwt::claim(std::string(config::sunshine.username))).sign(jwt::algorithm::hs256 { jwt_key });
auto token = jwt::create().set_type("JWT")
.set_issued_at(std::chrono::system_clock::now())
.set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{3600})
.set_issuer("sunshine-" + http::unique_id)
.set_payload_claim("sub", jwt::claim(std::string(config::sunshine.username)))
.sign(jwt::algorithm::hs256 { jwt_key });
std::stringstream cookie_stream;
cookie_stream << "sunshine_session=";
cookie_stream << token;

View File

@@ -6,4 +6,4 @@ export default async (url,config) => {
window.dispatchEvent(event);
}
return response;
};
};

View File

@@ -33,14 +33,6 @@
'ResourceCard': ResourceCard,
'LoginForm': LoginForm
},
data() {
return {
a: 1
}
},
mounted() {
console.log("Ciao!", this.$el)
},
methods: {
onLogin() {
document.location.href = '/';
@@ -49,4 +41,4 @@
});
console.log("App", app);
app.mount("#app");
</script>
</script>