Skip to content

Fix reopened share links using tauri.localhost in desktop app - #1293

Open
jay23606 wants to merge 2 commits into
blinkospace:mainfrom
jay23606:pr-go-simple/909
Open

jay23606 wants to merge 2 commits into
blinkospace:mainfrom
jay23606:pr-go-simple/909

Conversation

@jay23606

Copy link
Copy Markdown

Reopening the share dialog from a note card or the right-click menu built the share link from window.location.origin. In the Tauri desktop app that origin is http://tauri.localhost, so the dialog showed a dead link while the original link, created via getBlinkoEndpoint(), still worked.

Changes:

  • Add getBlinkoShareUrl() in app/src/lib/blinkoEndpoint.ts. It builds the share URL from getBlinkoEndpoint(), the same base the create path uses.
  • Use it in BlinkoCard/cardHeader.tsx and BlinkoRightClickMenu/index.tsx for the reopen path.
  • Add a regression test in server/tests/security/file-urls.test.ts that simulates the Tauri window with a configured endpoint and checks the share URL.

Web behaviour is unchanged, because window.location.origin equals getBlinkoEndpoint() there.

Tests: I ran an inline bun script that imports the new helper and checks the Tauri case (https://desktop-blinko.example/share/abc123) and the web case (https://web.example/share/abc123). Both passed. The new regression test in file-urls.test.ts could not run here: dependencies are not installed and the suite fails on a missing 'jsonwebtoken' import before any test executes.

Tests not run here: bun test server/tests/security/file-urls.test.ts - fails before running any test: Cannot find package 'jsonwebtoken' (dependencies not installed; installing them was not permitted), app TypeScript type-check / frontend build - dependencies not installed in this environment

Fixes #909

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@jay23606
jay23606 marked this pull request as ready for review November 20, 2026 20:05

@Aniketchavan7 Aniketchavan7 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on resolving the share URL via the configured desktop endpoint instead of window.location.origin in Tauri!

One small suggestion for getBlinkoShareUrl:
Instead of string concatenation with getBlinkoEndpoint() + 'share/' + shareEncryptedUrl, passing the path directly into getBlinkoEndpoint:

export function getBlinkoShareUrl(shareEncryptedUrl: string): string {
    return getBlinkoEndpoint('/share/' + shareEncryptedUrl);
}

getBlinkoEndpoint already uses new URL(path, base).toString(), so passing '/share/' + shareEncryptedUrl avoids potential double-slash or missing-slash issues depending on whether the stored endpoint has a trailing slash.

Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
@jay23606
jay23606 marked this pull request as draft November 21, 2026 15:15
@jay23606
jay23606 marked this pull request as ready for review November 21, 2026 23:14

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

分享错误 || Share error

2 participants