honk fetch just calls anonymous fetch cause the honk API is so tiny

This commit is contained in:
Iris Lightshard 2024-12-01 10:52:36 -07:00
parent a2017e3de8
commit 305366dc9e
Signed by: Iris Lightshard
GPG key ID: 688407174966CAF3

View file

@ -70,39 +70,14 @@ func (self *HonkAdapter) Init(settings Settings, data *chan SocketData) error {
} }
func (self *HonkAdapter) Subscribe(string) []error { func (self *HonkAdapter) Subscribe(string) []error {
return nil // similar to the misskey adapter, we will poll for new honks and send them on the channel as they come in
} }
func (self *HonkAdapter) Fetch(etype string, ids []string) error { func (self *HonkAdapter) Fetch(etype string, ids []string) error {
// if we're anonymous, we can fetch the data as raw AP // honk API is limited, we fall back to the anonymous adapter for fetch ops
// KISS
if self.isAnonymous() {
aaa := anonAPAdapter{} aaa := anonAPAdapter{}
aaa.Init(self.data, self.server, "honk", self.nickname) aaa.Init(self.data, self.server, "honk", self.nickname)
return aaa.Fetch(etype, ids) return aaa.Fetch(etype, ids)
}
for _, _ = range ids {
switch etype {
case "byAuthor":
// gethonks
case "message":
// use honk-canonical XID
case "author":
if self.isAnonymous() {
// if we are using @user@server, translate it to https://server/u/user
} else {
// otherwise, use the URL as such
}
case "children":
// use honk-canonical XID
case "convoy":
if self.isAnonymous() {
} else {
}
}
}
return nil
} }
func (self *HonkAdapter) Do(action string, data map[string]string) error { func (self *HonkAdapter) Do(action string, data map[string]string) error {
@ -129,5 +104,5 @@ func (self *HonkAdapter) Do(action string, data map[string]string) error {
} }
func (self *HonkAdapter) DefaultSubscriptionFilter() string { func (self *HonkAdapter) DefaultSubscriptionFilter() string {
return "" return "home"
} }