Finished WWWGen

This commit is contained in:
Mike Nolan 2024-09-23 20:54:06 -05:00
parent a8b69d1a81
commit 67df647fb2
2 changed files with 11 additions and 0 deletions

View File

@ -1060,6 +1060,7 @@ class StaticServer : public IServer {
#if defined(USE_SCRIPT_ENGINE)
ScriptEngine::RootEnvironment* env;
ScriptEngine::BytecodeFile* initFile;
#endif
std::filesystem::path dir;
bool allowListing;
@ -1173,6 +1174,12 @@ class StaticServer : public IServer {
Init(dir,allowListing,allowScript,std::vector<std::string>({"index.html","index.htm","default.html","default.htm"}));
}
#if defined(USE_SCRIPT_ENGINE)
ScriptEngine::RootEnvironment* GetRootEnvironment()
{
return this->env;
}
#endif
bool Handle(ServerContext* ctx)
{
auto path=sanitise(ctx->path);

View File

@ -427,6 +427,10 @@ int main(int argc,char** argv)
cls.append("\n#endif\n");
}
cls.append("}");
if(enableScripts)
{
cls.append("\n#if defined(USE_SCRIPT_ENGINE)\nTesses::WebServer::ScriptEngine::RootEnvironment* GetRootEnvironment(){return this->env;}\n#endif\n");
}
cls.append("bool Handle(Tesses::WebServer::ServerContext* ctx){auto path=sanitise(ctx->path); int index = get_file(path); if(index == -1) return false;");