1 Star 0 Fork 704

程杰 / DocHub

forked from 进击的皇虫 / DocHub 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
Apache-2.0

LOGO


目录:

重要:所有forkDocHub项目的朋友,麻烦同时点一下watch,以便关注项目更新动态和跟进一些重要的Bug的修复。

提示:DocHub移动端模板已经放出来,链接地址

说明(于2018-06-08):DocHub项目是我学完Go语言之后的第二个独立开发的Go语言项目,项目是在2016年12月份开始开发的。当时对Go语言和Beego框架都还不怎么熟。DocHub项目开源出来之后,看到star飙升的有点快(相对个人之前的开源项目),非常感谢大家的认可和厚爱,然后自己诚惶诚恐地认真review了一遍代码... 路由在模板页面写死了... 数据表一些数据字段也出现了冗余... 有些函数和方法封装,难以使用的一塌糊涂... 请大家给我点时间,我会把整套程序都优化好,当然,现在的版本是可用的,以后的升级版本也会是兼容升级。

说明(2018-06-12): DocHub演示站点:http://dochub.bookstack.cn 后台地址是:http://dochub.bookstack.cn/admin ;管理员账号密码均是admin您心目中的验证码芝麻开门。 安装和部署教程以及Docker镜像,稍后跟上。

文库简介

还在读大学的时候,当时就想着要搭建一个类似百度文库的文库站点,实现文档在线浏览。

然而,时间一晃,好几年过去了,自己终于亲自动手开发实现了一套开源文库程序。

尽管离百度文库还有着巨大的差距,尽管可(一)能(定)会存在Bug,但是,整套程序从前端到后端到数据库再到丑陋的LOGO设计,都是自己独立完成的,满满的成就感...

程序命名

起初开发这套程序,是想自己做一个IT行业的文库站点,也就是现在的IT文库(http://wenku.it),当初给文库起名就叫IT文库,但是决定开源出来之后,觉得这样不妥,于是起了个叫DocHub的名字。

毕竟,有个Git仓库管理的站点叫GitHub,那文档(Doc)仓库也就是文库,我干嘛不叫DocHub呢?

DocHub的中文名叫多哈,程序猿,写代码就要开心,开心就要哈哈哈哈哈哈哈哈,多...(好幼稚)

源码地址

程序源码,托管在GitHubGitee

QQ交流群

为方便相互学习和交流,建了个QQ群,加群请备注来自DocHub

QQ交流群:457803862(猿军团)

同时要说明的是,这个是学习交流群,如果是程序相关问题,请提交issue,再把issue链接发群里。

主要技术栈

后端

Go语言框架Beego

前端

基于Bootstrap的前端框架Flat-UI

数据库

MySQL,数据存储

依赖环境

Libreoffice(或Openoffice)

用于将office文档转PDF

使用命令:

soffice --headless --invisible --convert-to pdf path/to/officefile --outdir path/to/outdir

pdf2svg

注意,这个要用最新版的pdf2svg

pdf2svg,用于将PDF转成svg矢量图片,以供阅读。

使用命令:

pdf2svg <in file.pdf> <out file.svg> [<page no>]

calibre

用于将mobichmepub等文档转成PDF,然后再将pdf转成svg

注意:目前mobiepub等文档的在线阅读功能还没有实现

阿里云OSS

存储office文档、PDF文档以及svg等文件

注意:目前只支持阿里云的OSS云存储,暂时不支持其他云存储(后期我再抽时间开发和扩展其他云存储),不支持本地化存储(现在云存储和CDN价钱比以前便宜多了)

功能特点

文档在线阅读

DocHub文库通过svg矢量图来实现文档阅读体验的,我知道的文库站点中,新浪爱问是通过png等图片提供文档阅读体验的。

SVG相比pngjpeg等图片格式有很大的优势,至少放大不会失真,而且与JPEG 和 GIF 图像比起来,svg尺寸更小,可压缩性更强,DocHub通过gzip,将svg文件压缩,一般情况下,能减少70%的文件大小,比如200kb的svg,gzip压缩后,只有60kb左右的大小。

使用svg,大大提升了加载速度,优化了内容的阅读体验。

office文档在线阅读

这个需要经过两层转化:

office --> pdf --> svg

office文档在线阅读

之前有考虑过office文档不经过转化,然后直接在线浏览的,但是方案比较复杂,部署不容易,至少我没部署成功过...

PDF文档在线阅读

将PDF文档通过pdf2svg转化,提供在线阅读

没有使用mozila的pdf.js作为PDF文档阅读的实现方案,主要是我没有解决pdf.js分片分页加载的问题,每次都需要将整个PDF文档下载下来才能提供阅读。如果文档大的话,用户需要等待好长时间,而且也比较耗费服务器带宽资源。

mobi、epub、chm文档在线阅读

使用calibre将文档转成PDF,然后pdf再转svg。

目前该功能还没实现,epub、mobi等文档,现在还是暂时不能在线阅读

全文搜索

全文搜索功能,之前是使用coreseek开发实现了这个功能的,但是现在coreseek的官网都已经挂了...打算用elasticsearch重新实现这个功能。

文档采集功能【TODO】

建站初期,站点内容的填充,是一个大难点。

然而,GitBookReadTheDoc等站点上,就有一大堆的开源技术文档,提供mobipdfepub离线文档下载。

初略统计了一下,GitBook有10多万文档,按可用文档为5万估算,每份文档,提供3种格式的下载,光从gitbook采集文档,做成文库,就有15万多的文档了。

然后,你再借助下搜索引擎,搜索filetype:文档格式 + 搜索关键字,如filetype:pdf 入门教程,你就会发现惊喜!不信,你试着赋值下面两个链接地址在浏览器打开:

https://cn.bing.com/search?q=filetype%3apdf+%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B&first=11
https://www.sogou.com/web?query=filetype%3Apdf+%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B

如果再爬其他文档,一年之内,单枪匹马搞个上百万文档的文库站点,应该不是个事儿。

不过,现在综合类的文库站点,如百度文库等已经做起来了,如果你打算做综合类的文库站点,还是不现实,因为空间太小了.

但是,你可以做专注于某一个方向的文库站点,比如课后习题答案文库站点、IT行业文库站点、教育类文库站点等,专注于一个行业领域方向,还是有很大成长空间的。就好比图片站点,现在很多搜索引擎都能搜索图片,但是Pinterest花瓣网等还不是做起来了吗?

给你提供了程序,还给你提供了思路,给个star鼓励一下?

积分功能

用户签到、上传分享文档,获得积分奖励;用户下载文档,需要消耗积分

阅读文档水印功能

在提供阅读的svg文件上添加水印

页面一览

没有哪一个时代不是看脸的...

  • 首页

首页

  • 文档阅读页

文档阅读页

  • 用户中心

用户中心

  • 管理后台

管理后台

  • 搜索结果

搜索结果

搜索结果

使用教程

当运行程序的时候,程序会自动初始化数据,默认的初始管理员账号密码均是admin

但是由于环境依赖安装问题,所以有必要整理一个使用教程处理,使用教程放在书栈网(BookStack)上,教程地址:https://www.bookstack.cn/books/dochub

演示站点

目前还没有搭建演示站点,争取在这周内搭建出来。

不过,在这之前,你可以访问IT文库(http://wenku.it)看网站效果,但是由于这个站点,在进行迁移的时候,部分依赖没配置好,所以上传的office、PDF等文档,暂时不支持预览,搜索功能也用不了。

所以,请耐心等待,届时搭建好了演示站点,会把演示站点的管理员账号密码放出来,以便体验使用。

文库模板

DocHub文库的前端模板,包括PC模板和移动端模板,也会放出来。但是,模板可能跟套在程序上的有差距,毕竟在开发的时候有对页面做了一些调整。

PC端模板

移动端模板

关于本人

2014年7月本科"毕业"踏入IT行业;Web全栈工程师;什么都懂一点,什么都不精通。

赞助我

由于整套程序都是独立一个人开发完成,限于个人经验、知识面和技术栈体系的限制,现在的程序不会是完美的,但至少,我在努力,我会争取把开源文库程序做好,缩短与成熟文库系统的差距。

所以,给出你的意见和建议,给出你的打赏与鼓励,让我知道,我不是一个人在孤独地战斗。

赞助的时候,麻烦备注一下你的称呼,以便公开并表示感谢

支付宝打赏赞助

支付宝打赏

微信打赏赞助

微信打赏

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner]

简介

参考百度文库,使用Beego(Golang)开发的开源文库系统 展开 收起
Go
Apache-2.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Go
1
https://gitee.com/chengjies/DocHub.git
git@gitee.com:chengjies/DocHub.git
chengjies
DocHub
DocHub
master

搜索帮助

14c37bed 8189591 565d56ea 8189591