-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.cfm
32 lines (27 loc) · 1.05 KB
/
index.cfm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<cfscript>
include 'plugin/config.cfm';
import model.Extractor;
import model.Checker;
action($, pluginConfig);
function action($, pluginConfig) {
var action = $.event('action');
var result = {};
var result = {};
if (action == 'extract_links') {
var extractor = new model.Extractor($);
var pages = extractor.extractLinks();
cfcontent(type="application/json");
writeOutput(serializeJSON(pages));
} else if (action == 'check_links') {
var checker = new model.Checker($, pluginConfig);
var urls = deserializeJSON($.event('urls'));
var timeout = val($.event('timeout'));
var followRedirects = ($.event('followRedirects') == 'yes');
var results = checker.check(urls, timeout, followRedirects);
cfcontent(type="application/json");
writeOutput(serializeJSON(results));
} else {
include 'views/default.cfm';
}
}
</cfscript>