mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +00:00
(fix) Fixed bug with gitlab and gitea not including hostname in the repoName
This commit is contained in:
parent
2286d94eba
commit
98a662c8b5
2 changed files with 12 additions and 8 deletions
|
|
@ -29,7 +29,7 @@ export const compileGithubConfig = async (
|
||||||
const notFound = gitHubReposResult.notFound;
|
const notFound = gitHubReposResult.notFound;
|
||||||
|
|
||||||
const hostUrl = config.url ?? 'https://github.com';
|
const hostUrl = config.url ?? 'https://github.com';
|
||||||
const hostname = config.url ? new URL(config.url).hostname : 'github.com';
|
const hostname = new URL(hostUrl).hostname;
|
||||||
|
|
||||||
const repos = gitHubRepos.map((repo) => {
|
const repos = gitHubRepos.map((repo) => {
|
||||||
const repoName = `${hostname}/${repo.full_name}`;
|
const repoName = `${hostname}/${repo.full_name}`;
|
||||||
|
|
@ -92,18 +92,20 @@ export const compileGitlabConfig = async (
|
||||||
const notFound = gitlabReposResult.notFound;
|
const notFound = gitlabReposResult.notFound;
|
||||||
|
|
||||||
const hostUrl = config.url ?? 'https://gitlab.com';
|
const hostUrl = config.url ?? 'https://gitlab.com';
|
||||||
|
const hostname = new URL(hostUrl).hostname;
|
||||||
|
|
||||||
const repos = gitlabRepos.map((project) => {
|
const repos = gitlabRepos.map((project) => {
|
||||||
const projectUrl = `${hostUrl}/${project.path_with_namespace}`;
|
const projectUrl = `${hostUrl}/${project.path_with_namespace}`;
|
||||||
const cloneUrl = new URL(project.http_url_to_repo);
|
const cloneUrl = new URL(project.http_url_to_repo);
|
||||||
const isFork = project.forked_from_project !== undefined;
|
const isFork = project.forked_from_project !== undefined;
|
||||||
|
const repoName = `${hostname}/${project.path_with_namespace}`;
|
||||||
|
|
||||||
const record: RepoData = {
|
const record: RepoData = {
|
||||||
external_id: project.id.toString(),
|
external_id: project.id.toString(),
|
||||||
external_codeHostType: 'gitlab',
|
external_codeHostType: 'gitlab',
|
||||||
external_codeHostUrl: hostUrl,
|
external_codeHostUrl: hostUrl,
|
||||||
cloneUrl: cloneUrl.toString(),
|
cloneUrl: cloneUrl.toString(),
|
||||||
name: project.path_with_namespace,
|
name: repoName,
|
||||||
imageUrl: project.avatar_url,
|
imageUrl: project.avatar_url,
|
||||||
isFork: isFork,
|
isFork: isFork,
|
||||||
isArchived: !!project.archived,
|
isArchived: !!project.archived,
|
||||||
|
|
@ -121,7 +123,7 @@ export const compileGitlabConfig = async (
|
||||||
gitConfig: {
|
gitConfig: {
|
||||||
'zoekt.web-url-type': 'gitlab',
|
'zoekt.web-url-type': 'gitlab',
|
||||||
'zoekt.web-url': projectUrl,
|
'zoekt.web-url': projectUrl,
|
||||||
'zoekt.name': project.path_with_namespace,
|
'zoekt.name': repoName,
|
||||||
'zoekt.gitlab-stars': (project.stargazers_count ?? 0).toString(),
|
'zoekt.gitlab-stars': (project.stargazers_count ?? 0).toString(),
|
||||||
'zoekt.gitlab-forks': (project.forks_count ?? 0).toString(),
|
'zoekt.gitlab-forks': (project.forks_count ?? 0).toString(),
|
||||||
'zoekt.archived': marshalBool(project.archived),
|
'zoekt.archived': marshalBool(project.archived),
|
||||||
|
|
@ -153,16 +155,18 @@ export const compileGiteaConfig = async (
|
||||||
const notFound = giteaReposResult.notFound;
|
const notFound = giteaReposResult.notFound;
|
||||||
|
|
||||||
const hostUrl = config.url ?? 'https://gitea.com';
|
const hostUrl = config.url ?? 'https://gitea.com';
|
||||||
|
const hostname = new URL(hostUrl).hostname;
|
||||||
|
|
||||||
const repos = giteaRepos.map((repo) => {
|
const repos = giteaRepos.map((repo) => {
|
||||||
const cloneUrl = new URL(repo.clone_url!);
|
const cloneUrl = new URL(repo.clone_url!);
|
||||||
|
const repoName = `${hostname}/${repo.full_name!}`;
|
||||||
|
|
||||||
const record: RepoData = {
|
const record: RepoData = {
|
||||||
external_id: repo.id!.toString(),
|
external_id: repo.id!.toString(),
|
||||||
external_codeHostType: 'gitea',
|
external_codeHostType: 'gitea',
|
||||||
external_codeHostUrl: hostUrl,
|
external_codeHostUrl: hostUrl,
|
||||||
cloneUrl: cloneUrl.toString(),
|
cloneUrl: cloneUrl.toString(),
|
||||||
name: repo.full_name!,
|
name: repoName,
|
||||||
imageUrl: repo.owner?.avatar_url,
|
imageUrl: repo.owner?.avatar_url,
|
||||||
isFork: repo.fork!,
|
isFork: repo.fork!,
|
||||||
isArchived: !!repo.archived,
|
isArchived: !!repo.archived,
|
||||||
|
|
@ -180,7 +184,7 @@ export const compileGiteaConfig = async (
|
||||||
gitConfig: {
|
gitConfig: {
|
||||||
'zoekt.web-url-type': 'gitea',
|
'zoekt.web-url-type': 'gitea',
|
||||||
'zoekt.web-url': repo.html_url!,
|
'zoekt.web-url': repo.html_url!,
|
||||||
'zoekt.name': repo.full_name!,
|
'zoekt.name': repoName,
|
||||||
'zoekt.archived': marshalBool(repo.archived),
|
'zoekt.archived': marshalBool(repo.archived),
|
||||||
'zoekt.fork': marshalBool(repo.fork!),
|
'zoekt.fork': marshalBool(repo.fork!),
|
||||||
'zoekt.public': marshalBool(repo.internal === false && repo.private === false),
|
'zoekt.public': marshalBool(repo.internal === false && repo.private === false),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const chalky = "#e5c07b",
|
||||||
sage = "#98c379",
|
sage = "#98c379",
|
||||||
whiskey = "#d19a66",
|
whiskey = "#d19a66",
|
||||||
violet = "#c678dd",
|
violet = "#c678dd",
|
||||||
highlightBackground = "#2c313a",
|
highlightBackground = "#2c313aaa",
|
||||||
background = "#282c34",
|
background = "#282c34",
|
||||||
selection = "#3E4451",
|
selection = "#3E4451",
|
||||||
cursor = "#528bff";
|
cursor = "#528bff";
|
||||||
|
|
@ -65,14 +65,14 @@ export const useCodeMirrorTheme = () => {
|
||||||
{ tag: t.invalid, color: invalid }
|
{ tag: t.invalid, color: invalid }
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}, []);
|
}, [tailwind.theme.colors.background]);
|
||||||
|
|
||||||
const cmTheme = useMemo(() => {
|
const cmTheme = useMemo(() => {
|
||||||
return theme === 'dark' ? darkTheme : [
|
return theme === 'dark' ? darkTheme : [
|
||||||
defaultLightThemeOption,
|
defaultLightThemeOption,
|
||||||
syntaxHighlighting(defaultHighlightStyle),
|
syntaxHighlighting(defaultHighlightStyle),
|
||||||
]
|
]
|
||||||
}, [theme]);
|
}, [theme, darkTheme]);
|
||||||
|
|
||||||
return cmTheme;
|
return cmTheme;
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue