From 7b0f0bba4152beb7bab8e63b71ebb2aacb7e9d6e Mon Sep 17 00:00:00 2001 From: amass Date: Wed, 27 Nov 2024 23:50:04 +0800 Subject: [PATCH] readd url filter. --- Server/Application.cpp | 6 ++++-- WebApplication/CMakeLists.txt | 3 ++- WebApplication/Hello.cpp | 2 +- WebApplication/{LoginWidget.cpp => LoginPage.cpp} | 6 ++++-- WebApplication/{LoginWidget.h => LoginPage.h} | 0 WebApplication/VisitorRecordsPage.cpp | 1 + WebApplication/VisitorRecordsPage.h | 9 +++++++++ 7 files changed, 21 insertions(+), 6 deletions(-) rename WebApplication/{LoginWidget.cpp => LoginPage.cpp} (77%) rename WebApplication/{LoginWidget.h => LoginPage.h} (100%) create mode 100644 WebApplication/VisitorRecordsPage.cpp create mode 100644 WebApplication/VisitorRecordsPage.h diff --git a/Server/Application.cpp b/Server/Application.cpp index bacea44..6e2fb51 100644 --- a/Server/Application.cpp +++ b/Server/Application.cpp @@ -159,8 +159,10 @@ Application::Application(const std::string &path) url = root["url"].as_string(); } auto database = Database::session(); - // if (std::filesystem::exists("amass_blog" + url) && url.find("/我的博客/page") != 0) { - { + if (std::filesystem::exists("amass_blog" + url) && url.find("/我的博客/page") != 0) { + if (url.size() > 1 && url.back() == '/') { + url.pop_back(); + } Wt::Dbo::Transaction transaction(*database); auto record = std::make_unique(); record->time = std::chrono::system_clock::now(); diff --git a/WebApplication/CMakeLists.txt b/WebApplication/CMakeLists.txt index ad1bb82..cad285b 100644 --- a/WebApplication/CMakeLists.txt +++ b/WebApplication/CMakeLists.txt @@ -2,7 +2,8 @@ find_package(Wt REQUIRED Wt) add_library(WebApplication WebApplication.h WebApplication.cpp - LoginWidget.h LoginWidget.cpp + LoginPage.h LoginPage.cpp + VisitorRecordsPage.h VisitorRecordsPage.cpp Hello.h Hello.cpp Restful.h Restful.cpp Dialog.h Dialog.cpp diff --git a/WebApplication/Hello.cpp b/WebApplication/Hello.cpp index a7fa55b..642b30f 100644 --- a/WebApplication/Hello.cpp +++ b/WebApplication/Hello.cpp @@ -2,7 +2,7 @@ #include "BoostLog.h" #include "Database/Session.h" #include "Dialog.h" -#include "LoginWidget.h" +#include "LoginPage.h" #include "WebApplication.h" #include #include diff --git a/WebApplication/LoginWidget.cpp b/WebApplication/LoginPage.cpp similarity index 77% rename from WebApplication/LoginWidget.cpp rename to WebApplication/LoginPage.cpp index 80b45c2..36ca9b2 100644 --- a/WebApplication/LoginWidget.cpp +++ b/WebApplication/LoginPage.cpp @@ -1,4 +1,4 @@ -#include "LoginWidget.h" +#include "LoginPage.h" #include "WebApplication.h" #include #include @@ -12,6 +12,8 @@ LoginWidget::LoginWidget(Wt::Auth::AbstractUserDatabase &users, Wt::Auth::Login authWidget->model()->addPasswordAuth(&app->passwordService()); authWidget->setRegistrationEnabled(true); authWidget->processEnvironment(); - setAttributeValue("style", "transform: translateY(-100px);"); + // setAttributeValue("style", "transform: translateY(-100px);"); addWidget(std::move(authWidget)); + + authWidget-> resolve("login")->addStyleClass("button--primary"); } diff --git a/WebApplication/LoginWidget.h b/WebApplication/LoginPage.h similarity index 100% rename from WebApplication/LoginWidget.h rename to WebApplication/LoginPage.h diff --git a/WebApplication/VisitorRecordsPage.cpp b/WebApplication/VisitorRecordsPage.cpp new file mode 100644 index 0000000..a0bed2c --- /dev/null +++ b/WebApplication/VisitorRecordsPage.cpp @@ -0,0 +1 @@ +#include "VisitorRecordsPage.h" \ No newline at end of file diff --git a/WebApplication/VisitorRecordsPage.h b/WebApplication/VisitorRecordsPage.h new file mode 100644 index 0000000..0ced9b8 --- /dev/null +++ b/WebApplication/VisitorRecordsPage.h @@ -0,0 +1,9 @@ +#ifndef __VISITORRECORDSPAGE_H__ +#define __VISITORRECORDSPAGE_H__ + +class VisitorRecordsPage { + +}; + + +#endif // __VISITORRECORDSPAGE_H__ \ No newline at end of file