{"id":19267208,"url":"https://github.com/scriptscat/puzzle","last_synced_at":"2025-02-23T19:30:09.269Z","repository":{"id":108096124,"uuid":"446897963","full_name":"scriptscat/puzzle","owner":"scriptscat","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-21T08:31:58.000Z","size":231,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-05T12:12:41.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/scriptscat.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-11T16:28:07.000Z","updated_at":"2024-10-21T08:32:05.000Z","dependencies_parsed_at":"2025-01-05T12:12:38.129Z","dependency_job_id":"10dd344a-a42a-4c42-861b-f78a649108c0","html_url":"https://github.com/scriptscat/puzzle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"imlinhanchao/puzzle_node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptscat%2Fpuzzle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptscat%2Fpuzzle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptscat%2Fpuzzle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptscat%2Fpuzzle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptscat","download_url":"https://codeload.github.com/scriptscat/puzzle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240367764,"owners_count":19790311,"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-09T20:11:05.889Z","updated_at":"2025-02-23T19:30:09.120Z","avatar_url":"https://github.com/scriptscat.png","language":"JavaScript","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 Node\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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptscat%2Fpuzzle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptscat%2Fpuzzle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptscat%2Fpuzzle/lists"}