reducing use of php in favor of shellscript build

This commit is contained in:
Ben Morrison 2020-06-30 00:31:04 -04:00
parent 603ac04ec0
commit 5db8118b17
Signed by: gbmor
GPG Key ID: 8F192E4720BB0DAC
22 changed files with 185 additions and 141 deletions

7
.gitignore vendored
View File

@ -1,6 +1 @@
fuzzies.log
ultimate-email
newusers.dat
/table.*
userlist
bannedusers.php
dist

View File

@ -1,2 +0,0 @@
<link rel="webmention" href="https://webmention.io/tilde.institute/webmention" />
<link rel="pingback" href="https://webmention.io/tilde.institute/xmlrpc" />

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

63
build.sh Executable file
View File

@ -0,0 +1,63 @@
#!/bin/sh
set -e
build()
{
printf '\n%s\n' 'Starting build ...'
mkdir -p dist
for FILE in html/*; do
FILENAME=$(basename "$FILE")
printf '\n%s %s\n' 'Building:' "$FILENAME"
if [ "$FILENAME" != 'index.html' ]; then
sed '/{{HEADER}}/r inc/_header.html' "$FILE" | sed '/{{HEADER}}/D' | sed '/{{LOGONAV}}/r inc/_logonav.html' | sed '/{{LOGONAV}}/D' > "dist/$FILENAME"
else
sed '/{{HEADER}}/r inc/_header.html' "$FILE" | sed '/{{HEADER}}/D' | sed '/{{LOGONAV}}/r inc/_logonav.html' | sed '/{{LOGONAV}}/D' | sed '/{{NEWS}}/r inc/_news.html' | sed '/{{NEWS}}/D' > "dist/$FILENAME"
fi
done
cp assets/* dist/
printf '%s\n\n' 'Done!'
}
installation()
{
if [ ! -d dist ]; then
printf '\n%s\n\n' 'Please build first: ./build.sh'
exit 1
fi
INSTDIR=/var/www/htdocs
printf '\n%s %s\n' 'Installing to' "$INSTDIR"
for FILE in dist/*; do
FILENAME=$(basename "$FILE")
EXT=$(echo "$FILENAME" | cut -d'.' -f2)
if [ "$EXT" = 'php' ] || [ "$EXT" = 'cgi' ]; then
install -m755 "$FILE" "$INSTDIR/$FILENAME"
else
install -m644 "$FILE" "$INSTDIR/$FILENAME"
fi
done
printf '%s\n\n' 'Done!'
}
clean()
{
printf '\n%s\n\n' 'Cleaning ...'
rm -rf dist
}
case "$1" in
install)
installation; exit ;;
clean)
clean; exit ;;
*)
build
esac

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

61
faq.php
View File

@ -1,61 +0,0 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tilde.institute :: FAQ</title>
<link rel="stylesheet" href="tilde.css" type="text/css" />
<link rel="icon" type="image/png" href="icon.png" />
<?php include("_webmention.html") ?>
</head>
<body>
<div id="container">
<?php include("_header.html"); ?>
<div id="content" class="faq">
<h1>FAQ</h1>
<p class="q">How do I change my interactive shell?</p>
<p>Once you've logged in, check the path for your desired shell with</p>
<div class="code">$ which fish</div>
<p>Replacing <code>fish</code> with the the shell you want. In this case, the path will be <code>/usr/local/bin/fish</code>
Now, run:</p>
<div class="code">$ EDITOR=nano chsh</div>
<p>Change the <code>Shell</code> line to read:</p>
<div class="code">Shell: /usr/local/bin/fish</div>
<p>Save and exit. You'll need to log out then back in.</p>
<p class="q">How do I change the index page of my site?</p>
<p>Because of the way <code>httpd(8)</code> is set up, you'll need to ask in <code>#institute</code> or send an email to <code>admins@tilde.institute</code></p>
<p class="q">Can you install this package for me?</p>
<p>As long as it's in the OpenBSD ports tree, and doesn't facilitate any potentially malicious behavior (like <code>nmap</code>),
then it's probably not a big deal. Either hop on IRC and ask in <code>#institute</code> or send an email to <code>admins@tilde.institute</code></p>
<p class="q">How do I authenticate with SMTP remotely?</p>
<p>Only local access to SMTP is allowed. However, you can use an SSH tunnel on your machine to send mail.</p>
<div class="code">ssh -nNTL 25:localhost:25 tilde.institute</div>
<p>You won't need to supply a username or password when sending mail via <code>localhost:25</code> this way, since you're already authenticated via SSH.</p>
<p class="q">Can you whitelist a port for me in the firewall?</p>
<p>Sorry, but this presents too much of a security risk on a public-access system.</p>
<p class="q">Are user services allowed?</p>
<p>Generally, yes. If you're running something that's using a ton of resources or in some way affecting other users or the general use of the system,
then we'll kill it. Just be aware of what you're running and how it may affect the system and other users.</p>
<p class="q">Are IRC bots allowed?</p>
<p>Yes, though there are restrictions on their use on the <code>tilde.chat</code> IRC network. They should not reside in <code>#meta</code>, instead keep
them in a private channel or in <code>#bots</code>. Bots must also conform to the <a href="https://tildegit.org/tildeverse/rfcs/src/branch/master/rfcs/rfc2.md">bot guidelines listed here</a>.</p>
<p>Don't run <code>eggdrop</code> from tilde.institute. There are legitimate uses for <code>eggdrop</code>, but separating the people with some kind
of legitimate use from malicious users is tiring. So, no <code>eggdrop</code>.</p>
<br />
<br />
</div>
</div>
</body>
</html>

14
coc.php → html/coc.html Executable file → Normal file
View File

@ -1,20 +1,14 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tilde.institute :: Code of Conduct</title>
<link rel="stylesheet" href="tilde.css" type="text/css" />
<link rel="icon" type="image/png" href="icon.png" />
<?php include("_webmention.html") ?>
{{HEADER}}
</head>
<body>
<div id="container">
<?php include("_header.html"); ?>
{{LOGONAV}}
<div id="content">
<h1>tilde.institute code of conduct</h1>
<p><strong>tl;dr</strong>: Be kind to each other. Think carefully about the words you
@ -118,4 +112,4 @@
</div>
</body>
</html>
</html>

67
html/faq.html Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>tilde.institute :: FAQ</title>
{{HEADER}}
</head>
<body>
<div id="container">
{{LOGONAV}}
<div id="content" class="faq">
<h1>FAQ</h1>
<p class="q">How do I change my interactive shell?</p>
<p>Once you've logged in, check the path for your desired shell with</p>
<div class="code">$ which fish</div>
<p>Replacing <code>fish</code> with the the shell you want. In this case, the path will be
<code>/usr/local/bin/fish</code>
Now, run:</p>
<div class="code">$ EDITOR=nano chsh</div>
<p>Change the <code>Shell</code> line to read:</p>
<div class="code">Shell: /usr/local/bin/fish</div>
<p>Save and exit. You'll need to log out then back in.</p>
<p class="q">How do I change the index page of my site?</p>
<p>Because of the way <code>httpd(8)</code> is set up, you'll need to ask in <code>#institute</code> or send
an email to <code>admins@tilde.institute</code></p>
<p class="q">Can you install this package for me?</p>
<p>As long as it's in the OpenBSD ports tree, and doesn't facilitate any potentially malicious behavior
(like <code>nmap</code>),
then it's probably not a big deal. Either hop on IRC and ask in <code>#institute</code> or send an email
to <code>admins@tilde.institute</code></p>
<p class="q">How do I authenticate with SMTP remotely?</p>
<p>Only local access to SMTP is allowed. However, you can use an SSH tunnel on your machine to send mail.
</p>
<div class="code">ssh -nNTL 25:localhost:25 tilde.institute</div>
<p>You won't need to supply a username or password when sending mail via <code>localhost:25</code> this way,
since you're already authenticated via SSH.</p>
<p class="q">Can you whitelist a port for me in the firewall?</p>
<p>Sorry, but this presents too much of a security risk on a public-access system.</p>
<p class="q">Are user services allowed?</p>
<p>Generally, yes. If you're running something that's using a ton of resources or in some way affecting
other users or the general use of the system,
then we'll kill it. Just be aware of what you're running and how it may affect the system and other
users.</p>
<p class="q">Are IRC bots allowed?</p>
<p>Yes, though there are restrictions on their use on the <code>tilde.chat</code> IRC network. They should
not reside in <code>#meta</code>, instead keep
them in a private channel or in <code>#bots</code>. Bots must also conform to the <a
href="https://tildegit.org/tildeverse/rfcs/src/branch/master/rfcs/rfc2.md">bot guidelines listed
here</a>.</p>
<p>Don't run <code>eggdrop</code> from tilde.institute. There are legitimate uses for <code>eggdrop</code>,
but separating the people with some kind
of legitimate use from malicious users is tiring. So, no <code>eggdrop</code>.</p>
<br />
<br />
</div>
</div>
</body>
</html>

11
index.php → html/index.html Executable file → Normal file
View File

@ -4,18 +4,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tilde.institute :: Public-access OpenBSD system</title>
<link rel="stylesheet" href="tilde.css" type="text/css" />
<link rel="icon" type="image/png" href="icon.png" />
<link rel="me" href="https://github.com/gbmor" />
<?php include("_webmention.html") ?>
{{HEADER}}
</head>
<body>
<div id="container">
<?php include("_header.html"); ?>
{{LOGONAV}}
<div id="front-content">
<p>Welcome to tilde.institute, a public-access UNIX system running OpenBSD. This is a space for people to
explore the OpenBSD operating system, in addition to exploring the more social
@ -122,7 +117,7 @@
<br />
</div>
<div id="news">
<?php include("_newsdata.html"); ?>
{{NEWS}}
</div>
<div id="sshfp">
<pre>

35
html/signup.html Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>tilde.institute :: Sign Up</title>
{{HEADER}}
</head>
<body>
<div id="container">
{{LOGONAV}}
<div id="content" class="signup">
<h1>Request an Account</h1>
<p>
If you haven't received the welcome email within 24 hours, please check your spam folder.
</p>
<p>
<form action="submit.php">
<h3>Desired Username:<br /></h3>
<input type="text" size="48" name="username" />
<h3>Your Email Address:<br /></h3>
<input type="email" size="48" name="email" />
<h3>What interests you about
tilde.institute?<br /></h3>
<input type="text" size="48" name="interest" />
<h3>Paste Your SSH Key in OpenSSH Format:<br /></h3>
<input type="text" size="48" name="sshkey" /><br />
<input type="submit" value="Submit" />
</form>
</p>
</div>
</div>
</body>
</html>

View File

@ -3,16 +3,12 @@
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tilde.institute :: Stats</title>
<link rel="stylesheet" href="tilde.css" type="text/css"/>
<link rel="icon" type="image/png" href="icon.png"/>
<?php include("_webmention.html") ?>
{{HEADER}}
</head>
<body>
<div id="container">
<?php include("_header.html"); ?>
{{LOGONAV}}
<div id="content">
<br />
<!--<p><code><?php include("table.weekconns"); ?></code> unique users logged in this week (resets Saturdays <code>00:00 UTC</code>)</p>-->

View File

@ -3,15 +3,12 @@
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tilde.institute :: Sign Up</title>
<link rel="stylesheet" href="tilde.css" type="text/css"/>
<link rel="icon" type="image/png" href="icon.png"/>
<title>tilde.institute :: Sign Up</title>
{{HEADER}}
</head>
<body>
<div id="container">
<?php include("_header.html"); ?>
{{LOGONAV}}
<div id="content" style="text-align: center;">
<?php
require_once('bannedusers.php');

7
inc/_header.html Normal file
View File

@ -0,0 +1,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="tilde.css" type="text/css" />
<link rel="icon" type="image/png" href="icon.png" />
<link rel="me" href="https://github.com/gbmor" />
<link rel="webmention" href="https://webmention.io/tilde.institute/webmention" />
<link rel="pingback" href="https://webmention.io/tilde.institute/xmlrpc" />

View File

@ -1,41 +0,0 @@
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tilde.institute :: Sign Up</title>
<link rel="stylesheet" href="tilde.css" type="text/css" />
<link rel="icon" type="image/png" href="icon.png" />
<?php include("_webmention.html") ?>
</head>
<body>
<div id="container">
<?php include("_header.html"); ?>
<div id="content" class="signup">
<h1>Request an Account</h1>
<p>
If you haven't received the welcome email within 24 hours, please check your spam folder.
</p>
<p>
<form action="submit.php">
<h3>Desired Username:<br /></h3>
<input type="text" size="48" name="username" />
<h3>Your Email Address:<br /></h3>
<input type="email" size="48" name="email" />
<h3>What interests you about
tilde.institute?<br /></h3>
<input type="text" size="48" name="interest" />
<h3>Paste Your SSH Key in OpenSSH Format:<br /></h3>
<input type="text" size="48" name="sshkey" /><br />
<input type="submit" value="Submit" />
</form>
</p>
</div>
</div>
</body>
</html>

View File

@ -1 +0,0 @@
{"name":"tilde.institute","url":"https://tilde.institute","signup_url":"https://tilde.institute/signup","user_count":276,"want_users":true,"admin_email":"admins@tilde.institute","description":"A public-access machine where users can explore the OpenBSD operating system.","last_generated":"Tue, 30 Jun 2020 03:00:02 +0000"}