Skip to content

Commit 5257487

Browse files
committed
Use shared GkDotDevUrl constant instead of defining it in every host file
1 parent 4b65ac1 commit 5257487

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

src/hosts/azureDevops.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { InjectionProvider, LinkTarget } from '../provider';
2-
3-
declare const MODE: 'production' | 'development' | 'none';
2+
import { GKDotDevUrl } from '../shared';
43

54
interface ReplaceSelector {
65
selector: string;
@@ -181,7 +180,7 @@ export function injectionScope(url: string) {
181180

182181
private transformUrl(action: 'open' | 'compare', pathname: string, search: URLSearchParams): string {
183182
const redirectUrl = new URL(this.getRedirectUrl('vscode', action, pathname, search));
184-
const deepLinkUrl = MODE === 'production' ? 'https://gitkraken.dev/link' : 'https://dev.gitkraken.dev/link';
183+
const deepLinkUrl = `${GKDotDevUrl}/link`;
185184
const deepLink = new URL(`${deepLinkUrl}/${encodeURIComponent(btoa(redirectUrl.toString()))}`);
186185
deepLink.searchParams.set('referrer', 'extension');
187186
if (redirectUrl.searchParams.get('pr')) {

src/hosts/bitbucket.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { InjectionProvider, LinkTarget } from '../provider';
2-
3-
declare const MODE: 'production' | 'development' | 'none';
2+
import { GKDotDevUrl } from '../shared';
43

54
interface ReplaceSelector {
65
selector: string;
@@ -185,7 +184,7 @@ export function injectionScope(url: string) {
185184

186185
private transformUrl(action: 'open' | 'compare', pathname: string): string {
187186
const redirectUrl = new URL(this.getRedirectUrl('vscode', action, pathname));
188-
const deepLinkUrl = MODE === 'production' ? 'https://gitkraken.dev/link' : 'https://dev.gitkraken.dev/link';
187+
const deepLinkUrl = `${GKDotDevUrl}/link`;
189188
const deepLink = new URL(`${deepLinkUrl}/${encodeURIComponent(btoa(redirectUrl.toString()))}`);
190189
deepLink.searchParams.set('referrer', 'extension');
191190
if (redirectUrl.searchParams.get('pr')) {

src/hosts/github.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { InjectionProvider, LinkTarget } from '../provider';
2-
3-
declare const MODE: 'production' | 'development' | 'none';
2+
import { GKDotDevUrl } from '../shared';
43

54
export function injectionScope(url: string) {
65
class GitHubInjectionProvider implements InjectionProvider {
@@ -253,7 +252,7 @@ export function injectionScope(url: string) {
253252
private transformUrl(action: 'open' | 'compare'): string {
254253
const redirectUrl = new URL(this.getRedirectUrl('vscode', action));
255254
console.debug('redirectUrl', redirectUrl);
256-
const deepLinkUrl = MODE === 'production' ? 'https://gitkraken.dev/link' : 'https://dev.gitkraken.dev/link';
255+
const deepLinkUrl = `${GKDotDevUrl}/link`;
257256
const deepLink = new URL(`${deepLinkUrl}/${encodeURIComponent(btoa(redirectUrl.toString()))}`);
258257
deepLink.searchParams.set('referrer', 'extension');
259258
if (redirectUrl.searchParams.get('pr')) {

src/hosts/gitlab.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { InjectionProvider, LinkTarget } from '../provider';
2-
3-
declare const MODE: 'production' | 'development' | 'none';
2+
import { GKDotDevUrl } from '../shared';
43

54
export function injectionScope(url: string) {
65
class GitLabInjectionProvider implements InjectionProvider {
@@ -253,7 +252,7 @@ export function injectionScope(url: string) {
253252
private transformUrl(action: 'open' | 'compare'): string {
254253
const redirectUrl = new URL(this.getRedirectUrl('vscode', action));
255254
console.debug('redirectUrl', redirectUrl);
256-
const deepLinkUrl = MODE === 'production' ? 'https://gitkraken.dev/link' : 'https://dev.gitkraken.dev/link';
255+
const deepLinkUrl = `${GKDotDevUrl}/link`;
257256
const deepLink = new URL(`${deepLinkUrl}/${encodeURIComponent(btoa(redirectUrl.toString()))}`);
258257
deepLink.searchParams.set('referrer', 'extension');
259258
if (redirectUrl.searchParams.get('pr')) {

0 commit comments

Comments
 (0)