diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-03-08 14:59:11 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-03-08 14:59:11 +0100 |
commit | 4350eec6a845224f1dbf2889211604090cabb9cb (patch) | |
tree | 4c940d9fc37be7548d7e04b05b6399965aed23d1 /info.filter.dpi | |
parent | 863cd653c5090952f92eb300beecbf8e667fcfe6 (diff) |
Add Makefile and dpi wrapper
Diffstat (limited to 'info.filter.dpi')
-rwxr-xr-x | info.filter.dpi | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/info.filter.dpi b/info.filter.dpi new file mode 100755 index 0000000..e0b7e47 --- /dev/null +++ b/info.filter.dpi @@ -0,0 +1,39 @@ +#!/bin/bash +# Copyright (c) 2024-2025 Rodrigo Arias Mallo +# SPDX-License-Identifier: GPL-3.0-or-later + +IFS= read -d '>' auth # Ignore auth +IFS= read -d '>' cmd + +case "$cmd" in + "<cmd='open_url' url='"*);; + *) echo $cmd; exit;; +esac + +url=${cmd#"<cmd='open_url' url='"} +url=${url%"' '"} + +serve_404() { + printf "<cmd='start_send_page' url='' '>\n" + printf "Content-type: text/plain\r\n\r\n" + echo "Not found" + exit 0 +} + +serve_manpage() { + url="$1" + ref="${url#"info:"}" + # If page not found, return 404 + #if [ -z "$ref" ]; then + # serve_404 + # exit 0 + #fi + printf "<cmd='start_send_page' url='' '>\n" + printf "Content-type: text/html\r\n\r\n" + perl ~/.dillo/dpi/info/info2html "$ref" +} + +case "$url" in + info:*) serve_manpage "$url";; + *) serve_404;; +esac |