diff options
author | glenda <glenda@9front.local> | 2020-11-15 15:13:27 +0000 |
---|---|---|
committer | glenda <glenda@9front.local> | 2020-11-15 15:13:27 +0000 |
commit | 39318169e0b50551db511851829f9337c5fa6313 (patch) | |
tree | 65a0ef5c1da9677532fa8105293d017919473057 /apps/duckduckgo/app.rc |
Import site to git
Diffstat (limited to 'apps/duckduckgo/app.rc')
-rwxr-xr-x | apps/duckduckgo/app.rc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/duckduckgo/app.rc b/apps/duckduckgo/app.rc new file mode 100755 index 0000000..72dd0ec --- /dev/null +++ b/apps/duckduckgo/app.rc @@ -0,0 +1,30 @@ +fn conf_enable_duckduckgo { + enable_duckduckgo=yes + conf_enable_app duckduckgo + pageTitle='Site Search' +} + + +fn duckduckgo_init { + get_post_args q + if (! ~ $#q 0) { + redirect_string = 'https://duckduckgo.com/?q=site:'$SERVER_NAME^'+'^$"q + http_redirect $redirect_string '302 Found' + } + if not { + handler_body_main='duckduckgo_body' + } +} + +fn duckduckgo_body { + echo ' +<h1>Site search</h1> +<h2>using DuckDuckGo</h2> +<form action="/_search/" method="POST"> +<label for="searchtext">Site search:</label> +<input type="text" id="searchtext" name="q" placeholder="Search text..."> +<input type="submit" value="Search"> +</form>' + +} + |