Skip to content

Commit

Permalink
added json(p) endpoint for crawl start
Browse files Browse the repository at this point in the history
  • Loading branch information
Orbiter committed Jun 16, 2017
1 parent 83ba45e commit 369b8e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions htroot/Crawler_p.java
Expand Up @@ -90,6 +90,16 @@ public static serverObjects respond(final RequestHeader header, final serverObje
// inital values for AJAX Elements (without JavaScript)
final serverObjects prop = new serverObjects();
prop.put("rejected", 0);

// check for JSONP
if (post != null && post.containsKey("callback") ) {
final String jsonp = post.get("callback") + "([";
prop.put("jsonp-start", jsonp);
prop.put("jsonp-end", "])");
} else {
prop.put("jsonp-start", "");
prop.put("jsonp-end", "");
}

Segment segment = sb.index;
Fulltext fulltext = segment.fulltext();
Expand Down
6 changes: 6 additions & 0 deletions htroot/Crawler_p.json
@@ -0,0 +1,6 @@
#[jsonp-start]#
{
"success": "true",
"comment": "#(info)#::Error with profile management. Please stop YaCy, delete the file DATA/PLASMADB/crawlProfiles0.db and restart. ::Error: #[errmsg]# ::Application not yet initialized. Sorry. Please wait some seconds and repeat the request. ::ERROR: Crawl filter '#[newcrawlingfilter]#' does not match with crawl root '#[crawlingStart]#'.Please try again with different filter.::Crawling of '#[crawlingURL]#' failed. Reason: #[reasonString]#::Error with URL input '#[crawlingStart]#': #[error]#::Error with file input '#[crawlingStart]#': #[error]# ::Crawling of '#[crawlingURL]#' started.#(/info)#"
}
#[jsonp-end]#

0 comments on commit 369b8e0

Please sign in to comment.