forked from team/site
1
0
Fork 0

cleanup, move faq to wiki

This commit is contained in:
Ben Harris 2018-06-08 23:17:35 -04:00
parent 31fd8a479b
commit b23edf2bf8
15 changed files with 134 additions and 222 deletions

View File

@ -13,3 +13,30 @@ tilde.team homepage
tilde.team is one tiny standard unix computer in the cloud that anyone can use and learn to use in the shared pursuit of cool sites and unix tools.
this repo contains the frontpage and wiki for tilde.team. feel free to send pull requests or [sign up](https://tilde.team/signup/) for an account! thanks for checking it out.
---
## contributing
1. clone this repo
1. install deps (markdown parser)
```bash
composer install
```
1. start a php development server
```bash
php -S localhost:9000
```
1. create a feature branch
```bash
git checkout -b my-cool-feature
```
1. [open a PR](https://git.tilde.team/meta/site/pulls)
thanks!
hit me up on irc if you have any questions. most of this is quite hacky.

13
admin/index.php Normal file
View File

@ -0,0 +1,13 @@
<?php
include __DIR__.'/../header.php';
?>
<h1>tilde.team admin console</h1>
<form action="auth.php">
<input name="username" type="text">
<input name="password" type="password">
</form>
<?php
include __DIR__.'/../footer.php';

View File

@ -1,84 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>faq ~ tilde.team</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="tilde.team unix group">
<meta name="author" content="Ben Harris">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#00cc00">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-310x310.png">
<link rel="icon" type="image/png" sizes="192x192" href="/apple-touch-icon-precomposed.png">
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
<link rel="stylesheet" href="/css/hacker.css">
</head>
<body>
<div class="container">
<h1>
tilde.team faq
<div class="pull-right">
<small><a href="/">back to home</a></small>
</div>
</h1>
<hr>
<div class="list-group">
<a href="/gettingstarted" class="list-group-item">
<h2 class="list-group-item-heading">getting started</h2>
<p class="list-group-item-text">
<p>check out this primer if you aren't familiar with linux and unix!</p>
</p>
</a>
</div>
<div class="list-group">
<a href="https://support.google.com/domains/answer/3251241?hl=en" class="list-group-item">
<h2 class="list-group-item-heading">send mail as</h2>
<p class="list-group-item-text">
check here if you want to send mail as user@tilde.team. see the section for "sending mail from your forwarded email address".
</p>
</a>
</div>
<div class="list-group">
<a href="https://github.com/cfenollosa/bashblog" class="list-group-item">
<h2 class="list-group-item-heading">tildeblogs</h2>
<p class="list-group-item-text">
<p>tildeblogs are built with bashblog</p>
<p>change to your ~/public_html/blog directory.</p>
<p>type <code>bb post</code></p>
<p>write a post</p>
<p>edit the ~/public_html/blog/.config file to change the name and url and other settings for your blog</p>
</p>
</a>
</div>
<div class="list-group">
<div href="" class="list-group-item">
<h2 class="list-group-item-heading">other help</h2>
<p class="list-group-item-text">
<p>let me know if you have any other questions.</p>
<p><a href="mailto:ben@tilde.team">email me</a></p>
<p><a href="https://t.me/bharris">message me</a></p>
</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,3 +0,0 @@
<?php
header("location:https://forum.tilde.team/");
die();

View File

@ -39,7 +39,6 @@
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/faq/">faq</a></li>
<li><a href="/signup/">sign up</a></li>
<li><a href="/wiki/">wiki</a></li>

View File

@ -25,9 +25,6 @@
<a href="/signup/" class="btn btn-primary btn-lg">
<i class="fa fa-user-plus"></i> signup</a>
<a href="/faq/" class="btn btn-warning btn-lg">
<i class="fa fa-info"></i> faq</a>
<br>
<br>
<hr>

View File

@ -1,3 +0,0 @@
<?php
header("Location: /wiki/view.php?page=irc");
die();

View File

@ -1,17 +0,0 @@
{
"name": "tilde.team-site",
"version": "1.0.0",
"description": "tilde.team homepage",
"author": "Ben Harris <ben@tilde.team>",
"repository": {
"type": "git",
"url": "https://git.tilde.team/meta/site"
},
"bugs": {
"url": "https://git.tilde.team/meta/site/issues"
},
"dependencies": {
"@ibm/type": "^0.5.3"
},
"license": "MIT"
}

View File

@ -1,18 +1,8 @@
<?php
require __DIR__.'/../vendor/autoload.php';
$pw = file_get_contents("mg.key");
$transport = (new Swift_SmtpTransport('smtp.mailgun.org', 465, 'ssl'))
->setUsername('postmaster@mg.tilde.team')
->setPassword($pw);
$mailer = new Swift_Mailer($transport);
$additional_head = '<script src="/js/vue.min.js"></script>';
include __DIR__.'/../header.php';
?>
<div class="container" id="app">
<h1>
tilde.team signup
@ -26,74 +16,8 @@ include __DIR__.'/../header.php';
<hr>
<form method="post">
<?php
if ($_SERVER["SERVER_NAME"] != "localhost")
require_once "/home/ben/ultimate-email/support/smtp.php";
$message = "";
if (isset($_REQUEST["username"]) && isset($_REQUEST["email"])) {
// Check the name.
$name = trim($_REQUEST["username"]);
if ($name == "")
$message .= "<li>please fill in your desired username</li>";
if (strlen($name) > 32)
$message .= "<li>username too long (32 character max)</li>";
if (!preg_match('/^[A-Za-z][A-Za-z0-9]{2,31}$/', $name))
$message .= "<li>username contains invalid characters (lowercase only, must start with a letter)</li>";
if (posix_getpwnam($name))
$message .= "<li>sorry, the username $name is unavailable</li>";
// Check the e-mail address.
$email = trim($_REQUEST["email"]);
if ($email == "")
$message .= "<li>please fill in your email address</li>";
else {
$result = SMTP::MakeValidEmailAddress($_REQUEST["email"]);
if (!$result["success"])
$message .= "<li>invalid email address: " . htmlspecialchars($result["error"]) . "</li>";
elseif ($result["email"] != $email)
$message .= "<li>invalid email address. did you mean: " . htmlspecialchars($result["email"]) . "</li>";
}
if ($_REQUEST["sshkey"] == "") {
$message .= "<li>ssh key required: please create one and submit the public key</li>";
}
if ($message == "") {
$forwardmail = $_REQUEST["forward_email"] == "on"
? '<a href="https://domains.google.com/registrar#z=e&d=3471834,tilde.team&chp=z,d">yes</a>' : "no";
$msgbody = "<h1>tilde.team signup</h1>
<hr>
desired username: <strong>{$_REQUEST["username"]}</strong><br>
contact email: <strong><a href=\"mailto:{$_REQUEST["email"]}\">{$_REQUEST["email"]}</a></strong><br>
reason: <strong>{$_REQUEST["interest"]}</strong><br>
forward mail?: <strong>$forwardmail</strong><br>
ssh key: <pre>{$_REQUEST["sshkey"]}</pre>";
$message = (new Swift_Message('tilde.team signup'))
->setFrom(['sys@tilde.team' => 'tilde'])
->setTo(['admin@tilde.team'])
->setReplyTo([$_REQUEST["email"]])
->setBody($msgbody, 'text/html');
$result = $mailer->send($message);
echo '<div class="alert alert-success" role="alert">
email sent! i\'ll get back to you soon with login instructions! <a href="/">back to tilde.team home</a>
</div>';
} else {
?>
<div class="alert alert-warning" role="alert">
<strong>please correct the following errors: </strong>
<?=$message?>
</div>
<?php
}
}
?>
<form method="post" action="signup-handler.php">
<?php include 'signup-handler.php'; ?>
<div class="form-group">
<label>your desired username (numbers and lowercase letters only, no spaces)</label>

74
signup/signup-handler.php Normal file
View File

@ -0,0 +1,74 @@
<?php
require __DIR__.'/../vendor/autoload.php';
$transport = (new Swift_SmtpTransport('smtp.mailgun.org', 465, 'ssl'))
->setUsername('postmaster@mg.tilde.team')
->setPassword(file_get_contents("mg.key"));
$mailer = new Swift_Mailer($transport);
if ($_SERVER["SERVER_NAME"] != "localhost")
require_once "/home/ben/ultimate-email/support/smtp.php";
$message = "";
if (isset($_REQUEST["username"]) && isset($_REQUEST["email"])) {
// Check the name.
$name = trim($_REQUEST["username"]);
if ($name == "")
$message .= "<li>please fill in your desired username</li>";
if (strlen($name) > 32)
$message .= "<li>username too long (32 character max)</li>";
if (!preg_match('/^[A-Za-z][A-Za-z0-9]{2,31}$/', $name))
$message .= "<li>username contains invalid characters (lowercase only, must start with a letter)</li>";
if (posix_getpwnam($name))
$message .= "<li>sorry, the username $name is unavailable</li>";
// Check the e-mail address.
$email = trim($_REQUEST["email"]);
if ($email == "")
$message .= "<li>please fill in your email address</li>";
else {
$result = SMTP::MakeValidEmailAddress($_REQUEST["email"]);
if (!$result["success"])
$message .= "<li>invalid email address: " . htmlspecialchars($result["error"]) . "</li>";
elseif ($result["email"] != $email)
$message .= "<li>invalid email address. did you mean: " . htmlspecialchars($result["email"]) . "</li>";
}
if ($_REQUEST["sshkey"] == "") {
$message .= "<li>ssh key required: please create one and submit the public key</li>";
}
if ($message == "") { // no validation errors
$forwardmail = $_REQUEST["forward_email"] == "on"
? '<a href="https://domains.google.com/registrar#z=e&d=3471834,tilde.team&chp=z,d">yes</a>' : "no";
$msgbody = "<h1>tilde.team signup</h1>
<hr>
desired username: <strong>{$_REQUEST["username"]}</strong><br>
contact email: <strong><a href=\"mailto:{$_REQUEST["email"]}\">{$_REQUEST["email"]}</a></strong><br>
reason: <strong>{$_REQUEST["interest"]}</strong><br>
forward mail?: <strong>$forwardmail</strong><br>
ssh key: <pre>{$_REQUEST["sshkey"]}</pre>";
$message = (new Swift_Message('tilde.team signup'))
->setFrom(['sys@tilde.team' => 'tilde'])
->setTo(['admin@tilde.team'])
->setReplyTo([$_REQUEST["email"]])
->setBody($msgbody, 'text/html');
$result = $mailer->send($message);
echo '<div class="alert alert-success" role="alert">
email sent! i\'ll get back to you soon with login instructions! <a href="/">back to tilde.team home</a>
</div>';
} else {
?>
<div class="alert alert-warning" role="alert">
<strong>please correct the following errors: </strong>
<?=$message?>
</div>
<?php
}
}
?>

View File

@ -1,3 +0,0 @@
<?php
header("Location:https://tilde-team.github.io/virus/");
die();

View File

@ -1,9 +1,6 @@
<?php
require __DIR__.'/../vendor/autoload.php';
$title = isset($_GET["page"])
? "{$_GET["page"]} | tilde.team~wiki"
: "tilde.team~wiki";
$additional_head = '
<style>
a.anchor {
@ -37,7 +34,7 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
foreach (glob("pages/*.md") as $page) {
$yaml = $parser->parse(file_get_contents($page))->getYAML();
if (!$yaml["published"]) continue; ?>
<a href="/wiki/?page=<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br>
<a href="?page=<?=basename($page, ".md")?>"><?=$yaml["title"]?></a><br>
<?php }
@ -47,7 +44,7 @@ if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) {
include __DIR__.'/../header.php';
// show a single page ?>
<a href="/wiki/">&lt; ~wiki</a>
<a href=".">&lt; ~wiki</a>
<hr>
<?=$pg->getContent()?>
<hr>

16
wiki/pages/email.md Normal file
View File

@ -0,0 +1,16 @@
---
author: ~ben
published: true
title: email
category:
- main
---
# email
currently, tilde.team email is handled through our domain registrar, google domains. if you opted in to email forwarding when you signed up, the address you signed up with was added as the recipient of all mail sent to your username@tilde.team.
if you want to send mail as your username@tilde.team, see [this support answer](https://support.google.com/domains/answer/3251241?hl=en) under the section for "sending mail from your forwarded address".
registrar forwarding isn't a great solution. i'd like to look into running a tilde.team mailserver with imap, smtp, and some slick local mutt and alpine setups. let [~ben](https://tilde.team/~ben/) know if you have any ideas or would like to help figure out a better solution here!

View File

@ -1,23 +0,0 @@
---
author: ~ben
published: true
title: faq
category:
- main
---
## faq
### [tildeblogs](https://github.com/cfenollosa/bashblog)
tildeblogs are built with bashblog
change to your ~/public_html/blog directory.
type `bb post`
write a post
edit the ~/public_html/blog/.config file to change the name and url and other settings for your blog
### [send mail as](https://support.google.com/domains/answer/3251241?hl=en)
currently, tildemail is simple forwarding from the domain registrar. if you want to send mail from user@tilde.team, check this guide to use gmail smtp servers and use it as a send-from address.

View File

@ -1,2 +0,0 @@
<?php
header("Location: /wiki/?page={$_GET["page"]}"); die();