1
0
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: 6014574fbfbd028336a0ac53508951c576c271b8 [formerly dd9019096888d15dac6965e2fd2cedb5c777d260] [formerly a122256c60ed63a6847c93d02f8f34f2810e5128 [formerly eb049790c3]]
Former-commit-id: 88c16e949edc5d317f071f4c3f5bb09994e6adc0 [formerly bd45da69fc8b166c7b31f653677edc2b8e78ac40]
Former-commit-id: a84cf0c8ee3c54439050e20b1c38bf64c7c6d5cd
This commit is contained in:
Zack Scholl 2016-02-14 07:19:15 -05:00
commit 14a8d7defa
3 changed files with 21 additions and 6 deletions

View File

@ -21,7 +21,7 @@ All previous versions of all notes are stored and can be accessed by adding `?ve
## Security
Now comes with HTTPS!
HTTPS support is provided. Also uses a HTML sanitizer to prevent XSS attacks.
## Keyboard Shortcuts
@ -32,7 +32,11 @@ Quickly transition between Edit/View/List by using `Ctl+Shift+E` to Edit, `Ctl+S
The Admin can view/delete all the documents by setting the `-a YourAdminKey` when starting the program. Then the admin has access to the `/ls/YourAdminKey` to view and delete any of the pages.
# Install
To get started on your local network just do:
First [install Go](https://golang.org/doc/install).
Then, if you want to host on your local network just do:
```
git clone https://github.com/schollz/awwkoala.git
@ -44,7 +48,7 @@ make
and then goto the address `http://LOCALIPADDRESS:8001/`
## Production server
I recommend using `NGINX` as middleware, as it will do caching of the static files for you. There is an example `NGINX` block in `install/`. To automatically install, on Raspberry Pi / Ubuntu / Debian system use:
I recommend using `NGINX` as middleware, as it will do caching of the static files for you. There is an example `NGINX` block in `install/`. If you want to use SSL instead, follow the instructions in `letsencrypt/README.md`. To automatically install, on Raspberry Pi / Ubuntu / Debian system use:
```
git clone https://github.com/schollz/awwkoala.git

View File

@ -8,7 +8,7 @@ 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 /etc/letsencrypt/live/ADDRESS/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ADDRESS/privkey.pem;
access_log /etc/nginx/logs/access-ADDRESS.log;

View File

@ -9,6 +9,7 @@ import (
"strconv"
"strings"
"time"
"fmt"
"github.com/boltdb/bolt"
"github.com/gin-gonic/gin"
@ -197,8 +198,18 @@ func renderList(c *gin.Context, title string) {
panic(err)
}
listItems, _ := reorderList(p.CurrentText)
fmt.Println(p.CurrentText)
pClean := bluemonday.UGCPolicy()
pClean.AllowElements("img")
pClean.AllowAttrs("alt").OnElements("img")
pClean.AllowAttrs("src").OnElements("img")
pClean.AllowAttrs("class").OnElements("a")
pClean.AllowAttrs("href").OnElements("a")
pClean.AllowAttrs("id").OnElements("a")
pClean.AllowDataURIImages()
text := pClean.SanitizeBytes([]byte(p.CurrentText))
listItems, _ := reorderList(string(text))
fmt.Println(string(text))
c.HTML(http.StatusOK, "list.tmpl", gin.H{
"Title": title,
"WikiName": RuntimeArgs.WikiName,