diff --git a/.gitmodules b/.gitmodules index 62d0d0cd..82942ac9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/src/confighttp.cpp b/src/confighttp.cpp index 1c7cb1a3..6f2b73f2 100644 --- a/src/confighttp.cpp +++ b/src/confighttp.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #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; diff --git a/src_assets/common/assets/web/fetch.js b/src_assets/common/assets/web/fetch.js index c15bb5e8..2b5df809 100644 --- a/src_assets/common/assets/web/fetch.js +++ b/src_assets/common/assets/web/fetch.js @@ -6,4 +6,4 @@ export default async (url,config) => { window.dispatchEvent(event); } return response; -}; \ No newline at end of file +}; diff --git a/src_assets/common/assets/web/login.html b/src_assets/common/assets/web/login.html index 863fa98e..ae16b9c5 100644 --- a/src_assets/common/assets/web/login.html +++ b/src_assets/common/assets/web/login.html @@ -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"); - \ No newline at end of file + diff --git a/third-party/jwt-cpp b/third-party/jwt-cpp index 364a5572..08bcf77a 160000 --- a/third-party/jwt-cpp +++ b/third-party/jwt-cpp @@ -1 +1 @@ -Subproject commit 364a5572f4b46bb9f4304cb1c92acec8ddb2c620 +Subproject commit 08bcf77a687fb06e34138e9e9fa12a4ecbe12332