{"id":22407581,"url":"https://github.com/imlinhanchao/puzzle_node","last_synced_at":"2025-07-31T19:31:48.237Z","repository":{"id":75665771,"uuid":"415192310","full_name":"imlinhanchao/puzzle_node","owner":"imlinhanchao","description":"网页解谜开发模板，可以通过此模板快速开发属于自己的网页解谜游戏。","archived":false,"fork":false,"pushed_at":"2023-11-22T00:00:25.000Z","size":94,"stargazers_count":61,"open_issues_count":1,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-28T07:54:10.441Z","etag":null,"topics":["express","node","puzzle"],"latest_commit_sha":null,"homepage":"https://p.hancel.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imlinhanchao.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-10-09T03:34:16.000Z","updated_at":"2024-01-29T11:08:42.000Z","dependencies_parsed_at":"2023-06-07T07:15:42.128Z","dependency_job_id":null,"html_url":"https://github.com/imlinhanchao/puzzle_node","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlinhanchao%2Fpuzzle_node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlinhanchao%2Fpuzzle_node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlinhanchao%2Fpuzzle_node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imlinhanchao%2Fpuzzle_node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imlinhanchao","download_url":"https://codeload.github.com/imlinhanchao/puzzle_node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228283750,"owners_count":17896267,"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":["express","node","puzzle"],"created_at":"2024-12-05T11:14:48.415Z","updated_at":"2024-12-05T11:14:49.125Z","avatar_url":"https://github.com/imlinhanchao.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://p.hancel.org\"\u003e\n    \u003cimg width=\"200\" src=\"./public/images/logo.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eOnline Puzzle\u003c/h1\u003e\n\n由之前的网页解谜开发模板 PHP 版本([szisa/puzzle](https://github.com/szisa/puzzle))演化而来，支持了更多自定义功能，另外增加用户登录注册和排行榜。依据此模板开发的网页解谜网站有：\n\n1. [摸鱼大闯关](https://p.hancel.org)\n2. [摸鱼小闯关](https://puzzle.iwpz.net/)\n3. [壁虎大闯关](https://p.10010.fan/)\n\n## 📦 配置\n\n1. 在 `stages` 拷贝 `tpl.js` 为一个新的 js 文件。文件名必须完全小写，名称与关卡地址一致。\n2. 填写关卡编号 `stage`，下一关卡路径 `next` ，网页title提示 `title`(选填)，通关密码 `passwd` (选填)等等。\n3. 在 `html()` 中编写谜面。\n4. 更多参数参考 [tpl.js](stages/tpl.js)\n\n## ✨ 参数\n1. `stage` : 目前关卡编号，用于显示在页面告知解谜者。\n2. `next` : 下一页面的地址，这里分为两种：  \n - 通过提交密码通关，这里 URL 必须填写从 `stages` 目录开始的路径，无需写后缀名 ，例如：`lang/ruby`；  \n - 通过 URL 方式通关，则根据需要填写即可，建议一样写上，方便后续查看。\n3. `title` : 当需要在网页的`\u003ctitle\u003e`标签填写提示语时，则设置该项；\n4. `passwd` : 选中第b种解谜方式时，则需要填写该项，并且需配合模板中的密码框提交密码。\n你也可以针对每个关卡编写自己的检查处理，查看 `check` 参数； \n5. `js` :  设置*页面加载完成后*执行的js代码，此部分代码不会直接出现在页面中，而是过`script`标签引用外部文件；  \n6. `css` : 设置关卡的独立css代码，此部分代码不会直接出现在页面中，而是过`link`标签引用外部文件；  \n7. `feedback` : 设置指定密码 feedback，此参数仅可以用于包含密码检查的关卡，必须为一个 `async` 函数，`return` 值为显示的 feedback；  \n8. `head` : 插入到 `head` 标签的代码；\n9. `html` : 页面主体的代码，一般为主要谜面；\n10. `last` : 插入到网页末端的代码，一般为注释。\n11. `beforeRsp` : 在页面渲染前执行的代码，可以对 request 和 response 进行处理。\n\n## 🛡 部署\n服务器需安装 `nodejs` 和 `npm` 。部署执行如下脚本：\n```bash\nnpm install\n```\n\n初始化配置\n```bash\nnpm run init\n```\n\n重新初始化数据库（**会清空数据**）\n```bash\nnpm run initdb\nnpm run initdb -- user # 初始化指定表\n```\n\n启动服务：\n```bash\nnpm start\n```\n\n以守护进程方式，启动服务：\n```bash\nforever start ./bin/www --uid puzzle\n```\nor\n```bash\npm2 start -n puzzle npm -- start\n```\n\n## ⚙️ 调试\n1. 执行`npm install`;\n2. 使用 Visual Studio Code 运行调试（直接按下`F5`即可）。\n\n## 📁 目录\n- .vscode - VSCode 调试配置\n- bin - 服务启动入口  \n- interface - 业务接口实现   \n- stages - 关卡文件\n- pubilc - 静态资源  \n- routes - 网页路由  \n- script - 脚本 \n- views - 页面模板\n- models - 数据库模型\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimlinhanchao%2Fpuzzle_node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimlinhanchao%2Fpuzzle_node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimlinhanchao%2Fpuzzle_node/lists"}