mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-20 19:18:45 +00:00
fix(git-provider): use internal URLs for Gitea and GitLab repository cloning
- Updated the repository cloning functions to prioritize internal URLs for Gitea and GitLab, enhancing security and access control. - Ensured fallback to external URLs if internal ones are not available.
This commit is contained in:
@@ -170,7 +170,7 @@ export const cloneGiteaRepository = async ({
|
|||||||
|
|
||||||
const repoClone = `${giteaOwner}/${giteaRepository}.git`;
|
const repoClone = `${giteaOwner}/${giteaRepository}.git`;
|
||||||
const cloneUrl = buildGiteaCloneUrl(
|
const cloneUrl = buildGiteaCloneUrl(
|
||||||
giteaProvider.giteaUrl,
|
giteaProvider.giteaInternalUrl || giteaProvider.giteaUrl,
|
||||||
giteaProvider.accessToken!,
|
giteaProvider.accessToken!,
|
||||||
giteaOwner!,
|
giteaOwner!,
|
||||||
giteaRepository!,
|
giteaRepository!,
|
||||||
|
|||||||
@@ -90,12 +90,14 @@ const getGitlabRepoClone = (
|
|||||||
gitlab: GitlabInfo,
|
gitlab: GitlabInfo,
|
||||||
gitlabPathNamespace: string | null,
|
gitlabPathNamespace: string | null,
|
||||||
) => {
|
) => {
|
||||||
const repoClone = `${gitlab?.gitlabUrl.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
|
const url = gitlab?.gitlabInternalUrl || gitlab?.gitlabUrl;
|
||||||
|
const repoClone = `${url?.replace(/^https?:\/\//, "")}/${gitlabPathNamespace}.git`;
|
||||||
return repoClone;
|
return repoClone;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGitlabCloneUrl = (gitlab: GitlabInfo, repoClone: string) => {
|
const getGitlabCloneUrl = (gitlab: GitlabInfo, repoClone: string) => {
|
||||||
const isSecure = gitlab?.gitlabUrl.startsWith("https://");
|
const url = gitlab?.gitlabInternalUrl || gitlab?.gitlabUrl;
|
||||||
|
const isSecure = url?.startsWith("https://");
|
||||||
const cloneUrl = `http${isSecure ? "s" : ""}://oauth2:${gitlab?.accessToken}@${repoClone}`;
|
const cloneUrl = `http${isSecure ? "s" : ""}://oauth2:${gitlab?.accessToken}@${repoClone}`;
|
||||||
return cloneUrl;
|
return cloneUrl;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user