diff --git a/README.md b/README.md index 4ce570c..ae85347 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,27 @@ archives the fediverse [![CircleCI](https://circleci.com/gh/sneak/feta.svg?style=svg)](https://circleci.com/gh/sneak/feta) -# author +# ethics statement + +It seems that some splinter groups are not well acquainted with the norms of +publishing data on the web. + +Publishing your toots/messages on a server without marking them private or +requiring authentication and thus making them available to the web is an act +of affirmative consent to allowing others to download those toots/messages +(usually by viewing them in a browser on your profile page). If you don't +want your toots downloaded by remote/unauthenticated users on the web, do +not publish them to the web. + +If you publish them to the whole web (and your home instance serves them to +all comers), do not be surprised or feel violated when people download (and +optionally save) them, as your home instance permits them to. + +We do not have a right to be forgotten, as we do not have a right to delete +legitimately-obtained files from the hard drives of other people. + +# Author Jeffrey Paul <[sneak@sneak.berlin](mailto:sneak@sneak.berlin)> +[@sneak@sneak.berlin](https://s.sneak.berlin/@sneak) diff --git a/feta.go b/feta.go index 25d0da7..6213289 100644 --- a/feta.go +++ b/feta.go @@ -4,7 +4,7 @@ import "os" import "time" import "github.com/jinzhu/gorm" -import _ "github.com/jinzhu/gorm/dialects/sqlite" // required for orm +import _ "github.com/jinzhu/gorm/dialects/sqlite" // required for orm import "github.com/rs/zerolog" import "github.com/rs/zerolog/log" @@ -33,7 +33,7 @@ type Process struct { builduser string locator *InstanceLocator manager *InstanceManager - ingester *tootIngester + ingester *tootIngester api *fetaAPIServer db *gorm.DB startup time.Time @@ -109,7 +109,7 @@ func (f *Process) runForever() int { f.locator.addInstanceNotificationChannel(newInstanceHostnameNotifications) f.manager.addInstanceNotificationChannel(newInstanceHostnameNotifications) - f.manager.addTootDestination(f.ingester.getDeliveryChannel()) + f.manager.addTootDestination(f.ingester.getDeliveryChannel()) // ingester goroutine: go f.ingester.ingest() diff --git a/ingester.go b/ingester.go index 16fe65d..b84a519 100644 --- a/ingester.go +++ b/ingester.go @@ -4,22 +4,30 @@ import "time" import "github.com/rs/zerolog/log" type tootIngester struct { - inbound chan *toot + inbound chan *toot + recentlySeen +} + +type tootHash string + +type seenTootMemo struct { + lastSeen time.Time + tootHash tootHash } func newTootIngester() *tootIngester { - ti := new(tootIngester) - ti.inbound = make(chan *toot, 1) - return ti + ti := new(tootIngester) + ti.inbound = make(chan *toot, 1) + return ti } func (ti *tootIngester) getDeliveryChannel() chan *toot { - return ti.inbound + return ti.inbound } func (ti *tootIngester) ingest() { log.Info().Msg("tootIngester starting") - for { - time.Sleep(1 * time.Second) // FIXME do something - } + for { + time.Sleep(1 * time.Second) // FIXME do something + } } diff --git a/instance.go b/instance.go index 727bbb9..74b6012 100644 --- a/instance.go +++ b/instance.go @@ -170,8 +170,8 @@ func (i *instance) nodeIdentified() bool { func (i *instance) detectNodeTypeIfNecessary() error { if !i.nodeIdentified() { return i.fetchNodeInfo() - } - return nil + } + return nil } func (i *instance) registerError() { diff --git a/locator.go b/locator.go index d8af1cd..3efaf22 100644 --- a/locator.go +++ b/locator.go @@ -37,7 +37,7 @@ type InstanceLocator struct { pleromaIndexNextRefresh *time.Time mastodonIndexNextRefresh *time.Time reportInstanceVia chan InstanceHostname - mu sync.Mutex + mu sync.Mutex } func newInstanceLocator() *InstanceLocator { @@ -49,11 +49,11 @@ func newInstanceLocator() *InstanceLocator { } func (il *InstanceLocator) lock() { - il.mu.Lock() + il.mu.Lock() } func (il *InstanceLocator) unlock() { - il.mu.Unlock() + il.mu.Unlock() } func (il *InstanceLocator) addInstanceNotificationChannel(via chan InstanceHostname) { @@ -151,8 +151,8 @@ func (il *InstanceLocator) locateMastodon() { return } - log.Info(). - Msg("fetched mastodon index") + log.Info(). + Msg("fetched mastodon index") defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) diff --git a/manager.go b/manager.go index dc64ef9..3cf9a28 100644 --- a/manager.go +++ b/manager.go @@ -19,7 +19,7 @@ type InstanceManager struct { mu sync.Mutex instances map[InstanceHostname]*instance newInstanceNotifications chan InstanceHostname - newToots chan *toot + newToots chan *toot startup time.Time hostAdderSemaphore chan bool } @@ -32,7 +32,7 @@ func newInstanceManager() *InstanceManager { } func (im *InstanceManager) addTootDestination(td chan *toot) { - im.newToots = td + im.newToots = td } func (im *InstanceManager) logCaller(msg string) { @@ -99,7 +99,7 @@ func (im *InstanceManager) managerLoop() { } im.unlock() - // FIXME is this a bug outside of the mutex above? + // FIXME is this a bug outside of the mutex above? for _, v := range il { go func(i *instance) { i.Tick() @@ -120,7 +120,7 @@ func (im *InstanceManager) hostnameExists(newhn InstanceHostname) bool { func (im *InstanceManager) addInstanceByHostname(newhn InstanceHostname) { if im.hostnameExists(newhn) { - // ignore adding new if we already know about it + // ignore adding new if we already know about it return } @@ -150,7 +150,7 @@ func (im *InstanceManager) receiveNewInstanceHostnames() { newhn = <-im.newInstanceNotifications // receive them fast out of the channel, let the adding function lock to add // them one at a time, using a bunch of blocked goroutines as our - // modification queue + // modification queue go im.addInstanceByHostname(newhn) } }