Skip to content

Commit 23aa389

Browse files
authored
Merge branch 'main' into feat/global-user-config
2 parents d907776 + b4d73b7 commit 23aa389

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

docs/how-to/install-custom-modules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Select **Yes**, then provide a source:
6868
| Input Type | Example |
6969
| --------------------- | ------------------------------------------------- |
7070
| HTTPS URL (any host) | `https://github.com/org/repo` |
71+
| HTTP URL (any host) | `http://host/org/repo` |
7172
| HTTPS URL with subdir | `https://github.com/org/repo/tree/main/my-module` |
7273
| SSH URL | `git@github.com:org/repo.git` |
7374
| Local path | `/Users/me/projects/my-module` |

docs/vi-vn/how-to/install-custom-modules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Chọn **Yes**, rồi nhập nguồn:
6868
| Loại đầu vào | Ví dụ |
6969
| --------------------- | ------------------------------------------------- |
7070
| HTTPS URL trên bất kỳ host nào | `https://github.com/org/repo` |
71+
| HTTP URL trên bất kỳ host nào | `http://host/org/repo` |
7172
| HTTPS URL trỏ vào một thư mục con | `https://github.com/org/repo/tree/main/my-module` |
7273
| SSH URL | `git@github.com:org/repo.git` |
7374
| Đường dẫn cục bộ | `/Users/me/projects/my-module` |

docs/zh-cn/how-to/install-custom-modules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Would you like to install from a custom source (Git URL or local path)?
6868
| 输入类型 | 示例 |
6969
| -------- | ---- |
7070
| HTTPS URL(任意主机) | `https://github.com/org/repo` |
71+
| HTTP URL(任意主机) | `http://host/org/repo` |
7172
| 带子目录的 HTTPS URL | `https://github.com/org/repo/tree/main/my-module` |
7273
| SSH URL | `git@github.com:org/repo.git` |
7374
| 本地路径 | `/Users/me/projects/my-module` |

tools/installer/modules/custom-module-manager.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ class CustomModuleManager {
2424

2525
/**
2626
* Parse a user-provided source input into a structured descriptor.
27-
* Accepts local file paths, HTTPS Git URLs, and SSH Git URLs.
28-
* For HTTPS URLs with deep paths (e.g., /tree/main/subdir), extracts the subdir.
27+
* Accepts local file paths, HTTPS Git URLs, HTTP Git URLs, and SSH Git URLs.
28+
* For HTTPS/HTTP URLs with deep paths (e.g., /tree/main/subdir), extracts the subdir.
29+
* The original protocol (http or https) is preserved in the returned cloneUrl.
2930
*
3031
* @param {string} input - URL or local file path
3132
* @returns {Object} Parsed source descriptor:
@@ -127,11 +128,11 @@ class CustomModuleManager {
127128
};
128129
}
129130

130-
// HTTPS URL: https://host/owner/repo[/tree/branch/subdir][.git]
131-
const httpsMatch = trimmed.match(/^https?:\/\/([^/]+)\/([^/]+)\/([^/.]+?)(?:\.git)?(\/.*)?$/);
131+
// HTTPS/HTTP URL: https://host/owner/repo[/tree/branch/subdir][.git]
132+
const httpsMatch = trimmed.match(/^(https?):\/\/([^/]+)\/([^/]+)\/([^/.]+?)(?:\.git)?(\/.*)?$/);
132133
if (httpsMatch) {
133-
const [, host, owner, repo, remainder] = httpsMatch;
134-
const cloneUrl = `https://${host}/${owner}/${repo}`;
134+
const [, protocol, host, owner, repo, remainder] = httpsMatch;
135+
const cloneUrl = `${protocol}://${host}/${owner}/${repo}`;
135136
let subdir = null;
136137
let urlRef = null; // branch/tag extracted from /tree/<ref>/subdir
137138

@@ -311,7 +312,7 @@ class CustomModuleManager {
311312
/**
312313
* Clone a custom module repository to cache.
313314
* Supports any Git host (GitHub, GitLab, Bitbucket, self-hosted, etc.).
314-
* @param {string} sourceInput - Git URL (HTTPS or SSH)
315+
* @param {string} sourceInput - Git URL (HTTPS, HTTP, or SSH)
315316
* @param {Object} [options] - Clone options
316317
* @param {boolean} [options.silent] - Suppress spinner output
317318
* @param {boolean} [options.skipInstall] - Skip npm install (for browsing before user confirms)
@@ -335,7 +336,7 @@ class CustomModuleManager {
335336

336337
const createSpinner = async () => {
337338
if (silent) {
338-
return { start() {}, stop() {}, error() {} };
339+
return { start() { }, stop() { }, error() { } };
339340
}
340341
return await prompts.spinner();
341342
};

0 commit comments

Comments
 (0)