fix post data url encoding
|
@ -18,5 +18,34 @@ div.titlebar {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
background-color: gray;
|
background-color: gray;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-attachment: fixed;
|
||||||
|
background-position: center;
|
||||||
|
background-size:cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blur-bgimage {
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.blur-bgimage:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
width : 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: inherit;
|
||||||
|
z-index: -1;
|
||||||
|
|
||||||
|
filter : blur(10px);
|
||||||
|
-moz-filter : blur(10px);
|
||||||
|
-webkit-filter: blur(10px);
|
||||||
|
-o-filter : blur(10px);
|
||||||
|
|
||||||
|
transition : all 2s linear;
|
||||||
|
-moz-transition : all 2s linear;
|
||||||
|
-webkit-transition: all 2s linear;
|
||||||
|
-o-transition : all 2s linear;
|
||||||
}
|
}
|
||||||
|
|
After Width: | Height: | Size: 3.5 MiB |
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 3.6 MiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 2.8 MiB |
After Width: | Height: | Size: 2.9 MiB |
After Width: | Height: | Size: 2.6 MiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 2.7 MiB |
After Width: | Height: | Size: 2.7 MiB |
After Width: | Height: | Size: 3.4 MiB |
After Width: | Height: | Size: 3.4 MiB |
After Width: | Height: | Size: 3.3 MiB |
After Width: | Height: | Size: 2.8 MiB |
After Width: | Height: | Size: 3.1 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 1.7 MiB |
After Width: | Height: | Size: 1.8 MiB |
After Width: | Height: | Size: 1.6 MiB |
After Width: | Height: | Size: 2.0 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.6 MiB |
After Width: | Height: | Size: 3.0 MiB |
After Width: | Height: | Size: 1.9 MiB |
After Width: | Height: | Size: 3.1 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 4.5 MiB |
After Width: | Height: | Size: 4.1 MiB |
After Width: | Height: | Size: 3.6 MiB |
After Width: | Height: | Size: 2.6 MiB |
After Width: | Height: | Size: 4.4 MiB |
After Width: | Height: | Size: 3.7 MiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 3.2 MiB |
After Width: | Height: | Size: 3.1 MiB |
|
@ -5,7 +5,7 @@
|
||||||
<link rel="stylesheet" href="/static/css/bar.css">
|
<link rel="stylesheet" href="/static/css/bar.css">
|
||||||
<title>{{$SITE_TITLE}}</title>
|
<title>{{$SITE_TITLE}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="blur-bgimage" style="background-image: url({{$SITE_BACKGROUND}})">
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="titlebar">
|
<div class="titlebar">
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace cs {
|
namespace cs {
|
||||||
|
|
||||||
void handleLoginPost(cs::parser::Post postData);
|
bool handleLoginPost(cs::parser::Post& postData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,19 @@
|
||||||
// Created by brett on 16/08/23.
|
// Created by brett on 16/08/23.
|
||||||
//
|
//
|
||||||
#include <crowsite/site/auth.h>
|
#include <crowsite/site/auth.h>
|
||||||
|
#include <crowsite/requests/jellyfin.h>
|
||||||
|
#include "blt/std/logging.h"
|
||||||
|
|
||||||
namespace cs {
|
namespace cs {
|
||||||
|
|
||||||
|
bool handleLoginPost(parser::Post& postData)
|
||||||
|
{
|
||||||
|
// javascript should make sure we don't send post requests without information
|
||||||
|
// this way it can be interactive
|
||||||
|
if (!postData.hasKey("username") || !postData.hasKey("password"))
|
||||||
|
return false;
|
||||||
|
auto auth = jellyfin::authenticateUser(postData["username"], postData["password"]);
|
||||||
|
|
||||||
|
return auth == jellyfin::auth_response::AUTHORIZED;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,6 +3,7 @@
|
||||||
//
|
//
|
||||||
#include <crowsite/utility.h>
|
#include <crowsite/utility.h>
|
||||||
#include <blt/std/string.h>
|
#include <blt/std/string.h>
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
namespace cs {
|
namespace cs {
|
||||||
|
|
||||||
|
@ -10,10 +11,12 @@ namespace cs {
|
||||||
Post::Post(const std::string& input) {
|
Post::Post(const std::string& input) {
|
||||||
auto pairs = blt::string::split(input, "&");
|
auto pairs = blt::string::split(input, "&");
|
||||||
for (const auto& pair : pairs) {
|
for (const auto& pair : pairs) {
|
||||||
//BLT_TRACE("Pair: %s", pair.c_str());
|
|
||||||
auto kv = blt::string::split(pair, "=");
|
auto kv = blt::string::split(pair, "=");
|
||||||
//zBLT_TRACE("[%s] = %s", kv[0].c_str(), kv[1].c_str());
|
auto key = kv[0];
|
||||||
m_Values[kv[0]] = kv[1];
|
auto value = kv[1];
|
||||||
|
auto stripped_key = curl_easy_unescape(nullptr, key.c_str(), 0, nullptr);
|
||||||
|
auto stripped_value = curl_easy_unescape(nullptr, value.c_str(), 0, nullptr);
|
||||||
|
m_Values[stripped_key] = stripped_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
src/main.cpp
|
@ -57,7 +57,8 @@ int main(int argc, const char** argv)
|
||||||
cs::jellyfin::setToken(blt::arg_parse::get<std::string>(args["token"]));
|
cs::jellyfin::setToken(blt::arg_parse::get<std::string>(args["token"]));
|
||||||
cs::jellyfin::processUserData();
|
cs::jellyfin::processUserData();
|
||||||
|
|
||||||
cs::jellyfin::authenticateUser(blt::arg_parse::get<std::string>(args["user"]), blt::arg_parse::get<std::string>(args["pass"]));
|
auto res = cs::jellyfin::authenticateUser(blt::arg_parse::get<std::string>(args["user"]), blt::arg_parse::get<std::string>(args["pass"]));
|
||||||
|
BLT_INFO("Has true: %b", res == cs::jellyfin::auth_response::AUTHORIZED);
|
||||||
|
|
||||||
BLT_INFO("Starting site %s.", SITE_NAME);
|
BLT_INFO("Starting site %s.", SITE_NAME);
|
||||||
crow::mustache::set_global_base(SITE_FILES_PATH);
|
crow::mustache::set_global_base(SITE_FILES_PATH);
|
||||||
|
@ -76,6 +77,7 @@ int main(int argc, const char** argv)
|
||||||
context["SITE_NAME"] = SITE_NAME;
|
context["SITE_NAME"] = SITE_NAME;
|
||||||
context["SITE_VERSION"] = SITE_VERSION;
|
context["SITE_VERSION"] = SITE_VERSION;
|
||||||
context["BEE_MOVIE"] = beemovie_script;
|
context["BEE_MOVIE"] = beemovie_script;
|
||||||
|
context["SITE_BACKGROUND"] = "/static/images/backgrounds/2023-05-26_23.18.23.png";
|
||||||
|
|
||||||
BLT_INFO("Starting cache engine");
|
BLT_INFO("Starting cache engine");
|
||||||
|
|
||||||
|
@ -128,7 +130,13 @@ int main(int argc, const char** argv)
|
||||||
cs::parser::Post pp(req.body);
|
cs::parser::Post pp(req.body);
|
||||||
|
|
||||||
crow::response res(303);
|
crow::response res(303);
|
||||||
|
|
||||||
|
// either redirect to clear the form if failed or pass user to index
|
||||||
|
if (cs::handleLoginPost(pp))
|
||||||
res.set_header("Location", pp.hasKey("referer") ? pp["referer"] : "/");
|
res.set_header("Location", pp.hasKey("referer") ? pp["referer"] : "/");
|
||||||
|
else
|
||||||
|
res.set_header("Location", "/login.html");
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|