{"id":14965852,"url":"https://github.com/daief/gm-response-proxy","last_synced_at":"2026-01-26T20:53:59.406Z","repository":{"id":90066373,"uuid":"316756772","full_name":"daief/gm-response-proxy","owner":"daief","description":"一款代理请求（包括 XMLHttpRequest 和 fetch）响应结果的油猴脚本，即 mock 请求的响应。","archived":false,"fork":false,"pushed_at":"2020-12-17T12:13:13.000Z","size":975,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T20:41:22.390Z","etag":null,"topics":["tampermonkey","typescript","vue3","yarn2"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/daief.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":"2020-11-28T14:54:47.000Z","updated_at":"2023-06-06T15:48:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"ce0fe4d0-ef70-4006-b03c-03bdf5bc8b0e","html_url":"https://github.com/daief/gm-response-proxy","commit_stats":{"total_commits":26,"total_committers":1,"mean_commits":26.0,"dds":0.0,"last_synced_commit":"dd9065f5a97aa069736a2aa5c997b2aff7de040e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/daief/gm-response-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daief%2Fgm-response-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daief%2Fgm-response-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daief%2Fgm-response-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daief%2Fgm-response-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daief","download_url":"https://codeload.github.com/daief/gm-response-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daief%2Fgm-response-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28787605,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["tampermonkey","typescript","vue3","yarn2"],"created_at":"2024-09-24T13:35:28.549Z","updated_at":"2026-01-26T20:53:59.390Z","avatar_url":"https://github.com/daief.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## GM Response Proxy\n\n一款代理请求（包括 XMLHttpRequest 和 fetch）响应结果的油猴脚本，即 mock 请求的响应。\n\nyarn@berry、Vue3、油猴脚本的尝试，简陋的功能和 UI。\n\n插件启用后，页面左上角会出现一个小按钮，点击即可唤起操作面板。\n\n`域名匹配规则` 和 `Api 匹配规则` 默认以字符串子串的形式去匹配，若头、尾均是 `/` 则以正则的形式去匹配，如 `/(bilibili)|(baidu)\\.com/` 会被实例化为正则表达式再去进行匹配。\n\n日志会直接在控制台输出。\n\nGreasyfork URL：\u003chttps://greasyfork.org/zh-CN/scripts/418749-response-proxy\u003e\n\n## TODO\n\n- [x] 支持 XHR\n- [x] 支持 fetch\n- [ ] 界面（Vue 模块）异步加载，预计能极大减少脚本初始化大小，提升体验\n- [ ] 界面优化\n- [x] iframe 的情况。\n  - 所有 iframe 都会注入脚本\n  - 只在顶层 iframe 展示操作按钮，列出 iframe 匹配的规则\n- [ ] 规则开关\n- [ ] 国际化（大概）\n\n## Note\n\n### Document\n\n- [tampermonkey documentation](https://www.tampermonkey.net/documentation.php)\n\n### 调试、自动刷新\n\n起个本地服务托管 `dist`，如 `live-server --port=777`，之后在油猴脚本中写入以下代码，当源码更新后可自动刷新：\n\n```js\n// ==UserScript==\n// ... 其他必要的配置\n// @grant                   unsafeWindow\n// @grant                   GM_setValue\n// @grant                   GM_getValue\n// @grant                   GM_log\n// @grant                   GM_xmlhttpRequest\n// @connect                 127.0.0.1\n// @match                   *://localhost*/*\n// ==/UserScript==\n\nconst loop = () =\u003e {\n  GM_xmlhttpRequest({\n    url: 'http://127.0.0.1:7777/index.js',\n    onload: e =\u003e {\n      const res = e.responseText;\n      if (e.status === 200 \u0026\u0026 code !== res) {\n        GM_setValue('code', res);\n        location.reload();\n      }\n    },\n  });\n};\n\nsetInterval(loop, 3000);\n\nconst code = GM_getValue('code');\nif (code) {\n  eval(code);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaief%2Fgm-response-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaief%2Fgm-response-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaief%2Fgm-response-proxy/lists"}