Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(markdown): make known app deep links clickable #15722

Closedsuevalov(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/15722/headopened View on GitHub

Showing 9 changed files with 43 additions and 5 deletions (loading 6).

x
0 of 9 viewed, 9 left
35 additions and 0 deletionsapps/desktop/src/electron/ElectronShell.test.tsModified
View file
@@ -36,6 +36,41 @@
}).pipe(Effect.provide(ElectronShell.layer)),
);
​
+ it.effect("opens known app deep links in the OS handler", () =>
+ Effect.gen(function* () {
+ openExternalMock.mockResolvedValue(undefined);
+​
+ const electronShell = yield* ElectronShell.ElectronShell;
+ const urls = [
+ "linear://linear.app/example/issue/EXAMPLE-123",
+ "slack://channel?team=T123&id=C123",
+ "notion://www.notion.so/example-page",
+ "obsidian://open?vault=Example&file=Notes",
+ ];
+ const results = yield* Effect.forEach(urls, electronShell.openExternal);
+​
+ assert.deepEqual(results, [true, true, true, true]);
+ assert.deepEqual(
+ openExternalMock.mock.calls,
+ urls.map((url) => [url]),
+ );
+ }).pipe(Effect.provide(ElectronShell.layer)),
+ );
+​
+ it.effect("does not open executable or unknown schemes", () =>
+ Effect.gen(function* () {
+ const electronShell = yield* ElectronShell.ElectronShell;
+ const results = yield* Effect.all([
+ electronShell.openExternal("javascript:alert(1)"),