{"id":26355092,"url":"https://github.com/inkss/hexo-deployer-tencent","last_synced_at":"2025-03-16T12:42:07.630Z","repository":{"id":281395436,"uuid":"945109011","full_name":"inkss/hexo-deployer-tencent","owner":"inkss","description":"A Hexo deployer plugin for uploading files to Tencent COS and refreshing CDN. | 一个用于将文件上传到腾讯COS和刷新CDN的Hexo部署器插件。","archived":false,"fork":false,"pushed_at":"2025-03-08T19:35:05.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-08T20:20:21.718Z","etag":null,"topics":["cdn","deployer","hexo","tencent-cos"],"latest_commit_sha":null,"homepage":"","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/inkss.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":"2025-03-08T17:20:08.000Z","updated_at":"2025-03-08T19:35:08.000Z","dependencies_parsed_at":"2025-03-08T20:31:23.302Z","dependency_job_id":null,"html_url":"https://github.com/inkss/hexo-deployer-tencent","commit_stats":null,"previous_names":["inkss/hexo-deployer-tencent"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkss%2Fhexo-deployer-tencent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkss%2Fhexo-deployer-tencent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkss%2Fhexo-deployer-tencent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inkss%2Fhexo-deployer-tencent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inkss","download_url":"https://codeload.github.com/inkss/hexo-deployer-tencent/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243871524,"owners_count":20361375,"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":["cdn","deployer","hexo","tencent-cos"],"created_at":"2025-03-16T12:42:06.864Z","updated_at":"2025-03-16T12:42:07.621Z","avatar_url":"https://github.com/inkss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hexo-deployer-tencent\n\n一个 Hexo 部署插件，用于将静态文件上传到腾讯云对象存储（COS）并刷新 CDN 缓存。\n\n## 功能概述\n\n该插件提供以下功能：\n\n- 将指定路径的静态文件上传至腾讯云对象存储，通过 MD5 校验仅上传变更内容。\n- 支持根据配置自动清理对象存储（COS）中的冗余文件，默认关闭此功能。\n- 依据配置，使用指定域名刷新变更文件的 CDN 缓存，支持配置多个域名。\n- 可根据配置文件，在刷新 CDN 缓存时过滤指定目录下的文件，灵活控制刷新范围。\n- 支持根据配置，在刷新 CDN 时将永久链接尾部的 `index.html` 转换为根路径形式。\n\n## 安装使用\n\n1. 在 Hexo 项目根目录下运行以下命令安装插件：\n\n    ```bash\n    npm install hexo-deployer-tencent\n    ```\n\n2. 运行以下命令生成并部署静态文件：\n\n    ```bash\n    hexo generate \u0026\u0026 hexo deploy\n    ```\n\n## 配置示例\n\n在 Hexo 的 `_config.yml` 中添加以下配置：\n\n```yaml\ndeploy:\n  type: tencent-cos\n  secret_id: your_secret_id\n  secret_key: your_secret_key\n  bucket: your_bucket\n  region: your_region\n  upload_dir: public  # 默认上传 Hexo 的 public 目录\n  cdn_domains:\n      - domain: https://static.example.com\n        ignore_extensions: ['.html']\n      - domain: https://example.com\n        ignore_paths: ['/js', '/css', '/img']\n  remove_remote_files: true  # 是否删除 COS 中多余的远程文件\n  refresh_index_page: true  # 是否将 index.html 刷新为根路径\n  concurrency: 10  # 腾讯云 API 并发数\n```\n\n`cdn_domains` 支持配置多个域名，适用于一个存储桶绑定多个自定义域名的场景，可通过 `ignore_paths` 和 `ignore_extensions` 灵活指定 CDN 刷新时需要过滤的目录或文件格式。\n\n## 属性说明\n\n| 属性名              | 类型    | 是否必填 | 默认值 | 描述                                                         |\n| ------------------- | ------- | -------- | ------ | ------------------------------------------------------------ |\n| `secret_id`         | String  | 是       | 无     | 腾讯云 API 的 Secret ID，用于身份验证。                      |\n| `secret_key`        | String  | 是       | 无     | 腾讯云 API 的 Secret Key，用于身份验证。                     |\n| `bucket`            | String  | 是       | 无     | 腾讯云 COS 的存储桶名称，例如 `my-bucket-1250000000`。       |\n| `region`            | String  | 是       | 无     | 存储桶所在区域，例如 `ap-guangzhou`。                        |\n| `upload_dir`        | String  | 是       | 无     | 本地上传目录，相对于 Hexo 根目录，通常为 `public`。          |\n| `cdn_domains`       | Array   | 否       | `[]`   | CDN 加速域名列表，每项可包含 `ignore_paths`，未设置则不刷新 CDN。 |\n| `cdn_domains.domain` | String | 是 | 无 | 加速域名，以 `https://` 或 `http://` 开头。 |\n| `cdn_domains.ignore_paths` | Array | 否 | 无 | 忽略路径，支持多个相对（`upload_dir`）路径。 |\n| `cdn_domains.ignore_extensions` | Array | 否 | 无 | 忽略格式，例：['.html', '.txt']。 |\n| `remove_remote_files` | Boolean | 否    | `false` | 是否删除 COS 中不在本地文件列表中的远程文件。                |\n| `refresh_index_page`  | Boolean | 否    | `false` | 是否将 `index.html` 的 CDN 刷新 URL 转换为根路径（例如 `/`）。 |\n| `concurrency`       | Number  | 否       | `10`   | 文件上传和 CDN 刷新的并发数，受限于腾讯云 API 并发限制。      |\n\n### 注意事项\n\n- **必填项**：`secret_id`、`secret_key`、`bucket`、`region` 和 `upload_dir` 是必须提供的。\n- **可选项**：未设置的可选项将使用默认值，默认行为是上传文件但不删除远程文件或刷新 CDN。\n- **路径处理**：`upload_dir` 是相对于 Hexo 项目根目录的路径，通常应设置为 `public`。\n- **永久链接**：当永久链接中去除尾部的 `index.html` 时，CDN 刷新缓存时应刷新 `/` 而非 `/index.html`。\n\n## 处理模块\n\n![处理模块](https://github.com/inkss/hexo-deployer-tencent/blob/main/img/export.svg)\n\n## 许可证\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finkss%2Fhexo-deployer-tencent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finkss%2Fhexo-deployer-tencent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finkss%2Fhexo-deployer-tencent/lists"}