Upgrade to kiln 0.2

This commit is contained in:
2022-01-03 15:56:24 +00:00
parent f6a2f62c92
commit 04ef9421b8
49 changed files with 100 additions and 35 deletions

13
static/cgi-bin/debug Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
if [ "$QUERY_STRING" = "" ]; then
echo -ne "10 Enter a query string\r\n"
exit 0
fi
echo -ne "20 text/plain\r\n"
echo -ne "SCRIPT_NAME: $SCRIPT_NAME\r\n"
echo -ne "PATH_INFO: $PATH_INFO\r\n"
echo -ne "QUERY_STRING: $QUERY_STRING\r\n"

87
static/cgi-bin/translate Executable file
View File

@@ -0,0 +1,87 @@
#!/usr/bin/ruby --disable-all
# A cgi-bin script that translates between languages. It relies on apertium
# being installed on the machine.
#
# CGI works with environment variables. Here are the ones that matter:
#
# PATH_INFO: /<from>/<to>
# QUERY_STRING: Some%20text%20to%20translate
#
# We expect to be called like: /cgi-bin/translate/eng/spa?Food
#
# If we don't have two languages, make it a Not Found error.
# If we don't have a query string to translate, ask for one.
require 'cgi'
LANGUAGE_PAIRS = %w[en-es es-en]
Encoding.default_internal = Encoding::UTF_8
Encoding.default_external = Encoding::UTF_8
class Object
def blank?
nil? || self&.empty?
end
end
def respond!(code, meta, body = nil)
STDOUT.print("#{code} #{meta}\r\n")
STDOUT.print(body) unless body.blank?
exit 0
end
def ask!(prompt)
respond!(10, prompt)
end
def ok!(meta, body = nil)
respond!(20, meta, body)
end
def temp_fail!(meta = 'Temporary Failure')
respond!(40, meta)
end
def not_found!(meta = 'Not Found')
respond!(51, meta)
end
def extract_langpair(path)
return if path.blank? || !path.start_with?('/')
_, src, dst, *rest = path.split('/')
return unless rest.empty?
pair = [src, dst].join('-')
return unless LANGUAGE_PAIRS.include?(pair)
pair
end
def extract_text(query)
return "" if query.blank?
CGI.unescape(query)
end
LANG_PAIR = extract_langpair(ENV['PATH_INFO'])
not_found! if LANG_PAIR.blank?
TRANSLATE = extract_text(ENV['QUERY_STRING'])
# TODO: we could detect a URL and translate the whole page sometime, perhaps
ask!('Enter text to translate') if TRANSLATE.blank?
require 'open3'
translation, status = Open3.capture2({'LC_ALL' => 'C.UTF-8'}, 'apertium', '-un', LANG_PAIR, stdin_data: TRANSLATE, binmode: true)
translation = translation.force_encoding("UTF-8")
temp_fail!("Couldn't get translation") unless status.success?
ok!('text/plain; charset="utf-8"', translation)

BIN
static/img/nick-thomas.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

30
static/me@ur.gs.gpg.asc Normal file
View File

@@ -0,0 +1,30 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFOW+lMBCAD05mgSzlPUOeA2Gt4zqSCJEyCVNLe5lD91/C0kd+QydMt3Ut52
a+f2Xi0AN4uyB/62vQao7g5lZar6amwFxGSdZ801J939lCDZuW1BzKuTZP5XCMsw
60PhP5FU0CJ6+QN2rLbEuyoQfsxz2raHbaZWLazu/7brq6TPTlk3LcEdq6t9uC/Q
OYd2Q2MOBetTLISInfpJbnsSku1kPAOiF20mVvbv203xoWrk9X7jdEEzWYadxlQc
16nk7RI9N9aJZQz+QKQhSS07iTJewQmnGXCjRL/zxOFfH9MiwdsW7CqOaBHZ9KIR
+RMi/OmGlUx/Kos7OqWwlolRJUVAEIJqvipxABEBAAG0Fk5pY2sgVGhvbWFzIDxt
ZUB1ci5ncz6JAVUEEwEKAD8CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAFiEE
hBJaWPrZKL9IsuK5Hxp+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RB4re0co
ZKoZPlCGBUNwc1JmRzgO90EA6ymJ50SJ8eFoyiw9Ar3xFmiE1I6PGMJOAeqQLNe4
HuHNA3gHoA0WByf/TWuUZGCl4i1IIpY1OiEMyIoHOg==
=fti4
-----END PGP PUBLIC KEY BLOCK-----

BIN
static/pdf/payling2014.pdf Normal file

Binary file not shown.

36
static/robots.txt Normal file
View File

@@ -0,0 +1,36 @@
# Being archived in a long-term store is harmful to my privacy. Never
# know when I might need to change something in a hurry
User-Agent: ia_archiver
Disallow: /
User-Agent: archiver
Disallow: /
# Search engines tend to update their indexes fairly quickly, so no
# objections to being indexed by them in general. That said, I want to
# do my own (tiny) part in making Google useless
# not contribute to
User-Agent: indexer
Disallow:
User-agent: Googlebot
Disallow: /
User-Agent: gus
Disallow:
# Research *should* only report anonymised aggregates, I can live with
# that
User-Agent: researcher
Disallow:
# I remain confused by the incluson of proxies in robots.txt, but am
# happy for them to access the site as long as they themselves forbid
# being indexed or archived. I can add exceptions if I find any that
# don't do that
User-Agent: webproxy
Disallow:
# Here be dragons
User-Agent: *
Disallow: /cgi-bin/

1
static/success.txt Normal file
View File

@@ -0,0 +1 @@
success

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff