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:
commit
14a8d7defa
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