MCPcopy Index your code
hub / github.com/HanversionOvO/OHSidian

github.com/HanversionOvO/OHSidian @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
83 symbols 133 edges 13 files 7 documented · 8%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

OHsidian Logo

OHsidian

Obsidian for HarmonyOS

Run the Obsidian note-taking experience you know and love on HarmonyOS devices — with multi-window support, one-tap Huawei Account sign-in, Huawei Cloud sync, and comprehensive native system integration.

HarmonyOS Obsidian ArkTS License


Table of Contents


Overview

OHsidian is an unofficial port of the Obsidian note-taking application for the HarmonyOS (HongMeng) platform. Rather than reimplementing Obsidian from scratch, it wraps the original Obsidian (obsidian.asar) inside a complete Electron compatibility layer running atop the HarmonyOS native runtime.

At its core, OHsidian shims the Electron API surface using HarmonyOS native capabilities. A C++ native library (libadapter.so), an ArkTS adapter layer, and a JSBind bridge work together to make Obsidian's Node.js/Electron runtime operate seamlessly on HarmonyOS. Meanwhile, deep integration with the Huawei ecosystem — Account Kit, Cloud Foundation Kit, Status Bar extensions — makes the experience feel truly native.

Project Info
App ID com.mikannqaq.obsidian
Version 1.0.0 (versionCode: 1000000)
Target SDK HarmonyOS 6.0.2(22) / API 22
Target Devices 2in1 (foldable/tablet), Tablet
Language ArkTS (TypeScript)
Build System Hvigor
Obsidian Engine 1.12.7

Architecture

┌──────────────────────────────────────────────────────┐
│                   Obsidian 1.12.7                     │
│                   (obsidian.asar)                     │
├──────────────────────────────────────────────────────┤
│             Electron API Compatibility                │
│    ┌──────────────┐  ┌──────────────┐                │
│    │  @electron/   │  │   Node.js    │                │
│    │    remote     │  │   Runtime    │                │
│    └──────┬───────┘  └──────┬───────┘                │
├──────────┼──────────────────┼────────────────────────┤
│          │   JSBind Bridge   │                        │
│          ▼                  ▼                        │
│  ┌──────────────────────────────────────┐            │
│  │          C++ libadapter.so            │            │
│  └──────────────────────────────────────┘            │
├──────────────────────────────────────────────────────┤
│            ArkTS Adapter Layer (~50 Adapters)         │
│  CloudSync │ FileSys │ Notify │ IME │ Theme │ ...    │
├──────────────────────────────────────────────────────┤
│              HarmonyOS Native Runtime                 │
│   Ability │ ArkUI │ AccountKit │ CloudFoundation     │
└──────────────────────────────────────────────────────┘

Layer breakdown:

  • Obsidian Layer — Stock obsidian.asar, unmodified Obsidian 1.12.7 application code
  • Electron Compatibility@electron/remote provides the remote module API; main.js handles asar loading and update management
  • JSBind Bridge — Connects the JS runtime to the ArkTS native layer, forwarding Electron API calls to the appropriate adapters
  • C++ Native Librarylibadapter.so provides core system-level API bindings
  • ArkTS Adapter Layer — ~50 adapters wrapping HarmonyOS APIs as Electron-compatible interfaces
  • HarmonyOS Foundation — System-native capabilities: Ability components, ArkUI, Huawei Account, Cloud Storage, etc.

Features

Core Obsidian Experience

  • Full Obsidian 1.12.7 note editing and management
  • Complete compatibility with all community plugins and themes
  • Local Vault creation, management, and browsing
  • Real-time Markdown preview and editing
  • Graph view, backlinks, and other advanced features

Multi-Window Support

  • Main windows, sub-windows, embedded windows, floating windows
  • Persistent window position and size memory
  • Isolated rendering processes (via ChildProcess)
  • Status bar extension window

Huawei Ecosystem Integration

  • One-Tap Huawei Account Sign-In — Seamless authentication via Account Kit's LoginWithHuaweiIDButton
  • Huawei Cloud Sync — Cloud backup and cross-device Vault synchronization via Cloud Foundation Kit
  • Status Bar Extension — Persistent system status bar presence via StatusBarViewExtensionAbility

Native System Integration

Category Adaptations
File System File manager, file picker, native dialogs, trash compatibility layer
Input IME framework, drag-and-drop, multi-touch
Display Multi-monitor management, dark/light theme following, custom cursors
Notifications System push notifications, screen lock event monitoring
Device Battery status, Bluetooth (Classic + BLE), power management, screenshots
Security Certificate management, biometric authentication, clipboard access
Other Print service, text-to-speech, OCR recognition, geolocation, external protocol handling

Auto-Update

  • Detects obsidian-{version}.asar update packages
  • RSA-SHA256 signature verification + SHA256 hash verification
  • Hot-reloads new version after replacing the asar archive

Module Structure

The project follows the standard HarmonyOS dual-module architecture:

web_engine (HAR Static Library)

The core engine module providing all Electron compatibility functionality and adapters. Can be reused by other HarmonyOS applications.

// Public exports (Index.ets)
export { WebAbilityStage } from './src/main/ets/application/AbilityStage'
export { WebAbility } from './src/main/ets/ability/WebAbility'
export { WebEmbeddedAbility } from './src/main/ets/ability/WebEmbeddedAbility'
export { WebWindow, WebSubWindow, WebEmbeddedWindow, WebWindowNode } from './src/main/ets/components/...'
export { WebChildProcess } from './src/main/ets/process/WebChildProcess'

Dependency Injection — InversifyJS manages ~50 adapters registered as singletons:

CommonModule  → AbilityManager, DragParamManager, SystemFloatingWindowManager
AdapterModule → ContextAdapter, DragDropAdapter, MultiInputAdapter,
                NativeThemeAdapter, PermissionManagerAdapter, DialogAdapter,
                TrashAdapter, CloudSyncAdapter ...

electron (HAP Entry Package)

The executable application module containing all UI pages and application logic.

Ability Components:

Ability Page Purpose
EntryAbility Index.ets Main entry point, initializes AGC
BrowserAbility WindowNode.ets Browser process window
StatelessAbility Index.ets Stateless windows
BrowserEmbeddedAbility EmbeddedWindow.ets Embedded UI
StatusBarEntryAbility StatusBarPage.ets Status bar extension

UI Pages:

Page Description
Index.ets Main view hosting the WebWindow component
WindowNode.ets Browser window node
SubWindow.ets Sub-window (popups, settings, etc.)
EmbeddedWindow.ets Embedded window
Login.ets Huawei Account sign-in page
StatusBarPage.ets Status bar page
WebPage.ets WebView page for privacy agreements, etc.

Adapter Layer

The adapter layer is the most critical infrastructure in OHsidian — it wraps HarmonyOS native APIs as Electron-compatible interfaces, allowing Obsidian to run on HarmonyOS with zero awareness of the underlying platform.

Adapter Catalog

Each adapter extends BaseAdapter, is registered as a singleton via InversifyJS, and comes with a corresponding JSBind binding class:

web_engine/src/main/ets/adapter/
├── Accessibility.ets           # Accessibility features
├── AppLifecycle.ets            # Application lifecycle
├── AppWindow.ets               # Application window operations
├── Battery.ets                 # Battery status
├── Bluetooth.ets               # Bluetooth Classic
├── BluetoothLowEnergy.ets      # Bluetooth Low Energy
├── BrowserPolicy.ets           # Browser security policies
├── CertManager.ets             # Certificate management
├── CloudSync.ets               # Huawei Cloud Sync ⭐
├── Context.ets                 # Application context
├── ContextPath.ets             # File path resolution
├── Cursor.ets                  # Custom cursors
├── Device.ets                  # Device information
├── DeviceInfo.ets              # Hardware information
├── DeviceUserAuth.ets          # Biometric authentication
├── Dialog.ets                  # Native dialogs
├── Display.ets                 # Display/monitor management
├── DragDrop.ets                # Drag-and-drop
├── ElectronApp.ets             # Electron App API shim
├── ExternalProtocol.ets        # External protocol handlers
├── FileManager.ets             # File system operations
├── FilePicker.ets              # File picker
├── Font.ets                    # System font enumeration
├── Geolocation.ets             # Geolocation
├── I18n.ets                    # Internationalization
├── IMF.ets                     # Input Method Framework
├── Media.ets                   # Media playback
├── MimeType.ets                # MIME type mapping
├── MultiInput.ets              # Multi-window input
├── NativeTheme.ets             # System theme (dark/light)
├── NetConnection.ets           # Network connectivity
├── Notification.ets            # System notifications
├── Ocr.ets                     # OCR recognition
├── PasteBoard.ets              # Clipboard
├── PermissionManager.ets       # Permission management
├── PopupWindow.ets             # Popup windows
├── PowerMonitor.ets            # Power monitoring
├── Print.ets                   # Print service
├── Process.ets                 # Process management
├── RunningLock.ets             # Wake locks
├── ScreenlockMonitor.ets       # Screen lock monitoring
├── Screenshot.ets              # Screen capture
├── ShapeDetection.ets          # Shape detection
├── Speech.ets                  # Text-to-speech
├── StatusBar.ets               # Status bar control
├── SubWindow.ets               # Sub-window management
├── SystemFloatingWindow.ets    # System floating windows
└── Trash.ets                   # Trash/recycle bin operations

JSBind Mechanism

Each adapter has a corresponding Bind class that registers its methods with the JS runtime:

// Example: CloudSync adapter JSBind registration
JsBindingUtils.bindFunction("CloudSync.uploadFile", cloudSyncAdapter.uploadFile)
JsBindingUtils.bindFunction("CloudSync.downloadFile", cloudSyncAdapter.downloadFile)
JsBindingUtils.bindFunction("CloudSync.listCloudFiles", cloudSyncAdapter.listCloudFiles)
// ...

All bindings are activated at startup through JsBindingMethod.ets.


Huawei Cloud Sync

OHsidian implements Vault cloud synchronization based on Huawei Cloud Foundation Kit.

Sync Architecture

┌──────────────┐     ┌──────────────────┐     ┌─────────────────────┐
│   Obsidian   │────▶│  CloudSyncAdapter │────▶│ CloudFoundation Kit  │
│   triggers    │     │  (ArkTS Adapter)  │     │  (Huawei Cloud)      │
│   writes     │     │                  │     │                     │
└──────────────┘     └──────────────────┘     └─────────────────────┘
                                                    │
                                              ┌─────▼──────────┐
                                              │  Bucket:        │
                                              │  ohsidian-vault │
                                              │  -sync-75ued    │
                                              └────────────────┘

Storage Structure

{userId}/
  └── vaults/
      └── {vaultName}/
          ├── file1.md
          ├── attachments/
          │   └── image.png
          └── ...

Sync Operations

Operation Description
uploadFile Upload local file to cloud
downloadFile Download file from cloud
listCloudFiles List files in cloud
deleteCloudFile Delete cloud file
getSyncStatus Get sync status

Sign-In Flow

  1. Obsidian writes a .hcs-login-pending marker file
  2. The HarmonyOS side detects it via a 3-second polling interval
  3. An hcs-login dialog appears with a one-tap Huawei Account sign-in button
  4. After user authorization, userId is persisted to hcs-user.json for Obsidian to read
  5. All subsequent sync operations build cloud paths based on this userId

Build & Run

Prerequisites

Tool Required Version
DevEco Studio 5.0.0+
HarmonyOS SDK API 22 (6.0.2)
Node.js 18.x+
Hvigor 5.0.0+

Build Steps

# 1. Clone the repository
git clone https://github.com/your-username/ohsidian.git
cd ohsidian

# 2. Install dependencies (automatically done in DevEco Studio)
#    Or manually:
hvigorw install

# 3. Build the HAP
hvigorw assembleHap

# 4. Output artifact
# build/outputs/default/electron-default-signed.hap

Alternatively, open the project in DevEco Studio and click Build > Build HAP(s).

Signing Configuration

Configure signing in build-profile.json5:

Note: `build-profile.json

Extension points exported contracts — how you extend this code

ILoginInfo (Interface)
(no doc)
web_engine/src/main/ets/interface/CommonInterface.ts
ILogin (Interface)
(no doc)
web_engine/src/main/ets/interface/CommonInterface.ts
WindowBound (Interface)
(no doc)
web_engine/src/main/ets/interface/CommonInterface.ts
CaptionButtonRect (Interface)
(no doc)
web_engine/src/main/ets/interface/CommonInterface.ts
CommandParameter (Interface)
(no doc)
web_engine/src/main/ets/interface/CommonInterface.ts

Core symbols most depended-on inside this repo

error
called by 10
web_engine/src/main/ets/utils/LogUtil.ts
pad
called by 5
web_engine/src/main/resources/resfile/resources/app/main.js
itemExists
called by 4
web_engine/src/main/resources/resfile/resources/app/main.js
isV2MoreRecent
called by 4
web_engine/src/main/resources/resfile/resources/app/main.js
info
called by 4
web_engine/src/main/ets/utils/LogUtil.ts
normalizeForPrefix
called by 3
web_engine/src/main/resources/resfile/resources/app/main.js
httpGetBinary
called by 3
web_engine/src/main/resources/resfile/resources/app/main.js
getVaultTrashDirByFilesystem
called by 2
web_engine/src/main/resources/resfile/resources/app/main.js

Shape

Interface 31
Function 25
Method 13
Class 12
Enum 2

Languages

TypeScript100%

Modules by API surface

web_engine/src/main/ets/interface/CommonInterface.ts35 symbols
web_engine/src/main/resources/resfile/resources/app/main.js23 symbols
web_engine/src/main/ets/utils/LogUtil.ts6 symbols
web_engine/src/main/ets/utils/GlobalContext.ts6 symbols
web_engine/src/main/ets/utils/CheckEmptyUtils.ts5 symbols
web_engine/src/main/ets/utils/StringUtil.ts3 symbols
web_engine/src/main/ets/utils/ObjUtil.ts3 symbols
web_engine/src/main/ets/common/LogDecorator.ts2 symbols

For agents

$ claude mcp add OHSidian \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact