summaryrefslogtreecommitdiffstats
path: root/source/WebAdmin.h
diff options
context:
space:
mode:
authorFakeTruth <faketruth@gmail.com>2013-07-29 02:37:59 +0200
committerFakeTruth <faketruth@gmail.com>2013-07-29 02:37:59 +0200
commit5a9d4f89c2212c83f05f910b6f2a176f21048ba6 (patch)
tree63414b5adfde3ff229612628a05ac1fbecb11a7b /source/WebAdmin.h
parentMerge branch 'master' of github.com:mc-server/MCServer (diff)
downloadcuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar
cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.gz
cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.bz2
cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.lz
cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.xz
cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.zst
cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.zip
Diffstat (limited to 'source/WebAdmin.h')
-rw-r--r--source/WebAdmin.h91
1 files changed, 59 insertions, 32 deletions
diff --git a/source/WebAdmin.h b/source/WebAdmin.h
index ad733e704..3e57bbf00 100644
--- a/source/WebAdmin.h
+++ b/source/WebAdmin.h
@@ -4,66 +4,93 @@
#include "OSSupport/Socket.h"
class cStringMap;
+class cLuaScript;
-struct HTTPFormData // tolua_export
-{ // tolua_export
- std::string Name; // tolua_export
- std::string Value; // tolua_export
- std::string Type; // tolua_export
+struct HTTPFormData // tolua_export
+{ // tolua_export
+ std::string Name; // tolua_export
+ std::string Value; // tolua_export
+ std::string Type; // tolua_export
};// tolua_export
-struct HTTPRequest // tolua_export
-{ // tolua_export
+struct HTTPRequest // tolua_export
+{ // tolua_export
typedef std::map< std::string, std::string > StringStringMap;
typedef std::map< std::string, HTTPFormData > FormDataMap;
- std::string Method; // tolua_export
- std::string Path; // tolua_export
- StringStringMap Params; // >> EXPORTED IN MANUALBINDINGS <<
- StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS <<
- std::string Username; // tolua_export
- FormDataMap FormData; // >> EXPORTED IN MANUALBINDINGS <<
+ AString Method; // tolua_export
+ AString Path; // tolua_export
+ StringStringMap Params; // >> EXPORTED IN MANUALBINDINGS <<
+ StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS <<
+ AString Username; // tolua_export
+ FormDataMap FormData; // >> EXPORTED IN MANUALBINDINGS <<
}; // tolua_export
+struct HTTPTemplateRequest // tolua_export
+{ // tolua_export
+ HTTPRequest Request; // tolua_export
+
+}; // tolua_export
+
+// tolua_begin
+struct sWebAdminPage
+{
+ AString Content;
+ AString PluginName;
+ AString TabName;
+};
+// tolua_end
+
struct lua_State;
class cEvent;
class cIniFile;
class cWebPlugin;
-class cWebAdmin
-{
-public:
+
+class cWebAdmin // tolua_export
+{ // tolua_export
+public: // tolua_export
cWebAdmin( int a_Port = 8080 );
~cWebAdmin();
- bool Init( int a_Port );
+ bool Init( int a_Port );
- void AddPlugin( cWebPlugin* a_Plugin );
- void RemovePlugin( cWebPlugin* a_Plugin );
+ void AddPlugin( cWebPlugin* a_Plugin );
+ void RemovePlugin( cWebPlugin* a_Plugin );
typedef std::list< cWebPlugin* > PluginList;
- PluginList GetPlugins() { return m_Plugins; }
- static void Request_Handler(webserver::http_request* r);
+ // TODO: Convert this to the auto-locking callback mechanism used for looping players in worlds and such
+ PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS <<
+
+ static void Request_Handler(webserver::http_request* r);
+
+ int GetPort() { return m_Port; } // tolua_export
- int GetPort() { return m_Port; }
+ sWebAdminPage GetPage(const HTTPRequest& a_Request); // tolua_export
+ AString GetBaseURL(const AString& a_URL); // tolua_export
+ AString GetBaseURL(const AStringVector& a_URLSplit);
+
+ AString GetMemoryUsage() const; // tolua_export
private:
#ifdef _WIN32
static DWORD WINAPI ListenThread(LPVOID lpParam);
#else
- static void *ListenThread( void *lpParam );
+ static void * ListenThread( void *lpParam );
#endif
- std::string GetTemplate();
+ AString GetTemplate();
+
+ cLuaScript* m_pTemplate;
- int m_Port;
+ int m_Port;
- bool m_bConnected;
- cSocket m_ListenSocket;
+ bool m_bConnected;
+ cSocket m_ListenSocket;
- cIniFile* m_IniFile;
- PluginList m_Plugins;
+ cIniFile* m_IniFile;
+ PluginList m_Plugins;
- cEvent* m_Event;
+ cEvent* m_Event;
- webserver* m_WebServer;
-}; \ No newline at end of file
+ webserver* m_WebServer;
+}; // tolua_export \ No newline at end of file