diff --git a/crow_test/static/css/home.css b/crow_test/static/css/home.css index 715e118..a3753af 100644 --- a/crow_test/static/css/home.css +++ b/crow_test/static/css/home.css @@ -18,5 +18,34 @@ div.titlebar { } body { + width: 100%; + height: 100%; 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; } diff --git a/crow_test/static/images/backgrounds/2023-05-21_11.39.09.png b/crow_test/static/images/backgrounds/2023-05-21_11.39.09.png new file mode 100644 index 0000000..5cb4a53 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-21_11.39.09.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-22_12.38.00.png b/crow_test/static/images/backgrounds/2023-05-22_12.38.00.png new file mode 100644 index 0000000..3d88ccf Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-22_12.38.00.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-22_12.38.01.png b/crow_test/static/images/backgrounds/2023-05-22_12.38.01.png new file mode 100644 index 0000000..215c03d Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-22_12.38.01.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-22_12.38.33.png b/crow_test/static/images/backgrounds/2023-05-22_12.38.33.png new file mode 100644 index 0000000..860deb0 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-22_12.38.33.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-23_21.38.55.png b/crow_test/static/images/backgrounds/2023-05-23_21.38.55.png new file mode 100644 index 0000000..1026d7b Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-23_21.38.55.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-23_21.39.01.png b/crow_test/static/images/backgrounds/2023-05-23_21.39.01.png new file mode 100644 index 0000000..42e0b32 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-23_21.39.01.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-24_16.48.51.png b/crow_test/static/images/backgrounds/2023-05-24_16.48.51.png new file mode 100644 index 0000000..c68a30f Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-24_16.48.51.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-24_21.42.35.png b/crow_test/static/images/backgrounds/2023-05-24_21.42.35.png new file mode 100644 index 0000000..6671aa2 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-24_21.42.35.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-24_21.42.40.png b/crow_test/static/images/backgrounds/2023-05-24_21.42.40.png new file mode 100644 index 0000000..01b51c5 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-24_21.42.40.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-24_21.42.44.png b/crow_test/static/images/backgrounds/2023-05-24_21.42.44.png new file mode 100644 index 0000000..1274b4b Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-24_21.42.44.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-26_22.53.56.png b/crow_test/static/images/backgrounds/2023-05-26_22.53.56.png new file mode 100644 index 0000000..88229b2 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-26_22.53.56.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-26_23.02.50.png b/crow_test/static/images/backgrounds/2023-05-26_23.02.50.png new file mode 100644 index 0000000..d7dc4e0 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-26_23.02.50.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-26_23.04.07.png b/crow_test/static/images/backgrounds/2023-05-26_23.04.07.png new file mode 100644 index 0000000..b5a6654 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-26_23.04.07.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-26_23.18.23.png b/crow_test/static/images/backgrounds/2023-05-26_23.18.23.png new file mode 100644 index 0000000..a220cc1 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-26_23.18.23.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-26_23.20.58.png b/crow_test/static/images/backgrounds/2023-05-26_23.20.58.png new file mode 100644 index 0000000..beea061 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-26_23.20.58.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-26_23.22.56.png b/crow_test/static/images/backgrounds/2023-05-26_23.22.56.png new file mode 100644 index 0000000..d34921a Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-26_23.22.56.png differ diff --git a/crow_test/static/images/backgrounds/2023-05-29_11.23.58.png b/crow_test/static/images/backgrounds/2023-05-29_11.23.58.png new file mode 100644 index 0000000..74b48bb Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-05-29_11.23.58.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-03_20.32.59.png b/crow_test/static/images/backgrounds/2023-06-03_20.32.59.png new file mode 100644 index 0000000..728b2ff Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-03_20.32.59.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-03_21.36.32.png b/crow_test/static/images/backgrounds/2023-06-03_21.36.32.png new file mode 100644 index 0000000..7f891f1 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-03_21.36.32.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-03_21.36.34.png b/crow_test/static/images/backgrounds/2023-06-03_21.36.34.png new file mode 100644 index 0000000..6dddbb2 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-03_21.36.34.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-03_21.36.35.png b/crow_test/static/images/backgrounds/2023-06-03_21.36.35.png new file mode 100644 index 0000000..50c6f7b Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-03_21.36.35.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-03_21.36.42.png b/crow_test/static/images/backgrounds/2023-06-03_21.36.42.png new file mode 100644 index 0000000..c3ec120 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-03_21.36.42.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-03_21.36.47.png b/crow_test/static/images/backgrounds/2023-06-03_21.36.47.png new file mode 100644 index 0000000..e9f73a0 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-03_21.36.47.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-07_22.05.05.png b/crow_test/static/images/backgrounds/2023-06-07_22.05.05.png new file mode 100644 index 0000000..838f518 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-07_22.05.05.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-07_22.05.08.png b/crow_test/static/images/backgrounds/2023-06-07_22.05.08.png new file mode 100644 index 0000000..7de1715 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-07_22.05.08.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-07_22.05.11.png b/crow_test/static/images/backgrounds/2023-06-07_22.05.11.png new file mode 100644 index 0000000..913caa0 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-07_22.05.11.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-07_22.05.21.png b/crow_test/static/images/backgrounds/2023-06-07_22.05.21.png new file mode 100644 index 0000000..5076839 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-07_22.05.21.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-16_11.08.49.png b/crow_test/static/images/backgrounds/2023-06-16_11.08.49.png new file mode 100644 index 0000000..2fc8eaa Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-16_11.08.49.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-17_02.22.29.png b/crow_test/static/images/backgrounds/2023-06-17_02.22.29.png new file mode 100644 index 0000000..e484d0c Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-17_02.22.29.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-17_02.22.30.png b/crow_test/static/images/backgrounds/2023-06-17_02.22.30.png new file mode 100644 index 0000000..e74d40f Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-17_02.22.30.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-17_02.22.31.png b/crow_test/static/images/backgrounds/2023-06-17_02.22.31.png new file mode 100644 index 0000000..beb6f66 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-17_02.22.31.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-17_02.22.32.png b/crow_test/static/images/backgrounds/2023-06-17_02.22.32.png new file mode 100644 index 0000000..f256cb4 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-17_02.22.32.png differ diff --git a/crow_test/static/images/backgrounds/2023-06-17_02.22.33.png b/crow_test/static/images/backgrounds/2023-06-17_02.22.33.png new file mode 100644 index 0000000..36ae919 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-06-17_02.22.33.png differ diff --git a/crow_test/static/images/backgrounds/2023-07-15_22.58.06.png b/crow_test/static/images/backgrounds/2023-07-15_22.58.06.png new file mode 100644 index 0000000..1683198 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-07-15_22.58.06.png differ diff --git a/crow_test/static/images/backgrounds/2023-07-15_22.58.21.png b/crow_test/static/images/backgrounds/2023-07-15_22.58.21.png new file mode 100644 index 0000000..59f9fb6 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-07-15_22.58.21.png differ diff --git a/crow_test/static/images/backgrounds/2023-07-18_12.26.08.png b/crow_test/static/images/backgrounds/2023-07-18_12.26.08.png new file mode 100644 index 0000000..558ca80 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-07-18_12.26.08.png differ diff --git a/crow_test/static/images/backgrounds/2023-07-19_01.19.11.png b/crow_test/static/images/backgrounds/2023-07-19_01.19.11.png new file mode 100644 index 0000000..b3d0566 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-07-19_01.19.11.png differ diff --git a/crow_test/static/images/backgrounds/2023-07-19_12.51.10.png b/crow_test/static/images/backgrounds/2023-07-19_12.51.10.png new file mode 100644 index 0000000..5e6767e Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-07-19_12.51.10.png differ diff --git a/crow_test/static/images/backgrounds/2023-08-04_16.19.19.png b/crow_test/static/images/backgrounds/2023-08-04_16.19.19.png new file mode 100644 index 0000000..e621dcc Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-08-04_16.19.19.png differ diff --git a/crow_test/static/images/backgrounds/2023-08-05_13.02.32.png b/crow_test/static/images/backgrounds/2023-08-05_13.02.32.png new file mode 100644 index 0000000..c999106 Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-08-05_13.02.32.png differ diff --git a/crow_test/static/images/backgrounds/2023-08-09_23.53.06.png b/crow_test/static/images/backgrounds/2023-08-09_23.53.06.png new file mode 100644 index 0000000..26b748d Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-08-09_23.53.06.png differ diff --git a/crow_test/static/images/backgrounds/2023-08-09_23.53.06_2.png b/crow_test/static/images/backgrounds/2023-08-09_23.53.06_2.png new file mode 100644 index 0000000..4bb77ea Binary files /dev/null and b/crow_test/static/images/backgrounds/2023-08-09_23.53.06_2.png differ diff --git a/crow_test/webcontent/index.html b/crow_test/webcontent/index.html index 0a95363..d4eebc7 100644 --- a/crow_test/webcontent/index.html +++ b/crow_test/webcontent/index.html @@ -5,7 +5,7 @@ {{$SITE_TITLE}} - +
diff --git a/include/crowsite/site/auth.h b/include/crowsite/site/auth.h index 5a6ebe8..e6801a0 100644 --- a/include/crowsite/site/auth.h +++ b/include/crowsite/site/auth.h @@ -9,7 +9,7 @@ namespace cs { - void handleLoginPost(cs::parser::Post postData); + bool handleLoginPost(cs::parser::Post& postData); } diff --git a/src/crowsite/site/auth.cpp b/src/crowsite/site/auth.cpp index b547432..838b412 100644 --- a/src/crowsite/site/auth.cpp +++ b/src/crowsite/site/auth.cpp @@ -2,7 +2,19 @@ // Created by brett on 16/08/23. // #include +#include +#include "blt/std/logging.h" 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; + } } \ No newline at end of file diff --git a/src/crowsite/utility.cpp b/src/crowsite/utility.cpp index 5a700bb..3a23707 100644 --- a/src/crowsite/utility.cpp +++ b/src/crowsite/utility.cpp @@ -3,6 +3,7 @@ // #include #include +#include namespace cs { @@ -10,10 +11,12 @@ namespace cs { Post::Post(const std::string& input) { auto pairs = blt::string::split(input, "&"); for (const auto& pair : pairs) { - //BLT_TRACE("Pair: %s", pair.c_str()); auto kv = blt::string::split(pair, "="); - //zBLT_TRACE("[%s] = %s", kv[0].c_str(), kv[1].c_str()); - m_Values[kv[0]] = kv[1]; + auto key = kv[0]; + 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; } } diff --git a/src/main.cpp b/src/main.cpp index f64d676..311a5dc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -57,7 +57,8 @@ int main(int argc, const char** argv) cs::jellyfin::setToken(blt::arg_parse::get(args["token"])); cs::jellyfin::processUserData(); - cs::jellyfin::authenticateUser(blt::arg_parse::get(args["user"]), blt::arg_parse::get(args["pass"])); + auto res = cs::jellyfin::authenticateUser(blt::arg_parse::get(args["user"]), blt::arg_parse::get(args["pass"])); + BLT_INFO("Has true: %b", res == cs::jellyfin::auth_response::AUTHORIZED); BLT_INFO("Starting site %s.", SITE_NAME); 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_VERSION"] = SITE_VERSION; context["BEE_MOVIE"] = beemovie_script; + context["SITE_BACKGROUND"] = "/static/images/backgrounds/2023-05-26_23.18.23.png"; BLT_INFO("Starting cache engine"); @@ -128,7 +130,13 @@ int main(int argc, const char** argv) cs::parser::Post pp(req.body); crow::response res(303); - res.set_header("Location", pp.hasKey("referer") ? pp["referer"] : "/"); + + // 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"] : "/"); + else + res.set_header("Location", "/login.html"); + return res; } );