mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-12 13:51:10 +01:00
Added a new LocaleSetupWebServerMiddleware.
This commit is contained in:
parent
9ee96b25f8
commit
1788749a8f
@ -31,6 +31,7 @@
|
||||
|
||||
#include "web_server_middleware.h"
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "web_server_request.h"
|
||||
|
||||
bool WebServerMiddleware::on_before_handle_request_main(Ref<WebServerRequest> request) {
|
||||
@ -54,3 +55,14 @@ void WebServerMiddleware::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_on_before_handle_request_main", "request"), &WebServerMiddleware::_on_before_handle_request_main);
|
||||
}
|
||||
|
||||
// LocaleSetupWebServerMiddleware
|
||||
|
||||
bool LocaleSetupWebServerMiddleware::_on_before_handle_request_main(Ref<WebServerRequest> request) {
|
||||
request->load_locale_from_cookie();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LocaleSetupWebServerMiddleware::_bind_methods() {
|
||||
}
|
||||
|
@ -54,4 +54,14 @@ protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
class LocaleSetupWebServerMiddleware : public WebServerMiddleware {
|
||||
GDCLASS(LocaleSetupWebServerMiddleware, WebServerMiddleware);
|
||||
|
||||
public:
|
||||
virtual bool _on_before_handle_request_main(Ref<WebServerRequest> request);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -130,7 +130,6 @@ void register_web_types(ModuleRegistrationLevel p_level) {
|
||||
|
||||
ClassDB::register_class<HTTPServerEnums>();
|
||||
|
||||
ClassDB::register_class<CSRFTokenWebServerMiddleware>();
|
||||
ClassDB::register_class<HTTPSession>();
|
||||
ClassDB::register_class<HTTPSessionManager>();
|
||||
ClassDB::register_class<SessionSetupWebServerMiddleware>();
|
||||
@ -143,6 +142,9 @@ void register_web_types(ModuleRegistrationLevel p_level) {
|
||||
ClassDB::register_class<WebServerRequest>();
|
||||
ClassDB::register_class<WebServerRequestScriptable>();
|
||||
|
||||
ClassDB::register_class<CSRFTokenWebServerMiddleware>();
|
||||
ClassDB::register_class<LocaleSetupWebServerMiddleware>();
|
||||
|
||||
ClassDB::register_class<StaticWebPage>();
|
||||
ClassDB::register_class<StaticWebPageFile>();
|
||||
ClassDB::register_class<StaticWebPageFolderFiles>();
|
||||
|
Loading…
Reference in New Issue
Block a user