| b69ab31 | | | 1 | /** |
| b69ab31 | | | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| b69ab31 | | | 3 | * |
| b69ab31 | | | 4 | * This source code is licensed under the MIT license found in the |
| b69ab31 | | | 5 | * LICENSE file in the root directory of this source tree. |
| b69ab31 | | | 6 | */ |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | import type {ServerPlatform} from '../src/serverPlatform'; |
| b69ab31 | | | 9 | |
| b69ab31 | | | 10 | export const platform: ServerPlatform = { |
| b69ab31 | | | 11 | platformName: 'obsidian', |
| b69ab31 | | | 12 | |
| b69ab31 | | | 13 | async handleMessageFromClient(this: ServerPlatform, repo, _ctx, message, _postMessage) { |
| b69ab31 | | | 14 | switch (message.type) { |
| b69ab31 | | | 15 | case 'platform/openFile': { |
| b69ab31 | | | 16 | // For Obsidian, file opening is handled client-side via postMessage |
| b69ab31 | | | 17 | // Log for debugging purposes |
| b69ab31 | | | 18 | repo?.initialConnectionContext.logger.log( |
| b69ab31 | | | 19 | 'Obsidian platform: openFile request (handled client-side)', |
| b69ab31 | | | 20 | message.path, |
| b69ab31 | | | 21 | ); |
| b69ab31 | | | 22 | break; |
| b69ab31 | | | 23 | } |
| b69ab31 | | | 24 | case 'platform/openFiles': { |
| b69ab31 | | | 25 | repo?.initialConnectionContext.logger.log( |
| b69ab31 | | | 26 | 'Obsidian platform: openFiles request (handled client-side)', |
| b69ab31 | | | 27 | message.paths, |
| b69ab31 | | | 28 | ); |
| b69ab31 | | | 29 | break; |
| b69ab31 | | | 30 | } |
| b69ab31 | | | 31 | case 'platform/openExternal': { |
| b69ab31 | | | 32 | repo?.initialConnectionContext.logger.log( |
| b69ab31 | | | 33 | 'Obsidian platform: openExternal request (handled client-side)', |
| b69ab31 | | | 34 | message.url, |
| b69ab31 | | | 35 | ); |
| b69ab31 | | | 36 | break; |
| b69ab31 | | | 37 | } |
| b69ab31 | | | 38 | // Other platform messages handled by default behavior |
| b69ab31 | | | 39 | } |
| b69ab31 | | | 40 | }, |
| b69ab31 | | | 41 | }; |