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