Skip to content

Commit

Permalink
Merge pull request markparticle#19 from markparticle/dev_mark
Browse files Browse the repository at this point in the history
💄 updage html
  • Loading branch information
markparticle authored Jun 30, 2020
2 parents 629fe4c + 7276b4b commit 1b3621c
Show file tree
Hide file tree
Showing 67 changed files with 5,918 additions and 258 deletions.
9 changes: 3 additions & 6 deletions code/http/httprequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ using namespace std;

const unordered_set<string> HttpRequest::DEFAULT_HTML{
"/index", "/register", "/login",
"/welcome", "/video", "/picture",
"/file"};
"/welcome", "/video", "/picture", };

const unordered_map<string, int> HttpRequest::DEFAULT_HTML_TAG {
{"/register.html", 0}, {"/login.html", 1}, };
Expand Down Expand Up @@ -127,10 +126,8 @@ void HttpRequest::ParsePost_() {
if(UserVerify(post_["username"], post_["password"], isLogin)) {
path_ = "/welcome.html";
}
else if(isLogin) {
path_ = "/logError.html";
} else {
path_ = "/registerError.html";
else {
path_ = "/error.html";
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions code/http/httpresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const unordered_map<int, string> HttpResponse::CODE_STATUS = {
};

const unordered_map<int, string> HttpResponse::CODE_PATH = {
{ 400, "/404.html" },
{ 400, "/400.html" },
{ 403, "/403.html" },
{ 404, "/404.html" },
{ 500, "/405.html" },
{ 500, "/500.html" },
};

HttpResponse::HttpResponse() {
Expand Down
1 change: 1 addition & 0 deletions code/log/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Log::~Log() {
writeThread_->join();
}
if(fp_) {
lock_guard<mutex> locker(mtx_);
flush();
fclose(fp_);
}
Expand Down
5 changes: 3 additions & 2 deletions code/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ int main() {
//daemon(1, 0);
WebServer server(
1316, 3, 5000, true, false, /* 端口 ET模式 timeoutMs Proactor/Reactor(使用异步线程池) 优雅退出 */
3306, "root", "root", "webserver", /* Mysql配置 */
100, 8, true, 0, 0); /* 连接池数量 线程池数量 日志开关 日志等级 日志异步队列容量 */
3306, "root", "root", "webserver", /* Mysql配置 */
100, 6, false, 0, 0); /* 连接池数量 线程池数量 日志开关 日志等级 日志异步队列容量 */
server.Start();
}

2 changes: 1 addition & 1 deletion code/server/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WebServer::WebServer(

srcDir_ = getcwd(nullptr, 256);
assert(srcDir_);
strncat(srcDir_, "/resources/html", 16);
strncat(srcDir_, "/resources/", 16);
HttpConn::userCount = 0;
HttpConn::srcDir = srcDir_;
SqlConnPool::Instance()->Init("localhost", sqlPort, sqlUser, sqlPwd, dbName, connPoolNum);
Expand Down
85 changes: 85 additions & 0 deletions resources/400.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!--
* @Author : mark
* @Date : 2020-06-30
* @copyleft GPL 2.0
-->
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<title>MARK-首页</title>
<link rel="icon" href="images/favicon.ico">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/font-awesome.min.css">

<!-- Main css -->
<link rel="stylesheet" href="css/style.css">

</head>

<body data-spy="scroll" data-target=".navbar-collapse" data-offset="50">

<!-- PRE LOADER -->
<div class="preloader">
<div class="spinner">
<span class="spinner-rotate"></span>
</div>
</div>


<!-- NAVIGATION SECTION -->
<div class="navbar custom-navbar navbar-fixed-top" role="navigation">
<div class="container">

<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
</button>
<!-- lOGO TEXT HERE -->
<a href="/" class="navbar-brand">Mark</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a class="smoothScroll" href="/">首页</a></li>
<li><a class="smoothScroll" href="/picture">图片</a></li>
<li><a class="smoothScroll" href="/video">视频</a></li>
<li><a class="smoothScroll" href="/login">登录</a></li>
<li><a class="smoothScroll" href="/register">注册</a></li>
</ul>
</div>

</div>
</div>
<!-- HOME SECTION -->
<section id="home">
<div class="container">
<div class="row">

<div class="col-md-offset-1 col-md-2 col-sm-3">
<img src="images/profile-image.jpg" class="wow fadeInUp img-responsive img-circle"
data-wow-delay="0.2s" alt="about image">
</div>
<div class="col-md-8 col-sm-8">
<h1 class="wow fadeInUp" data-wow-delay="0.6s">400 无法解析请求</h1>
</div>
</div>
</div>
</section>
<!-- SCRIPTS -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/magnific-popup-options.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/custom.js"></script>
</body>

</html>
85 changes: 85 additions & 0 deletions resources/403.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!--
* @Author : mark
* @Date : 2020-06-30
* @copyleft GPL 2.0
-->
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<title>MARK-首页</title>
<link rel="icon" href="images/favicon.ico">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/font-awesome.min.css">

<!-- Main css -->
<link rel="stylesheet" href="css/style.css">

</head>

<body data-spy="scroll" data-target=".navbar-collapse" data-offset="50">

<!-- PRE LOADER -->
<div class="preloader">
<div class="spinner">
<span class="spinner-rotate"></span>
</div>
</div>


<!-- NAVIGATION SECTION -->
<div class="navbar custom-navbar navbar-fixed-top" role="navigation">
<div class="container">

<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
</button>
<!-- lOGO TEXT HERE -->
<a href="/" class="navbar-brand">Mark</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a class="smoothScroll" href="/">首页</a></li>
<li><a class="smoothScroll" href="/picture">图片</a></li>
<li><a class="smoothScroll" href="/video">视频</a></li>
<li><a class="smoothScroll" href="/login">登录</a></li>
<li><a class="smoothScroll" href="/register">注册</a></li>
</ul>
</div>

</div>
</div>
<!-- HOME SECTION -->
<section id="home">
<div class="container">
<div class="row">

<div class="col-md-offset-1 col-md-2 col-sm-3">
<img src="images/profile-image.jpg" class="wow fadeInUp img-responsive img-circle"
data-wow-delay="0.2s" alt="about image">
</div>
<div class="col-md-8 col-sm-8">
<h1 class="wow fadeInUp" data-wow-delay="0.6s">403 禁止访问</h1>
</div>
</div>
</div>
</section>
<!-- SCRIPTS -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/magnific-popup-options.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/custom.js"></script>
</body>

</html>
85 changes: 85 additions & 0 deletions resources/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!--
* @Author : mark
* @Date : 2020-06-30
* @copyleft GPL 2.0
-->
<!DOCTYPE html>
<html lang="en">

<head>

<meta charset="UTF-8">

<title>MARK-首页</title>
<link rel="icon" href="images/favicon.ico">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/font-awesome.min.css">

<!-- Main css -->
<link rel="stylesheet" href="css/style.css">

</head>

<body data-spy="scroll" data-target=".navbar-collapse" data-offset="50">

<!-- PRE LOADER -->
<div class="preloader">
<div class="spinner">
<span class="spinner-rotate"></span>
</div>
</div>


<!-- NAVIGATION SECTION -->
<div class="navbar custom-navbar navbar-fixed-top" role="navigation">
<div class="container">

<div class="navbar-header">
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
<span class="icon icon-bar"></span>
</button>
<!-- lOGO TEXT HERE -->
<a href="/" class="navbar-brand">Mark</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li><a class="smoothScroll" href="/">首页</a></li>
<li><a class="smoothScroll" href="/picture">图片</a></li>
<li><a class="smoothScroll" href="/video">视频</a></li>
<li><a class="smoothScroll" href="/login">登录</a></li>
<li><a class="smoothScroll" href="/register">注册</a></li>
</ul>
</div>

</div>
</div>
<!-- HOME SECTION -->
<section id="home">
<div class="container">
<div class="row">

<div class="col-md-offset-1 col-md-2 col-sm-3">
<img src="images/profile-image.jpg" class="wow fadeInUp img-responsive img-circle"
data-wow-delay="0.2s" alt="about image">
</div>
<div class="col-md-8 col-sm-8">
<h1 class="wow fadeInUp" data-wow-delay="0.6s">404 没有找到该页面</h1>
</div>
</div>
</div>
</section>
<!-- SCRIPTS -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/magnific-popup-options.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/custom.js"></script>
</body>

</html>
Loading

0 comments on commit 1b3621c

Please sign in to comment.