Skip to content

Commit

Permalink
feat!: Rename to periwiki
Browse files Browse the repository at this point in the history
  • Loading branch information
Jagger De Leo committed Apr 5, 2022
1 parent 125f867 commit 1cab3f2
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vendor/
iwikii
iwikii.db
periwiki
*.db
tmp/
static/images
config.yaml
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<img width="192" height="65.6667" src="assets/iwikii2x.png">
<img width="240" src="static/logo.svg">


MediaWiki-inspired, [Goldmark](https://github.com/yuin/goldmark) powered wiki written in Go with an SQLite backend.

## Why?
Because I don't like managing PHP installations.

There are a ton of "Hello World" wikis written in Go out there<sup>1</sup>. The longterm goal of iwikii is be a serious, lightweight, (maybe fast) alternative to MediaWiki for smaller, simple wikis.
There are a ton of "Hello World" wikis written in Go out there<sup>1</sup>. The longterm goal is be a serious, lightweight, (maybe fast) alternative to MediaWiki for smaller, simple wikis.

## What's with the name?
It came from Namelix's neat machine learning name generator. I pronounce it /ɪwɪki/ and spell it **iwikii**.
periwiki<sup>2</sup> is a [portmanteau](https://en.wikipedia.org/wiki/Portmanteau) of periwinkle and wiki. I pronounce it /periwɪki/ and spell it **periwiki**.

## It sort of looks like MediaWiki
That is not an accident. It is what a wiki should look like.
Expand All @@ -20,13 +20,15 @@ The [Mozilla Public License](LICENSE). Share what you do with it!
## Build/Run
Requirements: `make`, and `go`. `sass` is optional unless you make any edits to the .scss as a compiled .css file is included.

`git clone github.com/jagger27/iwikii`
`git clone github.com/jagger27/periwiki`

`make` (or just `go build`)

`./iwikii`
`./periwiki`

## Anything else?
See [TODO](TODO.md) for a little insight on what's on the road map.

<sub>1: Mostly because of this wonderful intro to Go web apps, [Writing Web Applications](https://golang.org/doc/articles/wiki/).</sub>

<sub>2: This project used to be called iwikii.</sub>
Binary file added assets/periwiki.afdesign
Binary file not shown.
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"strings"

"github.com/gorilla/securecookie"
"github.com/jagger27/iwikii/model"
"github.com/jagger27/periwiki/model"
"github.com/spf13/viper"
"gopkg.in/yaml.v3"
)

const configFilename = "config.yaml"

func SetupConfig() *model.Config {
viper.SetDefault("dbfile", "iwikii.db")
viper.SetDefault("dbfile", "periwiki.db")
viper.SetDefault("min_password_length", 8)
viper.SetDefault("cookie_expiry", 86400*7) // a week
viper.SetDefault("host", "0.0.0.0:8080")
Expand Down
2 changes: 1 addition & 1 deletion db/sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"log"
"time"

"github.com/jagger27/iwikii/model"
"github.com/jagger27/periwiki/model"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
"github.com/michaeljs1990/sqlitestore"
Expand Down
2 changes: 1 addition & 1 deletion dev.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
make
if [ $? -eq 0 ]; then
./iwikii
./periwiki
else
echo Build failed. Aborting.
fi
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/jagger27/iwikii
module github.com/jagger27/periwiki

go 1.17
go 1.18

require (
github.com/PuerkitoBio/goquery v1.8.0
Expand All @@ -16,8 +16,8 @@ require (
github.com/sergi/go-diff v1.2.0
github.com/spf13/viper v1.10.1
github.com/yuin/goldmark v1.4.11
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064
golang.org/x/net v0.0.0-20220325170049-de3da57026de
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b
golang.org/x/text v0.3.7
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)
Expand All @@ -37,7 +37,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/sys v0.0.0-20220325203850-36772127a21f // indirect
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064 h1:S25/rfnfsMVgORT4/J61MJ7rdyseOZOyvLIrZEZ7s6s=
golang.org/x/crypto v0.0.0-20220321153916-2c7772ba3064/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o=
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -283,6 +285,8 @@ golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc=
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b h1:vI32FkLJNAWtGD4BwkThwEy6XS7ZLLMHkSkYfF8M0W0=
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -340,6 +344,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f h1:TrmogKRsSOxRMJbLYGrB4SBbW+LJcEllYBLME5Zk5pU=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461 h1:kHVeDEnfKn3T238CvrUcz6KeEsFHVaKh4kMTt6Wsysg=
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
type ContextKey string

// UserKey is for context.Context
const UserKey ContextKey = "iwikii.user"
const UserKey ContextKey = "periwiki.user"

type WikiModel struct {
*Config
Expand Down
10 changes: 5 additions & 5 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"strconv"

"github.com/jagger27/iwikii/model"
"github.com/jagger27/iwikii/templater"
"github.com/jagger27/periwiki/model"
"github.com/jagger27/periwiki/templater"
"golang.org/x/text/cases"
"golang.org/x/text/language"

Expand Down Expand Up @@ -140,7 +140,7 @@ func (a *app) loginPostHander(rw http.ResponseWriter, req *http.Request) {
return
}

session, err := a.GetCookie(req, "iwikii-login")
session, err := a.GetCookie(req, "periwiki-login")
if err != nil {
a.errorHandler(http.StatusInternalServerError, rw, req, err)
return
Expand All @@ -160,7 +160,7 @@ func (a *app) loginPostHander(rw http.ResponseWriter, req *http.Request) {
}

func (a *app) logoutPostHander(rw http.ResponseWriter, req *http.Request) {
session, err := a.GetCookie(req, "iwikii-login")
session, err := a.GetCookie(req, "periwiki-login")
if err != nil {
a.errorHandler(http.StatusInternalServerError, rw, req, err)
return
Expand All @@ -181,7 +181,7 @@ func (a *app) homeHandler(rw http.ResponseWriter, req *http.Request) {
data["Article"] = &model.Article{
Revision: &model.Revision{
Title: "Home",
HTML: "Welcome to iwikii! Why don't you check out <a href='/wiki/test'>Test</a>?",
HTML: "Welcome to periwiki! Why don't you check out <a href='/wiki/test'>Test</a>?",
},
}
data["Context"] = req.Context()
Expand Down
4 changes: 2 additions & 2 deletions session_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"net"
"net/http"

"github.com/jagger27/iwikii/model"
"github.com/jagger27/periwiki/model"
)

func (a *app) SessionMiddleware(handler http.Handler) http.Handler {

return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
session, err := a.GetCookie(req, "iwikii-login")
session, err := a.GetCookie(req, "periwiki-login")
check(err)
if session.IsNew {
anon := model.AnonymousUser()
Expand Down
6 changes: 3 additions & 3 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"log"
"regexp"

"github.com/jagger27/iwikii/db"
"github.com/jagger27/iwikii/model"
"github.com/jagger27/iwikii/templater"
"github.com/jagger27/periwiki/db"
"github.com/jagger27/periwiki/model"
"github.com/jagger27/periwiki/templater"
"github.com/microcosm-cc/bluemonday"
)

Expand Down
26 changes: 13 additions & 13 deletions src/main.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
$link-color: #0645ad;
$iwikii-purple: #a7aef9;
$periwiki-purple: #a7aef9;
$underline: #a2a9b1;
$iwikii-grey: #9a9a9a;
$iwikii-light-grey: #f6f6f6;
$periwiki-grey: #9a9a9a;
$periwiki-light-grey: #f6f6f6;

body {
margin: 0;
padding: 0;

background-color: $iwikii-light-grey;
background-color: $periwiki-light-grey;
font-family: "Helvetica", sans-serif;
line-height: 1.1em;
}
Expand Down Expand Up @@ -88,14 +88,14 @@ a:hover {
margin: 0 0 -1px 0;

list-style: none;
border-left: 1px solid $iwikii-purple;
border-left: 1px solid $periwiki-purple;
li {
font-size: 0.8em;
text-align: center;
padding: 0.5em 0.8em 0.3em 0.8em;

border-top: 1px solid $iwikii-purple;
border-right: 1px solid $iwikii-purple;
border-top: 1px solid $periwiki-purple;
border-right: 1px solid $periwiki-purple;

}
li.iw-active {
Expand All @@ -118,15 +118,15 @@ a:hover {
}
.iw-last-edited {
font-size: 0.75em;
color: $iwikii-grey;
color: $periwiki-grey;
display: block;
}
}

article {
padding: 20px 24px 24px 24px;
background-color: #ffffff;
border: 1px solid $iwikii-purple;
border: 1px solid $periwiki-purple;
border-right: none;
line-height: 1.6;

Expand Down Expand Up @@ -179,7 +179,7 @@ article {

pre {
overflow: hidden;
border: 1px solid $iwikii-purple;
border: 1px solid $periwiki-purple;
padding: 0.75em;
background-color: #FBFBFB;
}
Expand Down Expand Up @@ -269,7 +269,7 @@ article {
}
pre.lineNumbers {
a::before {
color: $iwikii-grey;
color: $periwiki-grey;
content: attr(data-line-number) " ";
}
}
Expand Down Expand Up @@ -332,15 +332,15 @@ article.iw-preview {
text-align: center;
margin: 1em 0;

color: $iwikii-grey;
color: $periwiki-grey;

small.iw-powered-by {
font-size: 0.75em;
}
.iw-powered-by {
.iw-heart {

color: $iwikii-purple;
color: $periwiki-purple;
font-size: 1.4em;
margin: 0 0 0 1px;
display: inline-block;
Expand Down
22 changes: 1 addition & 21 deletions static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions templates/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{{.Article.Title}} — iwikii</title>
<title>{{.Article.Title}} — periwiki</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/static/favicon.ico" />
<link rel="stylesheet" type="text/css" media="screen" href="/static/main.css" />
Expand All @@ -13,7 +13,7 @@
{{template "sidebar" .Sidebar }}
<div id="right-panel">
<div id="login-bar">
{{$user := .Context.Value "iwikii.user" }}
{{$user := .Context.Value "periwiki.user" }}
{{ if and $user (ne $user.ScreenName "Anonymous") }}
<a href="/profile/{{ pathEscape $user.ScreenName }}">My Profile</a>
<a href="/user/settings">Settings</a>
Expand All @@ -26,6 +26,6 @@
{{template "content" . }}
</div>
</div>
<div id="footer"><small class="iw-powered-by">Powered by <a href="https://github.com/jagger27/iwikii">iwikii</a></small></div>
<div id="footer"><small class="iw-powered-by">Powered by <a href="https://github.com/jagger27/periwiki">periwiki</a></small></div>
</body>
</html>
2 changes: 1 addition & 1 deletion templates/layouts/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{define "sidebar"}}
<div id="sidebar">
<!-- max-width is to prevent giant flashing iwikii logo on slow connections -->
<!-- max-width is to prevent giant flashing periwiki logo on slow connections -->
<a href="/"><img style="max-width: 12em; width: auto;" src="/static/logo.svg" /></a>
<ul>
<li><a href="/">Home Page</a></li>
Expand Down

0 comments on commit 1cab3f2

Please sign in to comment.