8 Commits

9 changed files with 32 additions and 400 deletions

15
Gopkg.lock generated
View File

@@ -1,15 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/mattn/go-sqlite3"
packages = ["."]
revision = "6c771bb9887719704b210e87e934f08be014bdb1"
version = "v1.6.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "a1f2d643f8c1770c92ee1759184a0c7004af5672869db579328d05bb7cfd6bef"
solver-name = "gps-cdcl"
solver-version = 1

View File

@@ -1,26 +0,0 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
[[constraint]]
name = "github.com/mattn/go-sqlite3"
version = "1.3.0"

View File

@@ -1,82 +0,0 @@
#
# Makefile for YATWiki3
#
VERSION:=3.3.0
SOURCES:=Makefile \
static \
cmd $(wildcard cmd/yatwiki-server/*.go) \
Gopkg.lock Gopkg.toml \
$(wildcard *.go)
GOFLAGS:=-a \
-ldflags "-s -w -X code.ivysaur.me/yatwiki.SERVER_HEADER=YATWiki/$(VERSION)" \
-gcflags '-trimpath=$(GOPATH)' \
-asmflags '-trimpath=$(GOPATH)'
#
# Phony targets
#
.PHONY: all dist clean deps
all: build/linux64/yatwiki-server build/win32/yatwiki-server.exe
dist: \
_dist/yatwiki-$(VERSION)-linux64.tar.gz \
_dist/yatwiki-$(VERSION)-win32.7z \
_dist/yatwiki-$(VERSION)-src.zip
clean:
rm -f ./staticResources.go
rm -fr ./build
rm -f ./yatwiki
deps:
go get -u github.com/jteeuwen/go-bindata/...
go get -u github.com/golang/dep/cmd/dep
dep ensure
#
# Generated files
#
staticResources.go: static/ static/*
go-bindata -o staticResources.go -prefix static -pkg yatwiki static
#
# Release artefacts
#
build/linux64/yatwiki-server: $(SOURCES) staticResources.go
mkdir -p build/linux64
(cd cmd/yatwiki-server ; \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 \
go build $(GOFLAGS) -o ../../build/linux64/yatwiki-server \
)
build/win32/yatwiki-server.exe: $(SOURCES) staticResources.go
mkdir -p build/win32
(cd cmd/yatwiki-server ; \
PATH=/usr/lib/mxe/usr/bin:$(PATH) CC=i686-w64-mingw32.static-gcc \
CGO_ENABLED=1 GOOS=windows GOARCH=386 \
go build $(GOFLAGS) -o ../../build/win32/yatwiki-server.exe \
)
_dist/yatwiki-$(VERSION)-linux64.tar.gz: build/linux64/yatwiki-server
mkdir -p _dist
tar caf _dist/yatwiki-$(VERSION)-linux64.tar.gz -C build/linux64 yatwiki-server --owner=0 --group=0
_dist/yatwiki-$(VERSION)-win32.7z: build/win32/yatwiki-server.exe
mkdir -p _dist
( cd build/win32 ; \
if [ -f dist.7z ] ; then rm dist.7z ; fi ; \
7z a dist.7z yatwiki-server.exe ; \
mv dist.7z ../../_dist/yatwiki-$(VERSION)-win32.7z \
)
_dist/yatwiki-$(VERSION)-src.zip: $(SOURCES)
git archive --format=zip HEAD > _dist/yatwiki-$(VERSION)-src.zip

View File

@@ -1,10 +1,8 @@
# YATWiki
A semi-anonymous wiki for use in trusted environments.
For the 20150901 release, a desktop version is available for Windows (based on PHPDesktop).
As of the 3.0 release, YATWiki is now a standalone server instead of a PHP script.
=FEATURES=
## Features
- Standalone server, easy to run
- Built-in SQLite database
@@ -13,28 +11,32 @@ As of the 3.0 release, YATWiki is now a standalone server instead of a PHP scrip
- RSS changelog
- IP-based ban system
- Article index, random article, download database backup
- Source code highlighting (thanks [url=https://github.com/isagalaev/highlight.js]highlight.js[/url])
- Optional integration with `contented` for file/image uploads
- Source code highlighting (thanks [highlight.js](https://github.com/isagalaev/highlight.js) )
- Optional integration with [`contented`](https://code.ivysaur.me/contented/) for file/image uploads
Written in Golang, PHP
For the 20150901 release, a desktop version is available for Windows (based on PHPDesktop).
=USAGE=
Prior to the 3.0 release, YATWiki was a PHP script instead of a standalone server.
## Usage
You can start YATWiki by running the binary. A default configuration file and database will be automatically generated if they are not found.
`Usage of ./yatwiki-server:
```
Usage of ./yatwiki-server:
-config string
Configuration file (default "config.json")
-listen string
Bind address (default "127.0.0.1:80")
`
```
=GO GET=
## Changelog
This package can be installed via go get: `go get code.ivysaur.me/yatwiki`
[go-get]code.ivysaur.me/yatwiki git https://git.ivysaur.me/code.ivysaur.me/yatwiki.git[/go-get]
2025-08-20 3.3.1
- Update dependencies, replace go-bindata with `go:embed`
=CHANGELOG=
2018-12-31 (no release)
- Convert to Go Modules
2018-04-02 3.3.0
- Feature: Allow deleting (and un-deleting) articles
@@ -76,7 +78,7 @@ This package can be installed via go get: `go get code.ivysaur.me/yatwiki`
- Fix an issue with `[html]` tags
- Fix an issue with viewing history for unknown articles
2017-07-11 3.0
2017-07-11 3.0.0
- YATWiki was rewritten in Go.
- Enhancement: Standalone binary server
- Enhancement: No longer requires cookies for error messages

View File

@@ -2,6 +2,7 @@ package yatwiki
import (
"database/sql"
"embed"
"errors"
"fmt"
"html/template"
@@ -16,6 +17,9 @@ import (
var SERVER_HEADER string = "YATWiki/0.0.0-devel"
//go:embed static/*
var staticResources embed.FS
type WikiServer struct {
db *WikiDB
opts *ServerOptions
@@ -106,13 +110,13 @@ func (this *WikiServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
if remainingPath == "wiki.css" {
w.Header().Set("Content-Type", "text/css")
content, _ := wikiCssBytes()
content, _ := staticResources.ReadFile(`static/wiki.css`)
w.Write(content)
return
} else if remainingPath == "highlight.js" {
w.Header().Set("Content-Type", "application/javascript")
content, _ := highlightJsBytes()
content, _ := staticResources.ReadFile(`static/highlight.js`)
w.Write(content)
return

5
go.mod Normal file
View File

@@ -0,0 +1,5 @@
module code.ivysaur.me/yatwiki
go 1.24.4
require github.com/mattn/go-sqlite3 v1.14.32

2
go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=

View File

@@ -40,7 +40,7 @@ func (this *WikiServer) routeModify(w http.ResponseWriter, r *http.Request, arti
content := `
<h2>` + pageTitleHTML + `</h2><br>
<form method="POST" action="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`save`) + `" class="editor" accept-charset="UTF-8">
<form method="POST" action="` + template.HTMLEscapeString(this.opts.ExpectBaseURL+`save`) + `" class="editor" accept-charset="UTF-8" id="form-edit-page">
<div class="frm">
<label>
Save as:

File diff suppressed because one or more lines are too long