mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Merge branch 'master' of github.com:schollz/awwkoala
Former-commit-id: f02d2a4a7cd682f3fd225637cdf5fc8e9d810f6d [formerly 571180a4d9def90ae143dbf2cb83897c5122f147] [formerly efb7f1a296688c75fbf245eefbe49e72c426fc75 [formerly 0bd1c69529
]]
Former-commit-id: 28c160b9e491d4176fa558da650440cc8c5e4a04 [formerly ed1634955b200bb6f8bfc1864992b9fc43e02b67]
Former-commit-id: f6775f04fc29265dc510c691efbac801e2185736
This commit is contained in:
commit
276f2a92d2
10
README.md
10
README.md
@ -1,6 +1,6 @@
|
|||||||
![Logo](https://i.imgur.com/ixnBYOl.png)
|
![Logo](https://i.imgur.com/ixnBYOl.png)
|
||||||
|
|
||||||
# AwwKoala
|
# AwwKoala - [Demo](http://awwkoala.com/)
|
||||||
## A Websocket Wiki and Kind Of A List Application
|
## A Websocket Wiki and Kind Of A List Application
|
||||||
[![Version 1.0](https://img.shields.io/badge/version-1.0-brightgreen.svg)]() [![Go Report Card](https://goreportcard.com/badge/github.com/schollz/AwwKoala)](https://goreportcard.com/report/github.com/schollz/AwwKoala) [![Join the chat at https://gitter.im/schollz/AwwKoala](https://badges.gitter.im/schollz/AwwKoala.svg)](https://gitter.im/schollz/AwwKoala?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Version 1.0](https://img.shields.io/badge/version-1.0-brightgreen.svg)]() [![Go Report Card](https://goreportcard.com/badge/github.com/schollz/AwwKoala)](https://goreportcard.com/report/github.com/schollz/AwwKoala) [![Join the chat at https://gitter.im/schollz/AwwKoala](https://badges.gitter.im/schollz/AwwKoala.svg)](https://gitter.im/schollz/AwwKoala?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
@ -10,15 +10,19 @@ This is a self-contained wiki webserver that makes sharing easy and _fast_. You
|
|||||||
## Simplicity
|
## Simplicity
|
||||||
The philosophy here is to *just type*. To jot a note, simply load the page at [`/`](http://AwwKoala.com/) and just start typing. No need to press edit, the browser will already be focused on the text. No need to press save - it will automatically save when you stop writing. The URL at [`/`](http://AwwKoala.com/) will redirect to an easy-to-remember name that you can use to reload the page at anytime, anywhere. But, you can also use any URL you want, e.g. [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant).
|
The philosophy here is to *just type*. To jot a note, simply load the page at [`/`](http://AwwKoala.com/) and just start typing. No need to press edit, the browser will already be focused on the text. No need to press save - it will automatically save when you stop writing. The URL at [`/`](http://AwwKoala.com/) will redirect to an easy-to-remember name that you can use to reload the page at anytime, anywhere. But, you can also use any URL you want, e.g. [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant).
|
||||||
|
|
||||||
## Views
|
## Viewing
|
||||||
All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](http://AwwKoala.com/AnythingYouWant/view). You can write in HTML or [Markdown](https://daringfireball.net/projects/markdown/) for page rendering. To quickly link to `/view` pages, just use `[[AnythingYouWnat]]`. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations.
|
All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](http://AwwKoala.com/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](http://AwwKoala.com/AnythingYouWant/view). You can write in HTML or [Markdown](https://daringfireball.net/projects/markdown/) for page rendering. To quickly link to `/view` pages, just use `[[AnythingYouWnat]]`. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations.
|
||||||
|
|
||||||
## Lists
|
## Listifying
|
||||||
If you are writing a list and you want to tick off things really easily, just add `/list`. For example, after editing [`/grocery`](http://AwwKoala.com/grocery), goto [`/grocery/list`](http://AwwKoala.com/grocery/list). In this page, whatever you click on will be striked through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it.
|
If you are writing a list and you want to tick off things really easily, just add `/list`. For example, after editing [`/grocery`](http://AwwKoala.com/grocery), goto [`/grocery/list`](http://AwwKoala.com/grocery/list). In this page, whatever you click on will be striked through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it.
|
||||||
|
|
||||||
## Automatic versioning
|
## Automatic versioning
|
||||||
All previous versions of all notes are stored and can be accessed by adding `?version=X` onto `/view` or `/edit`. If you are on the `/view` or `/edit` pages the menu below will show the most substantial changes in the history. Note, only the _current_ version can be edited (no branching allowed, yet).
|
All previous versions of all notes are stored and can be accessed by adding `?version=X` onto `/view` or `/edit`. If you are on the `/view` or `/edit` pages the menu below will show the most substantial changes in the history. Note, only the _current_ version can be edited (no branching allowed, yet).
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Now comes with HTTPS!
|
||||||
|
|
||||||
## Keyboard Shortcuts
|
## Keyboard Shortcuts
|
||||||
|
|
||||||
Quickly transition between Edit/View/List by using `Ctl+Shift+E` to Edit, `Ctl+Shift+Z` to View, and `Ctl+Shift+L` to Listify.
|
Quickly transition between Edit/View/List by using `Ctl+Shift+E` to Edit, `Ctl+Shift+Z` to View, and `Ctl+Shift+L` to Listify.
|
||||||
|
31
letsencrypt/Makefile
Normal file
31
letsencrypt/Makefile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
ADDRESS = yourserver.com
|
||||||
|
PORT = 8003
|
||||||
|
|
||||||
|
CUR_DIR = $(shell bash -c 'pwd')
|
||||||
|
USERCUR = $(shell bash -c 'whoami')
|
||||||
|
|
||||||
|
make:
|
||||||
|
go build
|
||||||
|
|
||||||
|
install:
|
||||||
|
rm -rf jinstall
|
||||||
|
mkdir jinstall
|
||||||
|
cp awwkoala.ssl.nginx awwkoala.ssl.nginx.temp
|
||||||
|
sed -i 's/PORT/$(PORT)/g' awwkoala.ssl.nginx.temp
|
||||||
|
sed -i 's/ADDRESS/$(ADDRESS)/g' awwkoala.ssl.nginx.temp
|
||||||
|
sed -i 's^CUR_DIR^$(CUR_DIR)^g' awwkoala.ssl.nginx.temp
|
||||||
|
cp awwkoala.init awwkoala.init.temp
|
||||||
|
sed -i 's/EXT_ADDRESS/$(ADDRESS)/g' awwkoala.init.temp
|
||||||
|
sed -i 's^CUR_DIR^$(CUR_DIR)^g' awwkoala.init.temp
|
||||||
|
sed -i 's^USERCUR^$(USERCUR)^g' awwkoala.init.temp
|
||||||
|
sed -i 's^PORT^$(PORT)^g' awwkoala.init.temp
|
||||||
|
cp awwkoala.init.temp /etc/init.d/awwkoala.init
|
||||||
|
chmod +x /etc/init.d/awwkoala.init
|
||||||
|
cp awwkoala.ssl.nginx.temp /etc/nginx/sites-available/awwkoala.nginx
|
||||||
|
ln -fs /etc/nginx/sites-available/awwkoala.nginx /etc/nginx/sites-enabled/awwkoala.nginx
|
||||||
|
/etc/init.d/nginx reload
|
||||||
|
/etc/init.d/nginx restart
|
||||||
|
/etc/init.d/awwkoala.init restart
|
||||||
|
rm -rf *.temp
|
||||||
|
|
||||||
|
.PHONY: install
|
17
letsencrypt/README.md
Normal file
17
letsencrypt/README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
First install the NGINX block in this directory. (There is an experimental Makefile that will do this, just try `sudo make install`.
|
||||||
|
|
||||||
|
To use letsencrypt follow these steps:
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/letsencrypt/letsencrypt
|
||||||
|
cd letsencrypt
|
||||||
|
sudo service nginx stop
|
||||||
|
sudo ./letsencrypt-auto certonly --standalone --email youremail@somewhere.com -d yourserver.com
|
||||||
|
sudo service nginx start
|
||||||
|
```
|
||||||
|
|
||||||
|
Then startup `awwkoala` with
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ./awwkoala -p :8001 -key /etc/letsencrypt/live/yourserver.com/privkey.pem -crt /etc/letsencrypt/live/yourserver.com/cert.pem yourserver.com
|
||||||
|
```
|
101
letsencrypt/awwkoala.init
Normal file
101
letsencrypt/awwkoala.init
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: awwkoala
|
||||||
|
# Required-Start: $remote_fs $syslog
|
||||||
|
# Required-Stop: $remote_fs $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Start daemon at boot time
|
||||||
|
# Description: Enable service provided by daemon.
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# This should be placed in /etc/init.d directory
|
||||||
|
# start with
|
||||||
|
# sudo /etc/init.d/awwkoala start
|
||||||
|
# stop with
|
||||||
|
# sudo /etc/init.d/awwkoala start
|
||||||
|
|
||||||
|
dir="CUR_DIR"
|
||||||
|
user="USERCUR"
|
||||||
|
cmd="./awwkoala -p :PORT -key /etc/letsencrypt/live/EXT_ADDRESS/privkey.pem -crt /etc/letsencrypt/live/EXT_ADDRESS/cert.pem yourserver.com./awwkoala EXT_ADDRESS"
|
||||||
|
|
||||||
|
name="awwkoala"
|
||||||
|
pid_file="/var/run/$name.pid"
|
||||||
|
stdout_log="/var/log/$name.log"
|
||||||
|
stderr_log="/var/log/$name.err"
|
||||||
|
|
||||||
|
get_pid() {
|
||||||
|
cat "$pid_file"
|
||||||
|
}
|
||||||
|
|
||||||
|
is_running() {
|
||||||
|
[ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
if is_running; then
|
||||||
|
echo "Already started"
|
||||||
|
else
|
||||||
|
echo "Starting $name"
|
||||||
|
cd "$dir"
|
||||||
|
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
|
||||||
|
echo $! > "$pid_file"
|
||||||
|
if ! is_running; then
|
||||||
|
echo "Unable to start, see $stdout_log and $stderr_log"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
if is_running; then
|
||||||
|
echo -n "Stopping $name.."
|
||||||
|
kill `get_pid`
|
||||||
|
for i in {1..10}
|
||||||
|
do
|
||||||
|
if ! is_running; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "."
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
|
||||||
|
if is_running; then
|
||||||
|
echo "Not stopped; may still be shutting down or shutdown may have failed"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Stopped"
|
||||||
|
if [ -f "$pid_file" ]; then
|
||||||
|
rm "$pid_file"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Not running"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
restart)
|
||||||
|
$0 stop
|
||||||
|
if is_running; then
|
||||||
|
echo "Unable to stop, will not attempt to start"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
$0 start
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
if is_running; then
|
||||||
|
echo "Running"
|
||||||
|
else
|
||||||
|
echo "Stopped"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart|status}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
50
letsencrypt/awwkoala.ssl.nginx
Normal file
50
letsencrypt/awwkoala.ssl.nginx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name ADDRESS;
|
||||||
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
# SERVER BLOCK FOR ADDRESS
|
||||||
|
listen 443 ssl;
|
||||||
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||||
|
ssl_certificate /etc/letsencrypt/live/ADDRESS/cert.pem;
|
||||||
|
ssl_certificate_key /etc/letsencrypt/live/ADDRESS/privkey.pem;
|
||||||
|
|
||||||
|
access_log /etc/nginx/logs/access-ADDRESS.log;
|
||||||
|
error_log /etc/nginx/logs/error-ADDRESS.log info;
|
||||||
|
root CUR_DIR;
|
||||||
|
server_name ADDRESS;
|
||||||
|
|
||||||
|
# Media: images, icons, video, audio, HTC
|
||||||
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
|
||||||
|
expires 1M;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
# CSS and Javascript
|
||||||
|
location ~* \.(?:css|js)$ {
|
||||||
|
expires 1y;
|
||||||
|
access_log off;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
location ^~ /static {
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^/ {
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
|
||||||
|
proxy_pass https://127.0.0.1:PORT;
|
||||||
|
proxy_redirect off;
|
||||||
|
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
# To create sample keys:
|
|
||||||
|
|
||||||
```
|
|
||||||
openssl genrsa -out server.key 2048
|
|
||||||
openssl req -new -x509 -key server.key -days 3650 -nodes -out server.crt -keyout server.crt
|
|
||||||
```
|
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
* check if ed25519 keys work
|
|
Loading…
Reference in New Issue
Block a user