seenit

package module
v0.0.0-...-7f5931b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2021 License: MIT Imports: 16 Imported by: 0

README

seenit - a perceptual-hash-based repost checker

What?

seenit is a repost checker. Punch in the name of a community and upload an image, and it'll tell you if someone else has already done the same. You'll never have to worry about reposts in the meme chat again! It's also uses a basic form of perceptual hashing, so it'll handle resizing and things like JPEG compression fairly well.

Why?

Because I had one too many memes of mine reposted in a particular chat and decided enough was enough, and needed a project to show off my neumorphic CSS library anyway. Don't worry about it.

Screenshots

Screenshot

Building

The included Dockerfile is the intended way to go about doing things. For persisting information (seen hashes, etc.), there will be a /seenit/storage/database.db file in the container that you can mount and save. You can also change the directory and filename of the database by setting the SEENIT_DATABASE_PATH environment variable, which is set by default to the aforementioned path.

License

seenit is licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HaveSeen

func HaveSeen(community string, hash string, db Database) (bool, error)

func ImageToHash

func ImageToHash(img image.Image) (string, error)

func RecordHash

func RecordHash(community string, hash string, db Database) error

func RenderLanding

func RenderLanding(communities []Community, w io.Writer) error

func RenderSeen

func RenderSeen(w io.Writer) error

func RenderUnseen

func RenderUnseen(w io.Writer) error

func RenderUpload

func RenderUpload(community string, w io.Writer) error

func ServeLanding

func ServeLanding(w http.ResponseWriter, r *http.Request)

func ServeResult

func ServeResult(db Database, w http.ResponseWriter, r *http.Request)

func ServeUpload

func ServeUpload(w http.ResponseWriter, r *http.Request)

Types

type BoltBucket

type BoltBucket struct {
	// contains filtered or unexported fields
}

func (*BoltBucket) Get

func (b *BoltBucket) Get(key string) (string, error)

func (*BoltBucket) Has

func (b *BoltBucket) Has(key string) (bool, error)

func (*BoltBucket) Put

func (b *BoltBucket) Put(key string, val string) error

type BoltDatabase

type BoltDatabase struct {
	// contains filtered or unexported fields
}

func NewBoltDatabase

func NewBoltDatabase(filename string) (*BoltDatabase, error)

func (*BoltDatabase) Close

func (d *BoltDatabase) Close() error

func (*BoltDatabase) GetBucket

func (d *BoltDatabase) GetBucket(name string) (Bucket, error)

type BoundHandler

type BoundHandler func(w http.ResponseWriter, r *http.Request)

func BindHandler

func BindHandler(h Handler, db Database) BoundHandler

type Bucket

type Bucket interface {
	Has(key string) (bool, error)
	Get(key string) (string, error)
	Put(key string, val string) error
}

type Community

type Community struct {
	Name string
}

type Database

type Database interface {
	GetBucket(name string) (Bucket, error)
}

type Handler

type Handler func(db Database, w http.ResponseWriter, r *http.Request)

type MockBucket

type MockBucket struct {
	Entries map[string]string
}

func (*MockBucket) Get

func (b *MockBucket) Get(key string) (string, error)

func (*MockBucket) Has

func (b *MockBucket) Has(key string) (bool, error)

func (*MockBucket) Put

func (b *MockBucket) Put(key string, val string) error

type MockDatabase

type MockDatabase struct {
	Buckets map[string]MockBucket
}

func (*MockDatabase) GetBucket

func (d *MockDatabase) GetBucket(name string) (Bucket, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL