Added a skeleton StaticPage and StaticFolderPage classes and a few notes.

This commit is contained in:
Relintai 2022-02-04 18:38:18 +01:00
parent e240034626
commit 10af49898f
9 changed files with 188 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python
Import("env_mod")
Import("env")
env_mod.core_sources = []
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
# Build it all as a library
lib = env_mod.add_library("paged_list", env_mod.core_sources)
env.Prepend(LIBS=[lib])

View File

@ -0,0 +1,27 @@
import os
import platform
import sys
def is_active():
return True
def get_name():
return "paged_list"
def can_build():
return True
def get_opts():
return []
def get_flags():
return []
def configure(env):
pass

View File

@ -0,0 +1,21 @@
#include "static_folder_page.h"
#include "core/http/request.h"
#include <iostream>
#include "core/file_cache.h"
#include "core/database/database_manager.h"
#include "core/html/html_builder.h"
void StaticFolderPage::handle_request_main(Request *request) {
}
void StaticFolderPage::load() {
}
StaticFolderPage::StaticFolderPage() :
WebNode() {
}
StaticFolderPage::~StaticFolderPage() {
}

View File

@ -0,0 +1,34 @@
#ifndef STATIC_FOLDER_PAGE_H
#define STATIC_FOLDER_PAGE_H
#include "core/string.h"
#include "core/http/web_node.h"
//StaticFolderPage
//Just serve files
//404 if doesnt exist
//staticsitefolderpage
//index file support per dir
//could render md -> if .md -> check if changed -> cache -> file date
//could render bbcode -> if .bb
//static file list
//same as StaticFolderPage but can render file list
class StaticFolderPage : public WebNode {
RCPP_OBJECT(StaticFolderPage, WebNode);
public:
void handle_request_main(Request *request);
void load();
StaticFolderPage();
~StaticFolderPage();
String folder;
};
#endif

View File

@ -8,6 +8,10 @@
#include "modules/list_page/list_page.h"
#include "modules/paged_article/paged_article.h"
// inherit from StaticPage
// (make the module a dependency)
// Add PagedArticle as child -> rout everything to it the same way as now
class PagedList : public WebNode {
RCPP_OBJECT(PagedList, WebNode);

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python
Import("env_mod")
Import("env")
env_mod.core_sources = []
env_mod.add_source_files(env_mod.core_sources, "*.cpp")
# Build it all as a library
lib = env_mod.add_library("paged_list", env_mod.core_sources)
env.Prepend(LIBS=[lib])

View File

@ -0,0 +1,27 @@
import os
import platform
import sys
def is_active():
return True
def get_name():
return "paged_list"
def can_build():
return True
def get_opts():
return []
def get_flags():
return []
def configure(env):
pass

View File

@ -0,0 +1,18 @@
#include "static_page.h"
#include "core/http/request.h"
#include "core/file_cache.h"
#include "core/html/html_builder.h"
void StaticPage::handle_request_main(Request *request) {
}
void StaticPage::load() {
}
StaticPage::StaticPage() :
WebNode() {
}
StaticPage::~StaticPage() {
}

View File

@ -0,0 +1,33 @@
#ifndef STATIC_PAGE_H
#define STATIC_PAGE_H
#include "core/string.h"
#include "core/http/web_node.h"
/*
StaticPage -> string data (serve it)
load_md(path) + parse_md(data)
load_bbcode(path) + ...
load_html(path)
load_file(path)
bool add menu -> handle
*/
class StaticPage : public WebNode {
RCPP_OBJECT(StaticPage, WebNode);
public:
void handle_request_main(Request *request);
void load();
StaticPage();
~StaticPage();
};
#endif