From bab5c3c682a3eb98673980a6a28289726a28a8f3 Mon Sep 17 00:00:00 2001 From: gregortokarev Date: Wed, 15 Apr 2026 22:42:20 +0300 Subject: [PATCH 1/4] feat: add open current page on github shortcut and command to cmd+k select --- .../src/lib/command-palette/registry.ts | 16 ++++++++++++++++ .../src/lib/github-current-url.test.ts | 18 ++++++++++++++++++ apps/dashboard/src/lib/github-current-url.ts | 9 +++++++++ .../routes/_protected/settings/shortcuts.tsx | 3 ++- 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 apps/dashboard/src/lib/github-current-url.test.ts create mode 100644 apps/dashboard/src/lib/github-current-url.ts diff --git a/apps/dashboard/src/lib/command-palette/registry.ts b/apps/dashboard/src/lib/command-palette/registry.ts index 9116bbe..d9c20fb 100644 --- a/apps/dashboard/src/lib/command-palette/registry.ts +++ b/apps/dashboard/src/lib/command-palette/registry.ts @@ -1,10 +1,12 @@ import { DashboardIcon, + ExternalLinkIcon, GitPullRequestIcon, IssuesIcon, ReviewsIcon, SettingsIcon, } from "@diffkit/icons"; +import { buildCurrentGitHubUrl } from "#/lib/github-current-url"; import type { CommandItem } from "./types"; let commands: CommandItem[] = []; @@ -81,4 +83,18 @@ registerCommands([ shortcut: ["G", "S"], action: { type: "navigate", to: "/settings" }, }, + { + id: "action:open-current-page-on-github", + label: "Open Current Page on GitHub", + group: "Actions", + icon: ExternalLinkIcon, + keywords: ["github", "redirect", "current page", "open"], + shortcut: ["G", "G"], + action: { + type: "execute", + fn: () => { + window.location.href = buildCurrentGitHubUrl(window.location.href); + }, + }, + }, ]); diff --git a/apps/dashboard/src/lib/github-current-url.test.ts b/apps/dashboard/src/lib/github-current-url.test.ts new file mode 100644 index 0000000..af65470 --- /dev/null +++ b/apps/dashboard/src/lib/github-current-url.test.ts @@ -0,0 +1,18 @@ +import { describe, expect, it } from "vitest"; +import { buildCurrentGitHubUrl } from "./github-current-url"; + +describe("buildCurrentGitHubUrl", () => { + it("replaces the production domain with github.com", () => { + expect( + buildCurrentGitHubUrl( + "https://diff-kit.com/stylessh/diffkit/pull/42?tab=files#discussion", + ), + ).toBe("https://github.com/stylessh/diffkit/pull/42?tab=files#discussion"); + }); + + it("replaces local dev origins with github.com over https", () => { + expect( + buildCurrentGitHubUrl("http://localhost:3000/stylessh/diffkit/issues/7"), + ).toBe("https://github.com/stylessh/diffkit/issues/7"); + }); +}); diff --git a/apps/dashboard/src/lib/github-current-url.ts b/apps/dashboard/src/lib/github-current-url.ts new file mode 100644 index 0000000..e0d8566 --- /dev/null +++ b/apps/dashboard/src/lib/github-current-url.ts @@ -0,0 +1,9 @@ +export function buildCurrentGitHubUrl(currentUrl: string): string { + const url = new URL(currentUrl); + + url.protocol = "https:"; + url.hostname = "github.com"; + url.port = ""; + + return url.toString(); +} diff --git a/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx b/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx index b81f040..fdb40a2 100644 --- a/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx +++ b/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx @@ -200,6 +200,7 @@ const shortcutGroups: ShortcutGroup[] = [ title: "Navigation", shortcuts: [ { keys: ["G", "H"], description: "Go to Overview" }, + { keys: ["G", "G"], description: "Open Current Page on GitHub" }, { keys: ["G", "P"], description: "Go to Pull Requests" }, { keys: ["G", "I"], description: "Go to Issues" }, { keys: ["G", "R"], description: "Go to Reviews" }, @@ -266,7 +267,7 @@ function ShortcutsPage() { i > 0 && "border-t border-border/70", )} > - {shortcut.description} + {shortcut.description} {shortcut.keys.map((key) => { const token = resolveKey(key); From c852356681b0ee71aecb37c11cac8779494e4b3a Mon Sep 17 00:00:00 2001 From: gregortokarev Date: Wed, 15 Apr 2026 22:51:11 +0300 Subject: [PATCH 2/4] chore: reconsidered ui change --- apps/dashboard/src/routes/_protected/settings/shortcuts.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx b/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx index fdb40a2..505a629 100644 --- a/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx +++ b/apps/dashboard/src/routes/_protected/settings/shortcuts.tsx @@ -267,7 +267,7 @@ function ShortcutsPage() { i > 0 && "border-t border-border/70", )} > - {shortcut.description} + {shortcut.description} {shortcut.keys.map((key) => { const token = resolveKey(key); From 8dd8b6c7c7e0156226b61b2b5bb42ab36ef26c2f Mon Sep 17 00:00:00 2001 From: gregortokarev Date: Thu, 16 Apr 2026 07:10:05 +0300 Subject: [PATCH 3/4] feat: Do not apply extension redirects for certain referers. --- extensions/diffkit-redirect/content.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/extensions/diffkit-redirect/content.js b/extensions/diffkit-redirect/content.js index 3e37113..abccf7d 100644 --- a/extensions/diffkit-redirect/content.js +++ b/extensions/diffkit-redirect/content.js @@ -1,4 +1,17 @@ (async function runRedirect() { + const ignoreReferrers = [ + "https://github.com/", + "https://diff-kit.com", + "http://localhost:3000", + "http://127.0.0.1:3000", + ]; + + if ( + ignoreReferrers.some((referrer) => document.referrer.startsWith(referrer)) + ) { + return; + } + const shared = globalThis.DiffKitRedirect; if (!shared) { return; From 0f462b0ff30533663a86056e6d1683dd8da0ed75 Mon Sep 17 00:00:00 2001 From: gregortokarev Date: Fri, 17 Apr 2026 16:44:58 +0300 Subject: [PATCH 4/4] chore(gitignore): add wrangler.jsonc to gitignore --- .gitignore | 1 + apps/dashboard/wrangler.jsonc | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a9df1c3..0ff5260 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ __unconfig* .zed .claude +apps/dashboard/wrangler.jsonc diff --git a/apps/dashboard/wrangler.jsonc b/apps/dashboard/wrangler.jsonc index 94add33..2e2e456 100644 --- a/apps/dashboard/wrangler.jsonc +++ b/apps/dashboard/wrangler.jsonc @@ -1,3 +1,4 @@ + { "$schema": "node_modules/wrangler/config-schema.json", "name": "diffkit", @@ -20,7 +21,7 @@ { "binding": "DB", "database_name": "diffkit-db", - "database_id": "7a94a843-0906-416c-9908-4c9fe5339db7", + "database_id": "adf06029-e74f-4a61-8d3d-ea505b637611", "migrations_dir": "drizzle" } ], @@ -41,8 +42,8 @@ "kv_namespaces": [ { "binding": "GITHUB_CACHE_KV", - "id": "2e46aa8dd4554072a64e1aad955d6adc", - "preview_id": "373842a94f694ce48f5f5376ab622b18" + "id": "804b58636dd8472c8adc76418a083aaa", + "preview_id": "3460d7db52ef4729a6b00e3b3bd157ce" } ], "r2_buckets": [