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
This commit is contained in:
commit
eb049790c3
10
README.md
10
README.md
@ -21,7 +21,7 @@ All previous versions of all notes are stored and can be accessed by adding `?ve
|
|||||||
|
|
||||||
## Security
|
## Security
|
||||||
|
|
||||||
Now comes with HTTPS!
|
HTTPS support is provided. Also uses a HTML sanitizer to prevent XSS attacks.
|
||||||
|
|
||||||
## Keyboard Shortcuts
|
## 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.
|
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
|
# 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
|
git clone https://github.com/schollz/awwkoala.git
|
||||||
@ -44,7 +48,7 @@ make
|
|||||||
and then goto the address `http://LOCALIPADDRESS:8001/`
|
and then goto the address `http://LOCALIPADDRESS:8001/`
|
||||||
|
|
||||||
## Production server
|
## 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
|
git clone https://github.com/schollz/awwkoala.git
|
||||||
|
@ -8,7 +8,7 @@ server {
|
|||||||
# SERVER BLOCK FOR ADDRESS
|
# SERVER BLOCK FOR ADDRESS
|
||||||
listen 443 ssl;
|
listen 443 ssl;
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
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;
|
ssl_certificate_key /etc/letsencrypt/live/ADDRESS/privkey.pem;
|
||||||
|
|
||||||
access_log /etc/nginx/logs/access-ADDRESS.log;
|
access_log /etc/nginx/logs/access-ADDRESS.log;
|
||||||
|
15
routes.go
15
routes.go
@ -9,6 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -197,8 +198,18 @@ func renderList(c *gin.Context, title string) {
|
|||||||
panic(err)
|
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{
|
c.HTML(http.StatusOK, "list.tmpl", gin.H{
|
||||||
"Title": title,
|
"Title": title,
|
||||||
"WikiName": RuntimeArgs.WikiName,
|
"WikiName": RuntimeArgs.WikiName,
|
||||||
|
Loading…
Reference in New Issue
Block a user