Skip to content

Commit 98a662c

Browse files
(fix) Fixed bug with gitlab and gitea not including hostname in the repoName
1 parent 2286d94 commit 98a662c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

packages/backend/src/repoCompileUtils.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const compileGithubConfig = async (
2929
const notFound = gitHubReposResult.notFound;
3030

3131
const hostUrl = config.url ?? 'https://github.com';
32-
const hostname = config.url ? new URL(config.url).hostname : 'github.com';
32+
const hostname = new URL(hostUrl).hostname;
3333

3434
const repos = gitHubRepos.map((repo) => {
3535
const repoName = `${hostname}/${repo.full_name}`;
@@ -92,18 +92,20 @@ export const compileGitlabConfig = async (
9292
const notFound = gitlabReposResult.notFound;
9393

9494
const hostUrl = config.url ?? 'https://gitlab.com';
95+
const hostname = new URL(hostUrl).hostname;
9596

9697
const repos = gitlabRepos.map((project) => {
9798
const projectUrl = `${hostUrl}/${project.path_with_namespace}`;
9899
const cloneUrl = new URL(project.http_url_to_repo);
99100
const isFork = project.forked_from_project !== undefined;
101+
const repoName = `${hostname}/${project.path_with_namespace}`;
100102

101103
const record: RepoData = {
102104
external_id: project.id.toString(),
103105
external_codeHostType: 'gitlab',
104106
external_codeHostUrl: hostUrl,
105107
cloneUrl: cloneUrl.toString(),
106-
name: project.path_with_namespace,
108+
name: repoName,
107109
imageUrl: project.avatar_url,
108110
isFork: isFork,
109111
isArchived: !!project.archived,
@@ -121,7 +123,7 @@ export const compileGitlabConfig = async (
121123
gitConfig: {
122124
'zoekt.web-url-type': 'gitlab',
123125
'zoekt.web-url': projectUrl,
124-
'zoekt.name': project.path_with_namespace,
126+
'zoekt.name': repoName,
125127
'zoekt.gitlab-stars': (project.stargazers_count ?? 0).toString(),
126128
'zoekt.gitlab-forks': (project.forks_count ?? 0).toString(),
127129
'zoekt.archived': marshalBool(project.archived),
@@ -153,16 +155,18 @@ export const compileGiteaConfig = async (
153155
const notFound = giteaReposResult.notFound;
154156

155157
const hostUrl = config.url ?? 'https://gitea.com';
158+
const hostname = new URL(hostUrl).hostname;
156159

157160
const repos = giteaRepos.map((repo) => {
158161
const cloneUrl = new URL(repo.clone_url!);
162+
const repoName = `${hostname}/${repo.full_name!}`;
159163

160164
const record: RepoData = {
161165
external_id: repo.id!.toString(),
162166
external_codeHostType: 'gitea',
163167
external_codeHostUrl: hostUrl,
164168
cloneUrl: cloneUrl.toString(),
165-
name: repo.full_name!,
169+
name: repoName,
166170
imageUrl: repo.owner?.avatar_url,
167171
isFork: repo.fork!,
168172
isArchived: !!repo.archived,
@@ -180,7 +184,7 @@ export const compileGiteaConfig = async (
180184
gitConfig: {
181185
'zoekt.web-url-type': 'gitea',
182186
'zoekt.web-url': repo.html_url!,
183-
'zoekt.name': repo.full_name!,
187+
'zoekt.name': repoName,
184188
'zoekt.archived': marshalBool(repo.archived),
185189
'zoekt.fork': marshalBool(repo.fork!),
186190
'zoekt.public': marshalBool(repo.internal === false && repo.private === false),

packages/web/src/hooks/useCodeMirrorTheme.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const chalky = "#e5c07b",
2020
sage = "#98c379",
2121
whiskey = "#d19a66",
2222
violet = "#c678dd",
23-
highlightBackground = "#2c313a",
23+
highlightBackground = "#2c313aaa",
2424
background = "#282c34",
2525
selection = "#3E4451",
2626
cursor = "#528bff";
@@ -65,14 +65,14 @@ export const useCodeMirrorTheme = () => {
6565
{ tag: t.invalid, color: invalid }
6666
]
6767
});
68-
}, []);
68+
}, [tailwind.theme.colors.background]);
6969

7070
const cmTheme = useMemo(() => {
7171
return theme === 'dark' ? darkTheme : [
7272
defaultLightThemeOption,
7373
syntaxHighlighting(defaultHighlightStyle),
7474
]
75-
}, [theme]);
75+
}, [theme, darkTheme]);
7676

7777
return cmTheme;
7878
}

0 commit comments

Comments
 (0)