mirror of
https://github.com/lxsang/ant-http
synced 2025-07-24 17:49:46 +02:00
major change for plugin handle
This commit is contained in:
@ -29,4 +29,15 @@ void get(int client,const char* method,dictionary rq)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
void handler(int client, const char* method, const char* rqpth, dictionary rq)
|
||||
{
|
||||
if(EQU(rqpth,"default"))
|
||||
{
|
||||
execute(client,method,rq);
|
||||
}
|
||||
else
|
||||
{
|
||||
unknow(client);
|
||||
}
|
||||
}
|
@ -128,3 +128,26 @@ void jsonex(int client,const char* method,dictionary rq)
|
||||
jpeg(client);
|
||||
__f(client,htdocs("images/ex.jpg"));
|
||||
}
|
||||
void handler(int client, const char* method, const char* rqpth, dictionary rq)
|
||||
{
|
||||
if(EQU(rqpth,"default"))
|
||||
{
|
||||
execute(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"delete"))
|
||||
{
|
||||
delete(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"update"))
|
||||
{
|
||||
execute(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"jsonex"))
|
||||
{
|
||||
execute(client,method,rq);
|
||||
}
|
||||
else
|
||||
{
|
||||
unknow(client);
|
||||
}
|
||||
}
|
@ -189,4 +189,27 @@ void rmfolder(int c, const char* m, dictionary rq)
|
||||
void pexit()
|
||||
{
|
||||
LOG("Exit file manager,plugins\n");
|
||||
}
|
||||
void handler(int client, const char* method, const char* rqpth, dictionary rq)
|
||||
{
|
||||
if(EQU(rqpth,"default"))
|
||||
{
|
||||
execute(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"add"))
|
||||
{
|
||||
add(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"rmfolder"))
|
||||
{
|
||||
rmfolder(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"mkfolder"))
|
||||
{
|
||||
mkfolder(client,method,rq);
|
||||
}
|
||||
else
|
||||
{
|
||||
unknow(client);
|
||||
}
|
||||
}
|
Binary file not shown.
@ -138,8 +138,8 @@ void pexit()
|
||||
{
|
||||
LOG("%s","EXIT daemon");
|
||||
}
|
||||
void execute(int c, const char* m, dictionary d)
|
||||
void handler(int c, const char* m, const char* rqp, dictionary d)
|
||||
{
|
||||
text(c);
|
||||
__t(c,"This is a system plugin. It cant be acessed from the web");
|
||||
}
|
||||
}
|
||||
|
@ -250,4 +250,9 @@ char* config_dir()
|
||||
if (stat(path, &st) == -1)
|
||||
mkdir(path, 0755);
|
||||
return path;
|
||||
}
|
||||
void unknow(int client)
|
||||
{
|
||||
html(client);
|
||||
__t(client,"404 API not found");
|
||||
}
|
@ -59,4 +59,5 @@ sqldb getdb();
|
||||
void set_cookie(int,dictionary);
|
||||
|
||||
/*Default function for plugin*/
|
||||
void execute(int, const char*,dictionary);
|
||||
void handler(int, const char*,const char*,dictionary);
|
||||
void unknow(int);
|
||||
|
@ -74,3 +74,18 @@ void install(int c, const char* m, dictionary rq)
|
||||
|
||||
__t(c,result,0,"This is not a plugin file");
|
||||
}
|
||||
void handler(int client, const char* method, const char* rqpth, dictionary rq)
|
||||
{
|
||||
if(EQU(rqpth,"default"))
|
||||
{
|
||||
execute(client,method,rq);
|
||||
}
|
||||
else if(EQU(rqpth,"install"))
|
||||
{
|
||||
install(client,method,rq);
|
||||
}
|
||||
else
|
||||
{
|
||||
unknow(client);
|
||||
}
|
||||
}
|
Binary file not shown.
@ -37,7 +37,7 @@ int read_buf(int fd, char*buf,int size)
|
||||
buf[i] = '\0';
|
||||
return i;
|
||||
}
|
||||
void execute(int client, const char* m, dictionary rq)
|
||||
void handler(int client, const char* m, const char* rqp, dictionary rq)
|
||||
{
|
||||
textstream(client);
|
||||
int filedes[2];
|
||||
|
Reference in New Issue
Block a user