Skip to content

fix: normalize dataDir path separator and add mobile highlight support#156

Merged
lcomplete merged 2 commits into
mainfrom
fix/data-dir-path-separator-and-mobile-highlight
May 8, 2026
Merged

fix: normalize dataDir path separator and add mobile highlight support#156
lcomplete merged 2 commits into
mainfrom
fix/data-dir-path-separator-and-mobile-highlight

Conversation

@lcomplete
Copy link
Copy Markdown
Owner

Summary

  • [Bug] Windows 下 dataDir 路径缺少分隔符导致数据库创建位置错误 #155 (Windows dataDir bug): Add HuntlyEnvironmentPostProcessor that runs before Spring resolves the datasource URL, ensuring huntly.dataDir always ends with /. Previously, passing --huntly.dataDir=C:\Users\name\huntly (no trailing slash) caused jdbc:sqlite:C:\Users\name\huntlyd​b.sqlite — the separator was missing. Registered via META-INF/spring.factories. 6 unit tests added.
  • 手机端上缺失高亮功能 #154 (mobile highlight missing): TextHighlighter previously only listened to mouseup, which does not fire on mobile. Added touchend, pointerup, and document-level selectionchange (with 80 ms debounce) so long-press text selection on iOS/Android correctly triggers the highlight tooltip. Also added WebkitUserSelect: text and touchAction: auto to the content container for broader mobile compatibility.

Test plan

  • Server: ./mvnw test -pl huntly-server -am -DfailIfNoTests=false — all 48 tests pass including 6 new HuntlyEnvironmentPostProcessorTest cases
  • Client: yarn tsc --noEmit — no type errors
  • Windows manual: start jar with --huntly.dataDir=C:\path\without\trailing\slash, verify db.sqlite lands inside that directory
  • Mobile manual: open an article on iOS/Android, long-press to select text, verify the highlight button appears

Closes #155
Closes #154

🤖 Generated with Claude Code

…ighlight support

- Add HuntlyEnvironmentPostProcessor to ensure huntly.dataDir always ends
  with a path separator before Spring resolves the datasource URL, fixing
  SQLite DB creation at wrong path on Windows (#155)
- Register processor via META-INF/spring.factories; add 6 unit tests
- Add touchend/pointerup/selectionchange listeners with 80ms debounce to
  TextHighlighter so mobile long-press selection triggers the highlight
  tooltip (#154)
- Add WebkitUserSelect and touchAction styles for broader mobile compatibility

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 8, 2026

🤖 Augment PR Summary

Summary: This PR fixes a Windows-specific SQLite path concatenation bug and improves text highlight selection handling on mobile devices.

Changes:

  • Client: Enhanced TextHighlighter selection detection by listening to touchend, pointerup, and document-level selectionchange with an ~80ms debounce, improving long-press selection on iOS/Android.
  • Client: Added mobile-friendly selection-related styles (WebkitUserSelect, touchAction) on the content container.
  • Server: Added HuntlyEnvironmentPostProcessor to normalize huntly.dataDir so it always ends with a separator (appending / when missing) before Spring resolves the SQLite JDBC URL.
  • Server: Registered the post-processor via META-INF/spring.factories and added unit tests covering Windows/Unix paths and empty/absent values.

Technical Notes: Normalizing huntly.dataDir prevents malformed URLs like ...huntlydb.sqlite when users pass a directory path without a trailing slash on Windows.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

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

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

currentRef.addEventListener('touchend', scheduleHandleSelection);
currentRef.addEventListener('pointerup', scheduleHandleSelection);
}
document.addEventListener('selectionchange', scheduleHandleSelection);
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 8, 2026

Choose a reason for hiding this comment

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

app/client/src/components/highlights/TextHighlighter.tsx:513: selectionchange is registered on document, so it can still schedule timers and trigger setSelectionTooltip updates for selection changes outside the article (and even when highlightModeEnabled is false). Is that global behavior intentional, or should selection handling be scoped to the active highlight mode/content container to avoid unintended state churn?

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@lcomplete lcomplete merged commit 85a9570 into main May 8, 2026
@lcomplete lcomplete deleted the fix/data-dir-path-separator-and-mobile-highlight branch May 8, 2026 07:01
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.

[Bug] Windows 下 dataDir 路径缺少分隔符导致数据库创建位置错误 手机端上缺失高亮功能

1 participant