truthhun 1 year ago
parent 289f92f249
commit 8e4933d6c9

1
.gitignore vendored

@ -5,6 +5,7 @@
ginrpc*
dist
output
release
cache
uploads
documents

@ -43,16 +43,16 @@ clean-api-go:
rm -rf api/*/*.go
buildlinux:
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -o output/${VERSION}/linux/moredoc -ldflags ${LDFLAGS}
cp -r dist output/${VERSION}/linux
cp -r dict output/${VERSION}/linux
cp -r app.example.toml output/${VERSION}/linux
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -o release/${VERSION}/linux/moredoc -ldflags ${LDFLAGS}
cp -r dist release/${VERSION}/linux
cp -r dict release/${VERSION}/linux
cp -r app.example.toml release/${VERSION}/linux
buildwin:
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -o output/${VERSION}/windows/moredoc.exe -ldflags ${LDFLAGS}
cp -r dist output/${VERSION}/windows
cp -r dict output/${VERSION}/windows
cp -r app.example.toml output/${VERSION}/windows
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -v -o release/${VERSION}/windows/moredoc.exe -ldflags ${LDFLAGS}
cp -r dist release/${VERSION}/windows
cp -r dict release/${VERSION}/windows
cp -r app.example.toml release/${VERSION}/windows
# show help
help:

@ -1,17 +1,15 @@
# moredoc - 魔豆文库
![魔豆文库](web/static/static/images/logo.png)
moredoc - 魔豆文库,由 深圳市摩枫网络科技(https://mnt.ltd) 基于golang开发的类似百度文库的开源文库系统支持TXT、PDF、EPUB、office等格式文档的在线预览与管理`dochub文库`( [github](https://github.com/truthhun/dochub), [gitee](https://gitee.com/truthhun/DocHub) )的重构版本。
# MOREDOC - 魔豆文库
## 特性
`moredoc` - 魔豆文库,由 深圳市摩枫网络科技(**M**orefun **N**etwork **T**echnology Co., **Ltd**https://mnt.ltd ) 使用 Golang 开发的类似[百度文库](https://wenku.baidu.com/)、[新浪爱问文库](http://ishare.iask.sina.com.cn/)的开源文库系统,支持 `TXT`、`PDF`、`EPUB`、`MOBI`、`Office` 等格式文档的在线预览与管理,为 `dochub文库`( [github](https://github.com/truthhun/dochub), [gitee](https://gitee.com/truthhun/DocHub) )的重构版本。
- 支持多种格式文档的在线预览包括TXT、PDF、EPUB、office等格式文档。
- 前后端分离前端基于vue.js后端基于golang支持多平台部署
- 基于apache2.0开源协议,源码开放,可自由修改、二次开发
## 文库介绍
## 技术栈
- Golang gin + gRPC
- Vue.js : nuxt2 + element-ui
- Golang gin + gRPC + GORM
- Vue.js : nuxt2 + element-ui
- Database : MySQL 5.7
## 开源地址
@ -20,7 +18,84 @@ moredoc - 魔豆文库,由 深圳市摩枫网络科技(https://mnt.ltd) 基于
- Gitee - https://gitee.com/mnt-ltd/moredoc
- MNT.Ltd - https://git.mnt.ltd/mnt/moredoc
## 初始化
## 使用手册
关于魔豆文库安装部署以及使用和二次开发等更详细的教程,详见书栈网[《魔豆文库使用手册》](https://www.bookstack.cn/books/moredoc)
## 二次开发
除了文件上传相关的接口,其他接口统一使用 proto 进行定义。
### 环境要求
- Golang 1.18+
- Node.js 14.16.0 (可用 nvm 管理)
- MySQL 5.7+
**请自行配置相应环境。如在此过程中遇到错误,请根据错误提示自行通过 Google 或者百度解决。**
### 目录结构
> 部分目录,在程序运行时自动生成,不需要手动创建
```bash
.
├── LICENSE # 开源协议
├── Makefile # 编译脚本
├── README.md # 项目说明
├── api # proto api API协议定义
├── app.example.toml # 配置文件示例,需要复制为 app.toml
├── biz # 业务逻辑层主要处理业务逻辑实现api接口
├── cmd # 命令行工具
├── cache # 缓存相关
├── conf # 配置定义
├── dict # 结巴分词字典,用于给文档自动进行分词
├── dist # 前端打包后的文件
├── docs # API文档等
├── documents # 用户上传的文档存储目录
├── go.mod # go依赖管理
├── go.sum # go依赖管理
├── main.go # 项目入口
├── middleware # 中间件
├── model # 数据库模型使用gorm对数据库进行操作
├── release # 版本发布生成的版本会放到这里
├── service # 服务层衔接cmd与biz
├── sitemap # 站点地图
├── third_party # 第三方依赖主要是proto文件
├── uploads # 文档文件之外的其他文件存储目录
├── util # 工具函数
└── web # 前端Web
```
### app.toml
```
# 程序运行级别debug、info、warn、error
level="debug"
# 日志编码方式支持json、console
logEncoding="console"
# 后端监听端口
port="8880"
# 数据库配置
[database]
driver="mysql"
dsn="root:root@tcp(localhost:3306)/moredoc?charset=utf8mb4&loc=Local&parseTime=true"
showSQL=true
maxOpen=10
maxIdle=10
# jwt 配置
[jwt]
secret="moredoc"
expireDays=365
```
### 初始化
**后端初始化**
```
# 安装go依赖
@ -31,15 +106,84 @@ make init
# 编译proto api
make api
# 修改 app.toml 文件配置
cp app.example.toml app.toml
# 编译后端
go build -o moredoc main.go
# 初始化数据库结构
./moredoc syncdb
# 运行后端(可用其他热编译工具)监听8880端口
go run main.go serve
```
## 开发说明
**前端初始化**
- 除了文件上传相关的接口其他接口一律使用proto进行定义。
```bash
# 切换到web目录
cd web
## 管理员初始账号密码
# 安装依赖
npm install
# 运行前端监听3000端口浏览器访问 http://localhost:3000
npm run dev
```
### 管理员初始账号密码
```
admin
mnt.ltd
```
### 发布版本
以下为示例
```
# 打标签
git tag -a v1.0.0 -m "release v1.0.0"
# 推送标签
git push origin v1.0.0
# 编译前端
cd web && npm run generate
# 编译后端编译好了的版本会放到release目录下
# 编译linux版本Windows版本用 make buildwin
make buildlinux
```
## 演示站点
**网址**
- https://moredoc.mnt.ltd
**账号密码**
```
账号admin
密码mnt.ltd
```
```
## 微信交流群
魔豆文库微信交流群,请添加`进击的皇虫`的微信,备注`魔豆文库加群`,以便进群。
**微信二维码**
![魔豆文库微信交流群](docs/wx-qrcode.jpeg)
## License
开源版本基于 [Apache License 2.0](./LICENSE) 协议发布。
## 鸣谢
感谢各开源项目为魔豆文库的开发奠定了基础。相关开源项目,后端依赖,详见 [go.mod](./go.mod);前端依赖,详见 [web/package.json](./web/package.json)。

@ -2,7 +2,7 @@
level="debug"
# 日志编码方式支持json、console
logEncoding="console"
port="8080"
port="8880"
[database]
driver="mysql"
dsn="root:root@tcp(localhost:3306)/moredoc?charset=utf8mb4&loc=Local&parseTime=true"

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

@ -99,6 +99,9 @@
>继续阅读</span
>
</div>
<div class="text-muted" v-else>
<small>- 可预览页数已预览完 -</small>
</div>
</div>
<div>
<div class="share-info">

Loading…
Cancel
Save