2022-07-23 01:35:22 +02:00
|
|
|
#ifndef STATIC_WEB_PAGE_H
|
|
|
|
#define STATIC_WEB_PAGE_H
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
#include "core/ustring.h"
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
#include "../../http/web_node.h"
|
|
|
|
|
|
|
|
class WebServerRequest;
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-23 01:35:22 +02:00
|
|
|
class StaticWebPage : public WebNode {
|
|
|
|
GDCLASS(StaticWebPage, WebNode);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
|
|
|
public:
|
2022-07-02 13:22:10 +02:00
|
|
|
String get_data();
|
|
|
|
void set_data(const String &val);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
String get_preview_data();
|
|
|
|
void set_preview_data(const String &val);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
bool get_should_render_menu();
|
|
|
|
void set_should_render_menu(const bool &val);
|
|
|
|
|
|
|
|
void _handle_request(Ref<WebServerRequest> request);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
void _render_index(Ref<WebServerRequest> request);
|
|
|
|
void _render_preview(Ref<WebServerRequest> request);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
void load_file(const String &path);
|
|
|
|
void load_and_process_file(const String &path);
|
2022-06-30 13:23:14 +02:00
|
|
|
|
2022-07-23 02:34:41 +02:00
|
|
|
void load_md_file(const String &path);
|
|
|
|
void set_data_md(const String &data);
|
|
|
|
|
2022-07-23 01:35:22 +02:00
|
|
|
StaticWebPage();
|
|
|
|
~StaticWebPage();
|
2022-07-02 13:22:10 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
String _data;
|
|
|
|
String _preview_data;
|
|
|
|
bool _should_render_menu;
|
2022-06-30 13:23:14 +02:00
|
|
|
};
|
|
|
|
|
2022-07-02 13:22:10 +02:00
|
|
|
#endif
|