1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

About -> Help

Former-commit-id: b840e8dcbb029fbad7c7c1146b36b662c4ccef11 [formerly f8ba9e007be4e19a01c875626ad10d7e47760967] [formerly 71337169077e80cebb10d8a62967af31852c8eac [formerly 0291c55181]]
Former-commit-id: 0e7ebcb8fa7a9c31ae53dfbe7e49fe47d26da50c [formerly 9810182e654e15602e34486f94e0b070b9033b13]
Former-commit-id: c663d5d59f79728a9b4731471927fc8f471aa84d
This commit is contained in:
Zack Scholl 2016-03-14 14:44:43 -04:00
parent 4db31614ae
commit a9bc263ba4
6 changed files with 30 additions and 17 deletions

View File

@ -90,7 +90,7 @@ Options:`)
// Default page // Default page
aboutFile, _ := ioutil.ReadFile(path.Join(RuntimeArgs.SourcePath, "templates/aboutpage.md")) aboutFile, _ := ioutil.ReadFile(path.Join(RuntimeArgs.SourcePath, "templates/aboutpage.md"))
p := WikiData{"about", "", []string{}, []string{}, false} p := WikiData{"help", "", []string{}, []string{}, false}
p.save(string(aboutFile)) p.save(string(aboutFile))
// var q WikiData // var q WikiData

View File

@ -94,8 +94,8 @@ func editNote(c *gin.Context) {
wshandler(c.Writer, c.Request) wshandler(c.Writer, c.Request)
} else if title == "robots.txt" { } else if title == "robots.txt" {
c.Data(200, "text/plain", []byte(robotsTxt)) c.Data(200, "text/plain", []byte(robotsTxt))
} else if strings.ToLower(title) == "about" { //}&& strings.Contains(AllowedIPs, c.ClientIP()) != true { } else if strings.ToLower(title) == "help" { //}&& strings.Contains(AllowedIPs, c.ClientIP()) != true {
c.Redirect(302, "/about/view") c.Redirect(302, "/Help/view")
} else { } else {
locked, _ := hasPassword(title) locked, _ := hasPassword(title)
if locked { if locked {
@ -134,11 +134,11 @@ func everythingElse(c *gin.Context) {
version := c.DefaultQuery("version", "-1") version := c.DefaultQuery("version", "-1")
noprompt := c.DefaultQuery("noprompt", "-1") noprompt := c.DefaultQuery("noprompt", "-1")
versionNum, _ := strconv.Atoi(version) versionNum, _ := strconv.Atoi(version)
if strings.ToLower(title) == "about" { if strings.ToLower(title) == "help" {
versionNum = -1 versionNum = -1
} }
currentText, versions, _, totalTime, encrypted := getCurrentText(title, versionNum) currentText, versions, _, totalTime, encrypted := getCurrentText(title, versionNum)
if (strings.Contains(currentText, "self-destruct\n") || strings.Contains(currentText, "\nself-destruct")) && strings.ToLower(title) != "about" { if (strings.Contains(currentText, "self-destruct\n") || strings.Contains(currentText, "\nself-destruct")) && strings.ToLower(title) != "help" {
currentText = strings.Replace(currentText, "self-destruct\n", `> *This page has been deleted, you cannot return after closing.*`+"\n", 1) currentText = strings.Replace(currentText, "self-destruct\n", `> *This page has been deleted, you cannot return after closing.*`+"\n", 1)
currentText = strings.Replace(currentText, "\nself-destruct", "\n"+`> *This page has been deleted, you cannot return after closing.*`, 1) currentText = strings.Replace(currentText, "\nself-destruct", "\n"+`> *This page has been deleted, you cannot return after closing.*`, 1)
p := WikiData{strings.ToLower(title), "", []string{}, []string{}, false} p := WikiData{strings.ToLower(title), "", []string{}, []string{}, false}
@ -250,8 +250,8 @@ func reorderList(text string) ([]template.HTML, []string) {
} }
func renderList(c *gin.Context, title string) { func renderList(c *gin.Context, title string) {
if strings.ToLower(title) == "about" { //}&& strings.Contains(AllowedIPs, c.ClientIP()) != true { if strings.ToLower(title) == "help" { //}&& strings.Contains(AllowedIPs, c.ClientIP()) != true {
c.Redirect(302, "/about/view") c.Redirect(302, "/Help/view")
} }
var p WikiData var p WikiData
err := p.load(strings.ToLower(title)) err := p.load(strings.ToLower(title))
@ -328,7 +328,7 @@ func deletePage(c *gin.Context) {
fmt.Println(adminKey) fmt.Println(adminKey)
fmt.Println(deleteName) fmt.Println(deleteName)
// if adminKey == RuntimeArgs.AdminKey || true == true { // if adminKey == RuntimeArgs.AdminKey || true == true {
if strings.ToLower(deleteName) != "about" { if strings.ToLower(deleteName) != "help" {
p := WikiData{strings.ToLower(deleteName), "", []string{}, []string{}, false} p := WikiData{strings.ToLower(deleteName), "", []string{}, []string{}, false}
p.save("") p.save("")
} }

View File

@ -2,22 +2,35 @@
# AwwKoala # AwwKoala
## A Websocket Wiki and Kind Of A List Application ## A Websocket Wiki and Kind Of A List Application
![Version 0.9](https://img.shields.io/badge/version-0.9-brightgreen.svg) ![Version 0.92](https://img.shields.io/badge/version-0.92-brightgreen.svg)
This is a self-contained wiki webserver that makes sharing easy and _fast_. You can make any page you want, and any page is editable by anyone. Pages load instantly for editing, and have special rendering for whether you want to view as a web page or view as list. **AwwKoala** is also [Open Source](https://github.com/schollz/AwwKoala). This is a self-contained wiki webserver that makes sharing easy and _fast_. You can make any page you want, and any page is editable by anyone. Pages load instantly for editing, and have special rendering for whether you want to view as a web page or view as list. **AwwKoala** is also [Open Source](https://github.com/schollz/AwwKoala).
## Features ## Features
**Simplicity**. The philosophy here is to *just type*. To jot a note, simply load the page at [`/`](/) 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 [`/`](/) 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`](/AnythingYouWant). **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).
**Viewing**. All pages can be rendered into HTML by adding `/view`. For example, the page [`/AnythingYouWant`](/AnythingYouWant) is rendered at [`/AnythingYouWant/view`](/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 `[[AnythingYouWant]]`. Math is supported with [Katex](https://github.com/Khan/KaTeX) using `$\frac{1}{2}$` for inline equations and `$$\frac{1}{2}$$` for regular equations. **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.
**Listifying**. If you are writing a list and you want to tick off things really easily, just add `/list`. For example, after editing [`/grocery`](/grocery), goto [`/grocery/list`](/grocery/list). In this page, whatever you click on will be struck through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it. ![Simply type to edit.](https://raw.githubusercontent.com/schollz/awwkoala/master/static/img/Main1.gif)
**Security**. HTTPS support is provided and everything is sanitized to prevent XSS attacks. Though all URLs are publicly accessible, you are free to obfuscate your website by using an obscure/random address (read: the site is still publicly accessible, just hard to find!). The automatic URL is an alliterative animal description - of which there are over 500,000 possibilities - so the URL is easy to remember and hard to guess. **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 struck through and moved to the end. This is helpful if you write a grocery list and then want to easily delete things from it.
![Lists are easy to make.](https://raw.githubusercontent.com/schollz/awwkoala/master/static/img/Main3.gif)
**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).
![Versioning is easy.](https://raw.githubusercontent.com/schollz/awwkoala/master/static/img/Main2.gif)
**Self-destructing messages**. You can write a message that will delete itself when a user loads it (in any view). Useful for transmitting sensitive information. To use, simply add a line somewhere that says only "`self-destruct`".
![Simply type to edit.](https://raw.githubusercontent.com/schollz/awwkoala/master/static/img/Main4.gif)
**Security**. HTTPS support is provided and everything is sanitized to prevent XSS attacks. Though all URLs are publicly accessible, you are free to obfuscate your website by using an obscure/random address (read: the site is still publicly accessible, just hard to find!). In addition to TLS support, you can PGP-encrypt your messages using a passphrase.
![Simply type to edit.](https://raw.githubusercontent.com/schollz/awwkoala/master/static/img/Main7.gif)
**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. **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.
**Self-destructing messages**. You can write a message that will delete itself when a user loads it (in any view). Useful for transmitting sensitive information. To use, simply add a line somewhere that says only "`self-destruct`".
# Contact # Contact
Any other comments, questions or anything at all, just <a href="https://twitter.com/intent/tweet?screen_name=zack_118" class="twitter-mention-button" data-related="zack_118">tweet me @zack_118</a> Any other comments, questions or anything at all, just <a href="https://twitter.com/intent/tweet?screen_name=zack_118" class="twitter-mention-button" data-related="zack_118">tweet me @zack_118</a>

View File

@ -91,7 +91,7 @@
</li> </li>
<li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li> <li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li>
<li><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li> <li><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li>
<li><a href="/about/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> About</a></li> <li><a href="/Help/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> Help</a></li>
</ul> </ul>
</div> </div>
<!--/.nav-collapse --> <!--/.nav-collapse -->

View File

@ -35,7 +35,7 @@
<li><a href="/{{ .Title }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li> <li><a href="/{{ .Title }}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit</a></li>
<li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li> <li><a href="/{{ .Title }}/view"><span class="glyphicon glyphicon-sunglasses" aria-hidden="true"></span> View</a></li>
<li class="active"><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li> <li class="active"><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li>
<li><a href="/about/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> About</a></li> <li><a href="/Help/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> Help</a></li>
</ul> </ul>
</div> </div>
<!--/.nav-collapse --> <!--/.nav-collapse -->

View File

@ -53,7 +53,7 @@ a.deleteable {
</ul> </ul>
</li> </li>
<li><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li> <li><a href="/{{ .Title }}/list"><span class="glyphicon glyphicon-align-left" aria-hidden="true"></span> List</a></li>
<li><a href="/about/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> About</a></li> <li><a href="/Help/view"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> Help</a></li>
</ul> </ul>
</div> </div>
<!--/.nav-collapse --> <!--/.nav-collapse -->