PttWeb:修订间差异
跳到导航
跳到搜索
此页面具有访问限制。如果您看见此消息,则说明您没有权限访问此页面。
(创建页面,内容为“'''PttWeb'''是PttBBS的網頁界面。 <syntaxhighlight lang="bash"> sudo apt install -y golang golang-goprotobuf-dev; sudo apt clean </syntaxhighlight> ==…”) |
(→設定) |
||
(未显示同一用户的13个中间版本) | |||
第1行: | 第1行: | ||
'''PttWeb'''是[[PttBBS]]的網頁界面。 | '''PttWeb'''是[[PttBBS]]的網頁界面。 | ||
== 概要 == | |||
PttWeb是一個[[Golang]]寫的界面,透過[[gRPC]]跟[[PttBBS]]的伺服器溝通。 | |||
== 相依性套件 == | |||
先安裝需要的套件: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
sudo apt install -y golang golang-goprotobuf-dev; sudo apt clean | sudo apt install -y build-essential golang golang-goprotobuf-dev; sudo apt clean | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 編譯 == | |||
這邊是參考<code>.travis-ci.yml</code>的方式編譯<ref>{{Cite web |url=https://github.com/ptt/pttweb/blob/master/.travis.yml | title=pttweb/.travis.yml at master · ptt/pttweb |accessdate=2020-04-09}}</ref>: | |||
<syntaxhighlight lang="bash"> | |||
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/... | |||
</syntaxhighlight> | |||
編譯完成後會在<code>~/go/bin</code>裡面看到執行檔。 | |||
== 設定 == | |||
PttWeb需要一個<code>config.json</code>,設定可以參考<code>config.go</code>,最少需要指定這四個參數: | |||
<syntaxhighlight lang="json"> | |||
{ | |||
"Bind": ["tcp:127.0.0.1:8000"], | |||
"BoarddAddress": "127.0.0.1", | |||
"MemcachedAddress": "127.0.0.1", | |||
"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 lang="bash"> | |||
~/go/bin/pttweb -conf ~/pttweb/config.json | |||
</syntaxhighlight> | |||
== 相關連結 == | |||
* [[PttBBS]] | |||
== 參考資料 == | |||
{{Reflist|2}} | |||
== 外部連結 == | == 外部連結 == |
2020年5月8日 (五) 14:44的版本
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}}
执行
用以下指令执行:
~/go/bin/pttweb -conf ~/pttweb/config.json
相关连结
参考资料
- ↑ pttweb/.travis.yml at master · ptt/pttweb. [2020-04-09].