I have implemented gemini capsule and added gemini mentions. During mention I save to my db some stuff and I wanted to trigger misfin message to myself. My capsule is written in golang.
I thought I should create gembox in my misfin server with separate capsule identity and use this certificate to send message. Is there golang libs or flow how it should be implemented?
Mar 28 · 9 months ago
12 Comments ↓
My misfin-server is written in golang and includes a gembox and gemmail parser. You can look at it to see how I implemented the code: https://gitlab.com/clseibold/misfin-server
@clseibold nice :) I use different server and now will not switch but your lib is awesome. I will try
import "gitlab.com/clseibold/misfin-server/misfin_client"
oh, you even have code block needed for me :) Wonderful
@zordsdavini No problem! If you have any suggestions or features that need to be added, or help with using any of the stuff, just ask.
Do note that for the client, you need to choose between the default (Misfin(C)) and Misfin(B). There are separate functions and client types for each one.
@clseibold I have cipres/misfin server installed and I think it is Misfin(C) compatible but I get error.
@clseibold set Client to MisfinB and started to work :)
@zordsdavini The message structure in Misfin(C) is different than Misfin(B). I recommend reading the Misfin(C) spec here, particularly the section titled "The Message": gemini://satch.xyz/misfin/proposed-misfin-c-9th-draft.gmi
You can also use the gemmail package in my misfin-server repo to construct a valid gemmail for Misfin(C). For example:
import (
"gitlab.com/clseibold/misfin-server/gemmail"
"gitlab.com/clseibold/misfin-server/misfin_client"
)
// ...
message := gemmail.CreateGemMailFromBody("# TEST\nTuri gautÄ—")
certFile, err := os.ReadFile("./identities/alkierios_misfin.pem")
if err != nil {
fmt.Printf("[gemini-mentions] couldn't read misfin sert: %s", err)
}
client := misfin_client.Client{}
resp, err := client.SendWithCert("misfin://zordsdavini@arns.lt", certFile, certFile, message.String()) // message.String_MisfinB() gives you a Misfin(B) string
// ...
You just use `message := gemmail.CreateGemMailFromBody(body_text)` to create the gemmail, and then `message.String()` to get back the actual Misfin(C) message format that is required to send over Misfin(C). All this does is basically ensures that the message has 3 empty lines at the beginning of the message, as required by the Misfin(C) spec.
Or, you can optionally just make sure all *newly created* messages that are sent over misfin(C) have three empty lines by prepending "\n\n\n" to it. Please note that this only works for newly created messages, not messages that are being received and then forwarded.
Why misfin standard does not have title?
Though if it is gemtext, I gues the first line with # tag can be used as a title.
@clseibold you are super right. I refactored to use your gemmail lib and now it works smoothly. I am impresed. If I will not fix current misfin server and docker/traefik issues I'll switch to misfin-server
@Ezra #title at the beginning works as subject in simple email
@Ezra The misfin spec does allow for the subject line, which is the same as the title.
what are "gemini mentions"?
ok i found
via kennedi search.