Closed wirekang closed 1 month ago
Hi @wirekang ,
2.4.0 uses the same markdown editor as obsidian, except it overrides the load and save methods to do the encryption.
I expect it to work well with all core plugins unless there's some fundamental change to how the load/save flow works in a later obsidian update.
It was a bit of effort getting it to work with the default markdown editor, ideally I'd like to see more people test the 2.4.0 betas and give feedback before I release it.
Thank you for testing.
While trying to find some kind of file IO related bug in 2.4.0, I accidently found a bug that decrypted data is written in disk when "Save current file(Ctrl-S)" is performed multiple times rapidly.
I wrote a simple GO program that reads and prints test.mdenc
whenever it changes. Below is the result I got by repeatedly pressing Ctrl-S.
package main
import (
"fmt"
"log"
"os"
"github.com/fsnotify/fsnotify"
)
func onChange() {
data, err := os.ReadFile("test.mdenc")
if err != nil {
panic(err)
}
fmt.Println(string(data))
}
func main() {
w, err := fsnotify.NewWatcher()
if err != nil {
panic(err)
}
defer w.Close()
go func() {
for {
select {
case e, ok := <-w.Events:
if !ok {
return
}
if e.Name == "test.mdenc" {
onChange()
}
case err, ok := <-w.Errors:
if !ok {
return
}
log.Println("error:", err)
}
}
}()
err = w.Add(".")
if err != nil {
panic(err)
}
<-make(chan struct{})
}
Awesome find, thanks for testing and reporting @wirekang, I'll look into it.
Will all editor related core/plugin features are 100% compatible with encrypted note if old
EncryptedFileContentView.ts
is gone? Please tell me there will be no possible limitation(except bugs), at least for vim keybindings.Anyway, this is great work. Thank you.