「PttWeb」修訂間的差異
跳至導覽
跳至搜尋
(→設定) |
(→設定) |
||
行 34: | 行 34: | ||
"TemplateDirectory": "/home/bbs/templates" | "TemplateDirectory": "/home/bbs/templates" | ||
} | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | 其中<code>/home/bbs/templates/</code>內需要有這些檔案: | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | askover18.html | ||
+ | bbsarticle.html | ||
+ | bbsindex.html | ||
+ | captcha.html | ||
+ | classlist.html | ||
+ | common.html | ||
+ | error.html | ||
+ | layout.html | ||
+ | manarticle.html | ||
+ | manindex.html | ||
+ | notfound.html | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | 其中<code>layout.html</code>內需要有<code>ROOT</code>: | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | {{define "ROOT"}} | ||
+ | I am ROOT | ||
+ | {{end}} | ||
</syntaxhighlight> | </syntaxhighlight> | ||
於 2020年5月8日 (五) 14:43 的修訂
PttWeb是PttBBS的網頁界面。
概要
PttWeb是一個Golang寫的界面,透過gRPC跟PttBBS的伺服器溝通。
相依性套件
先安裝需要的套件:
sudo apt install -y build-essential golang golang-goprotobuf-dev; sudo apt clean
編譯
這邊是參考.travis-ci.yml
的方式編譯[1]:
export GOPATH="$HOME/go"; go get -u github.com/ptt/pttweb; go get google.golang.org/grpc; go get -u github.com/golang/protobuf/{proto,protoc-gen-go}; make -C $GOPATH/src/github.com/ptt/pttweb/proto; go get -u -t -f github.com/ptt/pttweb/...
編譯完成後會在~/go/bin
裡面看到執行檔。
設定
PttWeb需要一個config.json
,設定可以參考config.go
,最少需要指定這四個參數:
{
"Bind": ["tcp:127.0.0.1:8000"],
"BoarddAddress": "127.0.0.1",
"MemcachedAddress": "127.0.0.1",
"TemplateDirectory": "/home/bbs/templates"
}
其中/home/bbs/templates/
內需要有這些檔案:
askover18.html
bbsarticle.html
bbsindex.html
captcha.html
classlist.html
common.html
error.html
layout.html
manarticle.html
manindex.html
notfound.html
其中layout.html
內需要有ROOT
:
{{define "ROOT"}}
I am ROOT
{{end}}
相關連結
參考資料
- ↑ pttweb/.travis.yml at master · ptt/pttweb. [2020-04-09].