mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Added Admin to readme
Former-commit-id: 32c29fa2c9ae356c906a56c42599216a098fd917 [formerly 1094cb4faa2aa742dbef3477531d82e42a35ac27] [formerly 983165937d8bb743af4ae98293728a48bc6017c6 [formerly 8bfcc08381
]]
Former-commit-id: f2b61169a064af5a501ca408a82c67b27424fe17 [formerly 26597ad59097a8e6dc8be59ab4dbd7cb8b1e37c7]
Former-commit-id: 56c18ea099014e16a0b4736e27fbcd6c152e2eb0
This commit is contained in:
parent
f1eef34204
commit
a273cc0f6c
@ -7,8 +7,8 @@
|
||||
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.
|
||||
|
||||
# Features
|
||||
## 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).
|
||||
## 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).
|
||||
|
||||
## Views
|
||||
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.
|
||||
@ -23,7 +23,7 @@ All previous versions of all notes are stored and can be accessed by adding `?ve
|
||||
|
||||
Quickly transition between Edit/View/List by using `Ctl+Shift+E` to Edit, `Ctl+Shift+Z` to View, and `Ctl+Shift+L` to Listify.
|
||||
|
||||
## Admin
|
||||
## Admin controls
|
||||
|
||||
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.
|
||||
|
||||
|
2
main.go
2
main.go
@ -68,6 +68,8 @@ Options:`)
|
||||
p := WikiData{"about", "", []string{}, []string{}}
|
||||
p.save(string(aboutFile))
|
||||
|
||||
fmt.Println(RandStringBytesMaskImprSrc(10))
|
||||
|
||||
// var q WikiData
|
||||
// q.load("about")
|
||||
// fmt.Println(getImportantVersions(q))
|
||||
|
27
utils.go
27
utils.go
@ -150,3 +150,30 @@ func rebuildTextsToDiffN(p WikiData, n int) string {
|
||||
}
|
||||
return "ERROR"
|
||||
}
|
||||
|
||||
var src = rand.NewSource(time.Now().UnixNano())
|
||||
|
||||
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
const (
|
||||
letterIdxBits = 6 // 6 bits to represent a letter index
|
||||
letterIdxMask = 1<<letterIdxBits - 1 // All 1-bits, as many as letterIdxBits
|
||||
letterIdxMax = 63 / letterIdxBits // # of letter indices fitting in 63 bits
|
||||
)
|
||||
|
||||
func RandStringBytesMaskImprSrc(n int) string {
|
||||
b := make([]byte, n)
|
||||
// A src.Int63() generates 63 random bits, enough for letterIdxMax characters!
|
||||
for i, cache, remain := n-1, src.Int63(), letterIdxMax; i >= 0; {
|
||||
if remain == 0 {
|
||||
cache, remain = src.Int63(), letterIdxMax
|
||||
}
|
||||
if idx := int(cache & letterIdxMask); idx < len(letterBytes) {
|
||||
b[i] = letterBytes[idx]
|
||||
i--
|
||||
}
|
||||
cache >>= letterIdxBits
|
||||
remain--
|
||||
}
|
||||
|
||||
return string(b)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user