Add crow files WITHOUT git reference as I will be modifying them
Todo: add license stuffmain
parent
a3b1d3b9d8
commit
80e7088542
|
@ -1,3 +1,6 @@
|
||||||
[submodule "libs/BLT"]
|
[submodule "libs/BLT"]
|
||||||
path = libs/BLT
|
path = libs/BLT
|
||||||
url = https://github.com/Tri11Paragon/blt.git
|
url = https://github.com/Tri11Paragon/blt.git
|
||||||
|
[submodule "libs/crow"]
|
||||||
|
path = libs/crow
|
||||||
|
url = https://github.com/CrowCpp/Crow
|
||||||
|
|
|
@ -9,7 +9,10 @@ set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CROW_FEATURES compression)
|
set(CROW_FEATURES compression)
|
||||||
|
|
||||||
cmake_policy(SET CMP0057 NEW)
|
cmake_policy(SET CMP0057 NEW)
|
||||||
find_package(Crow)
|
#find_package(Crow)
|
||||||
|
|
||||||
|
add_subdirectory(libs/crow)
|
||||||
|
|
||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
find_package(OpenSSL)
|
find_package(OpenSSL)
|
||||||
find_package(SQLite3)
|
find_package(SQLite3)
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
button.bar {
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 12px 28px;
|
|
||||||
font-size: 16px;
|
|
||||||
background-color: #9a7aa0;
|
|
||||||
}
|
|
||||||
button.bar:hover {
|
|
||||||
box-shadow: 0 12px 16px 0 rgba(59, 165, 144,0.24), 0 17px 50px 0 rgba(59, 165, 144,0.19);
|
|
||||||
}
|
|
|
@ -3,18 +3,27 @@ div.center {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.body {
|
div.center_all {
|
||||||
width: 40%;
|
display: flex;
|
||||||
min-height: 200px;
|
justify-content: center;
|
||||||
background-color: white;
|
justify-items: center;
|
||||||
border: 3px solid;
|
|
||||||
border-color: #000033;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.titlebar {
|
div.container {
|
||||||
display: inline-flex;
|
width: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.body {
|
||||||
|
min-height: 200px;
|
||||||
|
background-color: white;
|
||||||
|
border-left: 3px solid;
|
||||||
|
border-right: 3px solid;
|
||||||
|
border-bottom: 3px solid;
|
||||||
|
border-top: 3px solid;
|
||||||
|
border-color: #000033;
|
||||||
|
border-bottom-left-radius: 8px;
|
||||||
|
border-bottom-right-radius: 8px;
|
||||||
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -39,13 +48,25 @@ body {
|
||||||
background: inherit;
|
background: inherit;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
|
|
||||||
filter : blur(10px);
|
filter : blur(2px);
|
||||||
-moz-filter : blur(10px);
|
-moz-filter : blur(2px);
|
||||||
-webkit-filter: blur(10px);
|
-webkit-filter: blur(2px);
|
||||||
-o-filter : blur(10px);
|
-o-filter : blur(2px);
|
||||||
|
|
||||||
transition : all 2s linear;
|
transition : all 2s linear;
|
||||||
-moz-transition : all 2s linear;
|
-moz-transition : all 2s linear;
|
||||||
-webkit-transition: all 2s linear;
|
-webkit-transition: all 2s linear;
|
||||||
-o-transition : all 2s linear;
|
-o-transition : all 2s linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.underline {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overline {
|
||||||
|
text-decoration: overline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashed {
|
||||||
|
text-decoration: dashed;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
.card {
|
||||||
|
margin: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
background-color: rgb(245, 245, 245);
|
||||||
|
box-shadow: 2px 6px 12px 2px rgba(0,0,0,0.4);
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.card:hover {
|
||||||
|
background-color: rgb(240, 240, 240);
|
||||||
|
box-shadow: 2px 6px 12px 2px rgba(0,0,0,0.6);
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ ul.menu_bar {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background-color: #333;
|
background-color: {{$MENU_BAR_COLOR}};
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.menu_bar li.left {
|
ul.menu_bar li.left {
|
||||||
|
@ -25,10 +25,10 @@ ul.menu_bar li a {
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.menu_bar li a.active {
|
ul.menu_bar li a.active {
|
||||||
background-color: #04AA6D;
|
background-color: {{$MENU_BAR_ACTIVE}};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change the link color to #111 (black) on hover */
|
/* Change the link color to #111 (black) on hover */
|
||||||
ul.menu_bar li a:hover {
|
ul.menu_bar li a:hover {
|
||||||
background-color: #111;
|
background-color: {{$MENU_BAR_HOVER}};
|
||||||
}
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
{{@../static/css/menu_bar.css}}
|
||||||
|
{{@../static/css/body.css}}
|
||||||
|
</style>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="description" content="Git links">
|
||||||
|
<meta name="keywords" content="Git">
|
||||||
|
<meta name="author" content="Brett">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{{$SITE_TITLE}}</title>
|
||||||
|
</head>
|
||||||
|
{{@body_begin.part}}
|
||||||
|
<div class="body">
|
||||||
|
<div class="center">
|
||||||
|
<h1 class="underline">About</h1>
|
||||||
|
</div>
|
||||||
|
<div class="center">
|
||||||
|
<ul style="padding: 0px;">
|
||||||
|
<li>I hate HTML</li>
|
||||||
|
<li>This site is mostly a testing ground for C++ on the web</li>
|
||||||
|
<li>Projects is probably where you want to go</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{@body_end.part}}
|
||||||
|
</html>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<body class="blur-bgimage" style="background-image: url({{$SITE_BACKGROUND}})">
|
||||||
|
<div class="center">
|
||||||
|
<div class="container">
|
||||||
|
{{@menu_bar.part}}
|
|
@ -0,0 +1,3 @@
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
|
@ -0,0 +1,40 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="/static/css/git.css">
|
||||||
|
<style>
|
||||||
|
{{@../static/css/menu_bar.css}}
|
||||||
|
{{@../static/css/body.css}}
|
||||||
|
</style>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="description" content="Git links">
|
||||||
|
<meta name="keywords" content="Git">
|
||||||
|
<meta name="author" content="Brett">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{{$SITE_TITLE}}</title>
|
||||||
|
</head>
|
||||||
|
{{@body_begin.part}}
|
||||||
|
<div class="body">
|
||||||
|
<div class="center">
|
||||||
|
<h1 class="underline">My GitHub Profile</h1>
|
||||||
|
</div>
|
||||||
|
<div class="center">
|
||||||
|
<div class="card">
|
||||||
|
<div style="display: inline-block;">
|
||||||
|
<a href="https://github.com/Tri11Paragon"><img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/32377731?v=4"></a>
|
||||||
|
</div>
|
||||||
|
<div style="display: inline-block; width: 10px"></div>
|
||||||
|
<div style="display: inline-block; width: 225px;">
|
||||||
|
<div class="center_all">
|
||||||
|
<a href="https://github.com/Tri11Paragon">Link</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 20px;"></div>
|
||||||
|
<div class="center">
|
||||||
|
TODO: display pinned repos / add more then 'link'
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{@body_end.part}}
|
||||||
|
</html>
|
|
@ -1,9 +1,11 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/static/css/home.css">
|
<link rel="stylesheet" href="/static/css/index.css">
|
||||||
<link rel="stylesheet" href="/static/css/bar.css">
|
<style>
|
||||||
<link rel="stylesheet" href="/static/css/menu_bar.css">
|
{{@../static/css/menu_bar.css}}
|
||||||
|
{{@../static/css/body.css}}
|
||||||
|
</style>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="keywords" content="">
|
<meta name="keywords" content="">
|
||||||
|
@ -11,26 +13,11 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{{$SITE_TITLE}}</title>
|
<title>{{$SITE_TITLE}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="blur-bgimage" style="background-image: url({{$SITE_BACKGROUND}})">
|
{{@body_begin.part}}
|
||||||
<div class="center">
|
<div class="body">
|
||||||
<div class="body">
|
<div class="center">
|
||||||
{{@menu_bar.part}}
|
Many cumies
|
||||||
|
|
||||||
<div class="center">
|
|
||||||
HAXsdsad
|
|
||||||
{{%_admin}}
|
|
||||||
<p>Admin detected</p>
|
|
||||||
{{/_admin}}
|
|
||||||
{{%_admin && _create_posts}}
|
|
||||||
<p>Admin and can read!</p>
|
|
||||||
{{/_admin && _create_posts}}
|
|
||||||
{{%_admin}}
|
|
||||||
{{%_read_files}}
|
|
||||||
Nested time!
|
|
||||||
{{/_read_files}}
|
|
||||||
{{/_admin}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
{{@body_end.part}}
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/static/css/home.css">
|
<link rel="stylesheet" href="/static/css/index.css">
|
||||||
<link rel="stylesheet" href="/static/css/bar.css">
|
<style>
|
||||||
<link rel="stylesheet" href="/static/css/menu_bar.css">
|
{{@../static/css/menu_bar.css}}
|
||||||
|
{{@../static/css/body.css}}
|
||||||
|
</style>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="description" content="Login to {{$SITE_NAME}}">
|
<meta name="description" content="">
|
||||||
<meta name="keywords" content="{{$SITE_NAME}}">
|
<meta name="keywords" content="">
|
||||||
<meta name="author" content="Brett">
|
<meta name="author" content="Brett">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{{$SITE_TITLE}}</title>
|
<title>{{$SITE_TITLE}}</title>
|
||||||
</head>
|
</head>
|
||||||
<body class="blur-bgimage" style="background-image: url({{$SITE_BACKGROUND}})">
|
{{@body_begin.part}}
|
||||||
<div class="center">
|
<div class="body">
|
||||||
<div class="body">
|
<div class="center">
|
||||||
{{@menu_bar.part}}
|
<div class="center">
|
||||||
|
<form action="/res/login" method="post">
|
||||||
<div class="center">
|
<label for="username">Username</label><br>
|
||||||
<form action="/res/login" method="post">
|
<input type="text" id="username" name="username"><br>
|
||||||
<label for="username">Username</label><br>
|
<label for="password">Password</label><br>
|
||||||
<input type="text" id="username" name="username"><br>
|
<input type="password" id="password" name="password"><br>
|
||||||
<label for="password">Password</label><br>
|
<label for="remember_me">Remember Me?</label><br>
|
||||||
<input type="password" id="password" name="password"><br>
|
<input type="checkbox" id="remember_me" value="T" name="remember_me"><br>
|
||||||
<label for="remember_me">Remember Me?</label><br>
|
<input type="submit" value="Login">
|
||||||
<input type="checkbox" id="remember_me" value="T" name="remember_me"><br>
|
</form>
|
||||||
<input type="submit" value="Login">
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
{{@body_end.part}}
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<ul class="menu_bar">
|
<ul class="menu_bar">
|
||||||
<li class="left"><a id="home" href="/">Home</a></li>
|
<li class="left"><a id="home" href="/">Home</a></li>
|
||||||
<li class="left"><a id="projects" href="/projects.html">Projects</a></li>
|
<li class="left"><a id="projects" href="/projects/">Projects</a></li>
|
||||||
<li class="left"><a id="research" href="/research.html">Research</a></li>
|
<li class="left"><a id="research" href="/research/">Research</a></li>
|
||||||
<li class="left"><a id="git" href="/git.html">Git</a></li>
|
<li class="left"><a id="git" href="/git.html">Git</a></li>
|
||||||
<li class="left"><a id='about' href="/about.html">About</a></li>
|
<li class="left"><a id='about' href="/about.html">About</a></li>
|
||||||
{{%_logged_in}}
|
{{%_logged_in}}
|
||||||
|
@ -9,6 +9,9 @@
|
||||||
{{*_logged_in}}
|
{{*_logged_in}}
|
||||||
<li class="right"><a id='login' href="/login.html">Login</a></li>
|
<li class="right"><a id='login' href="/login.html">Login</a></li>
|
||||||
{{/_logged_in}}
|
{{/_logged_in}}
|
||||||
|
{{%_admin}}
|
||||||
|
<li class="right"><a href="/admin/">Admin</a></li>
|
||||||
|
{{/_admin}}
|
||||||
</ul>
|
</ul>
|
||||||
<script>
|
<script>
|
||||||
const path = window.location.pathname;
|
const path = window.location.pathname;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#pragma once
|
||||||
|
/*
|
||||||
|
* Created by Brett on 23/08/23.
|
||||||
|
* Licensed under GNU General Public License V3.0
|
||||||
|
* See LICENSE file for license detail
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CROWSITE_PROJECTS_H
|
||||||
|
#define CROWSITE_PROJECTS_H
|
||||||
|
|
||||||
|
#include <crowsite/site/cache.h>
|
||||||
|
#include <crow/http_request.h>
|
||||||
|
#include <crow/http_response.h>
|
||||||
|
|
||||||
|
namespace cs
|
||||||
|
{
|
||||||
|
struct request_info {
|
||||||
|
CacheEngine& engine;
|
||||||
|
const crow::request& req;
|
||||||
|
std::string clientID;
|
||||||
|
std::string tokenID;
|
||||||
|
std::string path;
|
||||||
|
};
|
||||||
|
|
||||||
|
crow::response handleProjectPage(const request_info& req);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //CROWSITE_PROJECTS_H
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 4f3f5deaaa01825c63c83431bfa96ccec195f741
|
|
@ -127,7 +127,7 @@ namespace cs
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
insertAuth.set(username, 0);
|
insertAuth.set(username, 0);
|
||||||
insertAuth.set(PERM_DEFAULT | (jellyfin::getUserData(username).isAdmin ? PERM_ADMIN : 0), 1);
|
insertAuth.set((jellyfin::getUserData(username).isAdmin ? PERM_ADMIN : 0), 1);
|
||||||
|
|
||||||
if (!insertAuth.execute())
|
if (!insertAuth.execute())
|
||||||
{
|
{
|
||||||
|
@ -184,7 +184,7 @@ namespace cs
|
||||||
if (stmt.fail())
|
if (stmt.fail())
|
||||||
return 0;
|
return 0;
|
||||||
stmt.set(username, 0);
|
stmt.set(username, 0);
|
||||||
return static_cast<uint32_t>(stmt.executeAndGet<int32_t>(0));
|
return static_cast<uint32_t>(stmt.executeAndGet<int32_t>(0)) | cs::PERM_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void auth::init()
|
void auth::init()
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Created by Brett on 23/08/23.
|
||||||
|
* Licensed under GNU General Public License V3.0
|
||||||
|
* See LICENSE file for license detail
|
||||||
|
*/
|
||||||
|
#include <crowsite/site/projects.h>
|
||||||
|
|
||||||
|
namespace cs
|
||||||
|
{
|
||||||
|
|
||||||
|
crow::response handleProjectPage(const request_info& req)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
return crow::response("hel funny");
|
||||||
|
}
|
||||||
|
}
|
27
src/main.cpp
27
src/main.cpp
|
@ -10,7 +10,7 @@
|
||||||
#include <crowsite/site/auth.h>
|
#include <crowsite/site/auth.h>
|
||||||
#include <crow/middlewares/session.h>
|
#include <crow/middlewares/session.h>
|
||||||
#include <crow/middlewares/cookie_parser.h>
|
#include <crow/middlewares/cookie_parser.h>
|
||||||
#include "blt/std/assert.h"
|
#include <crowsite/site/projects.h>
|
||||||
|
|
||||||
using Session = crow::SessionMiddleware<crow::FileStore>;
|
using Session = crow::SessionMiddleware<crow::FileStore>;
|
||||||
using CrowApp = crow::App<crow::CookieParser, Session>;
|
using CrowApp = crow::App<crow::CookieParser, Session>;
|
||||||
|
@ -231,6 +231,9 @@ int main(int argc, const char** argv)
|
||||||
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";
|
context["SITE_BACKGROUND"] = "/static/images/backgrounds/2023-05-26_23.18.23.png";
|
||||||
|
context["MENU_BAR_COLOR"] = "#335";
|
||||||
|
context["MENU_BAR_HOVER"] = "#223";
|
||||||
|
context["MENU_BAR_ACTIVE"] = "#7821be";
|
||||||
|
|
||||||
BLT_INFO("Starting cache engine");
|
BLT_INFO("Starting cache engine");
|
||||||
|
|
||||||
|
@ -307,6 +310,28 @@ int main(int argc, const char** argv)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CROW_ROUTE(app, "/projects/<path>")(
|
||||||
|
[&engine, &app](const crow::request& req, const std::string& path) {
|
||||||
|
checkAndUpdateUserSession(app, req);
|
||||||
|
auto& session = app.get_context<Session>(req);
|
||||||
|
auto s_clientID = session.get("clientID", "");
|
||||||
|
auto s_clientToken = session.get("clientToken", "");
|
||||||
|
|
||||||
|
return cs::handleProjectPage({engine, req, s_clientID, s_clientToken, path});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
CROW_ROUTE(app, "/projects/")(
|
||||||
|
[&engine, &app](const crow::request& req) {
|
||||||
|
checkAndUpdateUserSession(app, req);
|
||||||
|
auto& session = app.get_context<Session>(req);
|
||||||
|
auto s_clientID = session.get("clientID", "");
|
||||||
|
auto s_clientToken = session.get("clientToken", "");
|
||||||
|
|
||||||
|
return cs::handleProjectPage({engine, req, s_clientID, s_clientToken, "index.html"});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
CROW_ROUTE(app, "/")(
|
CROW_ROUTE(app, "/")(
|
||||||
[&engine, &app](const crow::request& req) {
|
[&engine, &app](const crow::request& req) {
|
||||||
return handle_root_page({app, engine, req, "index.html"});
|
return handle_root_page({app, engine, req, "index.html"});
|
||||||
|
|
Loading…
Reference in New Issue