Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,13 @@ final class ObsidianPlugin: NSObject, ActionPlugin, @unchecked Sendable {
// Create new daily note
var content = ""
if _frontmatterEnabled {
content += buildFrontmatter(appName: appName, bundleId: bundleId, url: url, language: language)
let includeAppMeta = _dailyNoteFormat.contains("{{APP}}")
content += buildFrontmatter(
appName: includeAppMeta ? appName : nil,
bundleId: includeAppMeta ? bundleId : nil,
url: includeAppMeta ? url : nil,
language: language
)
content += "\n\n"
}
content += "## \(timeString)\n\n\(text)"
Expand Down Expand Up @@ -330,12 +336,16 @@ private struct ObsidianSettingsView: View {
Text("Vault", bundle: bundle)
.font(.headline)

if !detectedVaults.isEmpty {
if !detectedVaults.isEmpty || !vaultPath.isEmpty {
Picker(String(localized: "Detected Vaults", bundle: bundle), selection: $vaultPath) {
Text("Select vault...", bundle: bundle).tag("")
ForEach(detectedVaults) { vault in
Text(vault.name).tag(vault.path)
}
if !vaultPath.isEmpty && !detectedVaults.contains(where: { $0.path == vaultPath }) {
let customName = (vaultPath as NSString).lastPathComponent
Text(customName).tag(vaultPath)
}
}
.labelsHidden()
.onChange(of: vaultPath) { _, newValue in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,55 @@ final class ObsidianPluginTests: XCTestCase {
XCTAssertTrue(content.contains("Second entry"))
}

func testAutoExportDailyNoteOmitsAppMetadataWhenFormatDoesNotContainApp() async throws {
let vaultURL = try Self.makeTemporaryDirectory(prefix: "ObsidianVaultDailyNoApp")
defer { try? FileManager.default.removeItem(at: vaultURL) }

let eventBus = PluginTestEventBus()
let host = try PluginTestHostServices(
defaults: [
"vaultPath": vaultURL.path,
"dailyNoteEnabled": true,
"dailyNoteFormat": "{{DATE}}", // No {{APP}}
"frontmatterEnabled": true,
"autoExportEnabled": true,
],
eventBus: eventBus
)
let plugin = ObsidianPlugin()
plugin.activate(host: host)

await eventBus.emit(
.transcriptionCompleted(
TranscriptionCompletedPayload(
rawText: "First",
finalText: "First entry",
language: "it",
engineUsed: "test",
durationSeconds: 1,
appName: "Brave Browser",
bundleIdentifier: "com.brave.Browser",
url: "https://example.com",
ruleName: nil
)
)
)

let files = try FileManager.default.contentsOfDirectory(
at: vaultURL.appendingPathComponent("TypeWhisper", isDirectory: true),
includingPropertiesForKeys: nil
)
XCTAssertEqual(files.count, 1)

let content = try String(contentsOf: files[0], encoding: .utf8)
XCTAssertTrue(content.contains("---"))
XCTAssertFalse(content.contains("app: Brave Browser"))
XCTAssertFalse(content.contains("bundleId: com.brave.Browser"))
XCTAssertFalse(content.contains("url: https://example.com"))
XCTAssertTrue(content.contains("language: it"))
XCTAssertTrue(content.contains("First entry"))
}

func testActionNameMatchesWorkflowInstructionTarget() {
let plugin = ObsidianPlugin()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "com.typewhisper.obsidian",
"name": "Obsidian",
"version": "1.0.0",
"version": "1.0.6",
"minHostVersion": "0.9.0",
"sdkCompatibilityVersion": "v1",
"minOSVersion": "14.0",
Expand Down