diff options
-rwxr-xr-x | web/add_msg.sh | 43 | ||||
-rw-r--r-- | web/index.html | 16 | ||||
-rw-r--r-- | web/lighttpd.conf | 41 |
3 files changed, 100 insertions, 0 deletions
diff --git a/web/add_msg.sh b/web/add_msg.sh new file mode 100755 index 0000000..a956335 --- /dev/null +++ b/web/add_msg.sh @@ -0,0 +1,43 @@ +#!/bin/sh +set -e + +echo "Content-type:text/html +"; + +if [ "$REQUEST_METHOD" != "POST" ]; then + echo "Wrong request method" + exit 0 +fi + +if grep -q "$REMOTE_ADDR" /tmp/turris-lcd-did; then + echo "<!DOCTYPE html> + <html> + <head> + <title>Turris Omnia Feed</title> + </head> + <h3>We already have post from you.</h3> + </p> + </html>" + exit 0 +else + echo "$REMOTE_ADDR" >> /tmp/turris-lcd-did +fi + +MESSAGE="$(cat | sed 's/message=//;s/+/ /g')" + +echo "<!DOCTYPE html> +<html> +<head> + <title>Turris Omnia Feed</title> +</head> + <h3>Thank you for your message</h3> + <p>$(cat<<EOFIKA +$MESSAGE +EOFIKA +) +</p> +</html>" + +cat >/tmp/turris-lcd <<EOFIKA +$MESSAGE +EOFIKA diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..1e3de3b --- /dev/null +++ b/web/index.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<html> +<head> + <title>Turris Omnia Feed</title> +</head> + <body> + <form action="./add_msg.sh" method="post"> + <input type="text" name="message"><br> + <input type="submit" value="Submit"> + </form> + <br> + <sup> + Only ASCII characters are supported! + </sup> + </body> +</html> diff --git a/web/lighttpd.conf b/web/lighttpd.conf new file mode 100644 index 0000000..65fa580 --- /dev/null +++ b/web/lighttpd.conf @@ -0,0 +1,41 @@ +server.modules = ( + "mod_cgi" +) + +server.document-root = "/www2" +server.upload-dirs = ( "/tmp" ) +server.errorlog = "/var/log/lighttpd/error.log" +server.pid-file = "/var/run/lighttpd.pid" +#server.username = "http" +#server.groupname = "www-data" + +index-file.names = ( "index.php", "index.html", + "index.htm", "default.htm", + ) + +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py" ) + +### Options that are useful but not always necessary: +#server.chroot = "/" +#server.port = 81 +#server.bind = "localhost" +#server.tag = "lighttpd" +#server.errorlog-use-syslog = "enable" +#server.network-backend = "writev" + +# listen on IPv6 +$SERVER["socket"] == "[::]:80" { } + +### Use IPv6 if available +#include_shell "/usr/share/lighttpd/use-ipv6.pl" + +#dir-listing.encoding = "utf-8" +#server.dir-listing = "enable" + +include "/etc/lighttpd/mime.conf" +#include "/etc/lighttpd/modules.d/*.load" +#include "/etc/lighttpd/conf.d/*.conf" + +cgi.assign += ( + ".sh" => "/bin/sh" +) |