{"id":19725461,"url":"https://github.com/easychen/h2reader-host","last_synced_at":"2025-04-09T07:08:15.670Z","repository":{"id":36318416,"uuid":"208224287","full_name":"easychen/h2reader-host","owner":"easychen","description":"方糖小剧场Web阅读器和上传网站","archived":false,"fork":false,"pushed_at":"2025-03-13T06:56:27.000Z","size":4182,"stargazers_count":74,"open_issues_count":6,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T04:09:31.368Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://read6.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/easychen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-13T08:24:00.000Z","updated_at":"2025-03-13T06:56:30.000Z","dependencies_parsed_at":"2024-11-11T23:31:11.149Z","dependency_job_id":"694eb376-9ac3-453c-9944-7cd95c5e7648","html_url":"https://github.com/easychen/h2reader-host","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Fh2reader-host","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Fh2reader-host/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Fh2reader-host/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Fh2reader-host/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easychen","download_url":"https://codeload.github.com/easychen/h2reader-host/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994121,"owners_count":21030050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T23:30:00.184Z","updated_at":"2025-04-09T07:08:15.650Z","avatar_url":"https://github.com/easychen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 方糖小剧场·阅读器\n\n⚠️ 已经更新为V2，内置了头像和小说元信息，不再兼容之前的格式，[V1版本见这里](https://github.com/easychen/h2webreader/tree/v1)\n\n---\n## 什么是🎈小剧场\n\n小剧场(H2 Book)是我们定义的一种对话体、类剧本式的开放图书格式。它采用对话和场景来展现故事、描述事实，又非常接近于我们平时使用的聊天软件，所以读起来更为轻松。\n\n📷 截图\n\n![](doc/screenshot.png)\n\n\u003c!-- 一键部署到 Vercel \n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Feasychen%2Fh2reader-host\u0026env=UPLOAD_KEY\u0026envDescription=%E7%94%A8%E4%BA%8E%E4%B8%8A%E4%BC%A0%E5%92%8C%E5%8F%91%E5%B8%83h2book%E7%9A%84Key%EF%BC%8C%E4%B8%8D%E5%86%99%E4%BB%BB%E4%BD%95%E4%BA%BA%E5%8F%AF%E4%BB%A5%E4%B8%8A%E4%BC%A0\u0026buildCommand=cd%20server%20%26%26%20node%20build.js\u0026outputDirectory=server%2Fdist\u0026installCommand=cd%20web%20%26%26%20yarn%20install%20%26%26%20cd%20..%2Fserver%20%26%26%20yarn%20install) --\u003e\n\n\n\n## 🖋 如何编写和阅读小剧场\n\n1. 使用小剧场编辑器编写，比如[方糖小剧场的编辑器](https://qing.ftqq.com)\n2. 可以随时保存文件为 `.h2doc` 供以后编辑修改\n3. 一章写完以后，可导出章节为 `.h2book` 文件，用于分发 \n4. 读者拿到 `.h2book` ，通过阅读器阅读。\n\n本项目，即是 Web版本的阅读器网站，你可以把 `.h2book` 上传上来，获得一个阅读二维码，用手机扫码即可阅读。\n\n[Demo网站](https://du.slidechan.com)\n\n---\n\n以下为进阶内容，供程序员参考。\n\n## 小剧场文件格式\n\n小剧场文件有两种格式，分别是：\n\n- 用于作者的多章节格式 `.h2doc`\n- 用于读者的单章节格式 `.h2book`\n\n两者均为 json 纯文本。\n\n### .h2doc\n\n包含以下属性\n\n- bookinfo 小说元信息\n- chpaters 章节信息\n- roles 角色信息\n- talks 剧本\n\n### .h2book \n\n包含以下属性\n\n- meta 章节元信息\n- roles 角色信息\n- talks 剧本\n\n\n## 阅读器的架设\n\n你可以自行架设阅读器，并修改其代码进行开发和定制。\n\n### 👨🏻‍💻 开发\n\n```\ngit clone https://github.com/easychen/h2reader-host\ncd h2reader-host\nyarn install\nyarn start\n```\n\n### 部署\n\n```\nyarn build\n```\n\n然后将 build 目录下的内容放到服务器目录。目录需要支持 rewrite。\n\n注意本项目只附带了 apache 的 rewrite 文件，其他服务器需自己添加。\n\nNginx 参考：\n\nhttps://stackoverflow.com/questions/36304302/how-can-i-configure-react-router-to-with-nginx-cherrypy-and-my-current-reactjs-a\n```\nlocation / {\n    root /var/www;\n    index index.html;\n\n    try_files $uri $uri/ /index.html;\n}\n```\n\n### ☁️ 上传图书\n\n分为静态上传和动态上传两种方式。\n\n#### 静态上传\n\n将 `.h2book` 文件放到服务器 web 目录下的 `books` 之下，即可通过 url （ http://domain/bookname ） 进行访问。\n\n你可以修改 `books/index.json` 中 `books` 数组来调整默认列表。\n\n\n#### 动态上传\n\n支持通过 PHP 上传 `.h2book` 文件，这样就不用每次手工上传了。 注意默认是任何人都以上传，如果想控制权限，可以自己加一个 http basic 认证在 api.php 前边。\n\n\n- 确保环境支持php7.0+\n- 确保books目录可写\n  \n然后设置 `books/index.json` 文件\n\n```\n{\n    \"books\":\n    [\n        {\"name\":\"方糖小剧场使用说明\",\"bookurl\":\"1\"},\n        {\"name\":\"FreeSource Vol1\",\"bookurl\":\"2\"},\n        {\"name\":\"程序员和说学逗唱\",\"bookurl\":\"3\"}\n    ],\n    \"upload_url\":\"/api.php\", \u003c--- 不想开放上传的时候，写成空就行；也可以写其他网站的url。\n    \"site_url\":\"http://domain\"  \u003c--- 当前阅读器网站的url，用来拼接二维码的地址。最后不要加斜杠。\n}\n```\n访问首页即可在右上方看到上传按钮。\n\n### License\n\nMIT \n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasychen%2Fh2reader-host","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasychen%2Fh2reader-host","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasychen%2Fh2reader-host/lists"}