├── chitchat ├── views ├── en │ ├── error.html │ ├── new.thread.html │ ├── index.html │ ├── login.html │ ├── thread.html │ ├── signup.html │ ├── layout.html │ ├── auth.layout.html │ ├── navbar.html │ ├── auth.navbar.html │ └── auth.thread.html └── zh │ ├── error.html │ ├── new.thread.html │ ├── index.html │ ├── login.html │ ├── thread.html │ ├── signup.html │ ├── layout.html │ ├── auth.layout.html │ ├── navbar.html │ ├── auth.navbar.html │ └── auth.thread.html ├── public ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ └── fontawesome-webfont.woff ├── css │ ├── login.css │ └── font-awesome.min.css └── js │ ├── bootstrap.min.js │ └── jquery-2.1.1.min.js ├── locales ├── active.zh.json └── active.en.json ├── logs └── chitchat.log ├── messages.go ├── config.json ├── go.mod ├── routes ├── router.go └── routes.go ├── models ├── post.go ├── db.go ├── session.go ├── thread.go └── user.go ├── README.md ├── main.go ├── handlers ├── index.go ├── post.go ├── thread.go ├── auth.go └── helper.go ├── config ├── viper.go └── config.go └── go.sum /chitchat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nonfu/chitchat/HEAD/chitchat -------------------------------------------------------------------------------- /views/en/error.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | 3 |
{{ . }}
4 | 5 | {{ end }} -------------------------------------------------------------------------------- /views/zh/error.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | 3 |{{ . }}
4 | 5 | {{ end }} -------------------------------------------------------------------------------- /public/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nonfu/chitchat/HEAD/public/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nonfu/chitchat/HEAD/public/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nonfu/chitchat/HEAD/public/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nonfu/chitchat/HEAD/public/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /locales/active.zh.json: -------------------------------------------------------------------------------- 1 | { 2 | "thread_not_found": { 3 | "description": "该群组不存在", 4 | "other": "该群组尚不存在,无法获取" 5 | } 6 | } -------------------------------------------------------------------------------- /locales/active.en.json: -------------------------------------------------------------------------------- 1 | { 2 | "thread_not_found": { 3 | "description": "Thread not exists in db", 4 | "other": "Cannot read thread" 5 | } 6 | } -------------------------------------------------------------------------------- /logs/chitchat.log: -------------------------------------------------------------------------------- 1 | ERROR 2020/04/07 14:55:39 helper.go:71: sql: no rows in result set Cannot find user 2 | ERROR 2020/04/09 00:26:13 helper.go:71: sql: no rows in result set Cannot find user 3 | ERROR 2020/04/09 00:26:19 helper.go:71: sql: no rows in result set Cannot find user 4 | -------------------------------------------------------------------------------- /messages.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "github.com/nicksnyder/go-i18n/v2/i18n" 4 | 5 | var messages = []i18n.Message{ 6 | i18n.Message{ 7 | ID: "thread_not_found", 8 | Description: "Thread not exists in db", 9 | Other: "Cannot read thread", 10 | }, 11 | } 12 | 13 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "App": { 3 | "Address": "0.0.0.0:8080", 4 | "Static": "public", 5 | "Log": "logs", 6 | "Locale": "locales", 7 | "Language": "en" 8 | }, 9 | "Db": { 10 | "Driver": "mysql", 11 | "Address": "localhost:3306", 12 | "Database": "chitchat", 13 | "User": "root", 14 | "Password": "root" 15 | } 16 | } -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/xueyuanjun/chitchat 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/fsnotify/fsnotify v1.4.7 7 | github.com/go-sql-driver/mysql v1.5.0 8 | github.com/gorilla/mux v1.7.4 9 | github.com/nicksnyder/go-i18n/v2 v2.0.3 10 | github.com/spf13/viper v1.6.3 11 | golang.org/x/text v0.3.2 12 | gopkg.in/yaml.v2 v2.2.8 // indirect 13 | ) 14 | -------------------------------------------------------------------------------- /views/zh/new.thread.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | 3 | 12 | 13 | {{ end }} -------------------------------------------------------------------------------- /views/en/new.thread.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 | 3 | 12 | 13 | {{ end }} -------------------------------------------------------------------------------- /routes/router.go: -------------------------------------------------------------------------------- 1 | package routes 2 | 3 | import "github.com/gorilla/mux" 4 | 5 | // 返回一个 mux.Router 类型指针,从而可以当作处理器使用 6 | func NewRouter() *mux.Router { 7 | 8 | // 创建 mux.Router 路由器示例 9 | router := mux.NewRouter().StrictSlash(true) 10 | 11 | // 遍历 web.go 中定义的所有 webRoutes 12 | for _, route := range webRoutes { 13 | // 将每个 web 路由应用到路由器 14 | router.Methods(route.Method). 15 | Path(route.Pattern). 16 | Name(route.Name). 17 | Handler(route.HandlerFunc) 18 | } 19 | 20 | return router 21 | } -------------------------------------------------------------------------------- /views/zh/index.html: -------------------------------------------------------------------------------- 1 | {{ define "content" }} 2 |3 | 创建新群组 或者加入下列群组! 4 |
5 | 6 | {{ range . }} 7 |3 | Start a thread or join one below! 4 |
5 | 6 | {{ range . }} 7 |