mirror of
https://github.com/privacore/open-source-search-engine.git
synced 2025-07-12 02:26:07 -04:00
/v2/crawl api
This commit is contained in:
@ -910,9 +910,13 @@ bool HttpServer::sendReply ( TcpSocket *s , HttpRequest *r , bool isAdmin) {
|
||||
// "GET /crawlbot/downloadurls"
|
||||
// "GET /crawlbot/downloadobjects"
|
||||
// "GET /crawlbot/downloadpages"
|
||||
if ( strncmp ( path , "/crawlbot/download/" ,19 ) == 0 )
|
||||
if ( strncmp ( path , "/crawlbot/download/" ,19 ) == 0 ||
|
||||
strncmp ( path , "/v2/crawl/download/" ,19 ) == 0 )
|
||||
return sendBackDump ( s , r );
|
||||
|
||||
if ( strncmp ( path , "/v2/crawl", 9 ) == 0 )
|
||||
return sendPageCrawlbot ( s , r );
|
||||
|
||||
// . is it a diffbot api request, like "GET /api/*"
|
||||
// . ie "/api/startcrawl" or "/api/stopcrawl" etc.?
|
||||
//if ( strncmp ( path , "/api/" , 5 ) == 0 )
|
||||
|
@ -1739,8 +1739,8 @@ bool sendReply2 (TcpSocket *socket , long fmt , char *msg ) {
|
||||
// send this back to browser
|
||||
SafeBuf sb;
|
||||
if ( fmt == FMT_JSON ) {
|
||||
sb.safePrintf("{\n{\"response\":\"success\"},\n"
|
||||
"{\"message\":\"%s\"}\n}\n"
|
||||
sb.safePrintf("{\n\"response\":\"success\",\n"
|
||||
"\"message\":\"%s\"\n}\n"
|
||||
, msg );
|
||||
ct = "application/json";
|
||||
}
|
||||
@ -1770,8 +1770,7 @@ bool sendErrorReply2 ( TcpSocket *socket , long fmt , char *msg ) {
|
||||
// send this back to browser
|
||||
SafeBuf sb;
|
||||
if ( fmt == FMT_JSON ) {
|
||||
sb.safePrintf("{\n{\"response\":\"fail\"},\n"
|
||||
"{\"message\":\"%s\"}\n}\n"
|
||||
sb.safePrintf("{\"error\":\"%s\"}\n"
|
||||
, msg );
|
||||
ct = "application/json";
|
||||
}
|
||||
|
Reference in New Issue
Block a user