modulepackage
0.0.0-20241017230542-2498ff2afc5e
Repository: https://github.com/cosi-lab/go-talks.git
Documentation: pkg.go.dev
# README
go-talks
Another rewrite of talks, this time in go.
go-talks (Or more commonly known as just Talks) is an app to manage talks at COSI meetings. It allows people to submit talks that they are planning on giving at upcoming meetings.
Features
- Live updating over websocket
- The page will load without Javascript
- Markdown support
- /posts directory supports rendering pre-written markdown files
- Image caching/proxying
- Create future talks and view historic talks
- Backed by an append only log database
Endpoints
Request | Endpoint | Desc |
---|---|---|
GET | / | The talks homepage |
GET | /talks | JSON of the talks for the next meeting |
GET | /{week} | The talks for the given week |
GET | /{week}/talks | JSON of the talks for a week |
GET | /img/{id} | Image proxy |
GET | /health | Indicates how many active connections there are |
GET | /ws | Websocket endpoint |
# Functions
NewNetworks creates a new Networks struct from a slice of subnets.
NewTalks creates a new talks object, loading the talks from the given reader and writing new events to the given writer.
Now returns a JSONTime with the time from time.Now().
ParseConfig parses a TOML config file and returns a Config struct.
# Constants
AfterMeetingSlot holding events that happen after the meeting.
Announcement are for..
AUTH communicates authentication request/response.
Create is the talk creation event {type: "create", create: {id: 1, name: "foo", ...}.
Delete is the talk deletion event {type: "delete", delete: {id: 1}}.
DELETE deletes a talk.
ForumTopic are for general lab discussion.
Hide is the talk hiding event {type: "hide", hide: {id: 1}}.
HIDE hides a talk.
LightningTalk are for short (5-10 minute) talks.
NEW creates a new talk.
ProjectUpdate are quick updates regarding ongoing projects.
SYNC requests a sync of the talks.
UnknownEvent is for when we can't parse the event type.
# Structs
AuthMessage gives the client the password to authenticate.
Client is a middleman between the websocket connection and the hub.
Config is the configuration for go-talks.
CreateTalkEvent is created when a talk is created.
DeleteMessage gives the client the ID of the talk to delete.
DeleteTalkEvent is created when a talk is deleted.
HideMessage gives the client the ID of the talk to hide.
HideTalkEvent is created when a talk is hidden.
Hub maintains a set of active clients and broadcasts messages to the clients.
Image is what we store in the cache.
JSONTime is a Wrapper for time.Time struct with custom JSON behavior matching sqlite's datetime format.
Message is the format of messages sent between the client and server Since go doesn't have the strongest type system we pack every message into a single struct.
Networks is a slice of net.IPNet.
NewMessage gives the client all the information needed to add a new talk to the page.
Post contains the information needed to render a markdown post.
SyncMessage starts and caps off a sync.
Talk is the resulting type produced by the database.
TalkEvent is stored in the database.
Talks stores all it's data in an append-only log.
TemplateResponse contains the information needed to render the past and future templates.
# Type aliases
MessageType are the types of messages that can be sent/received.
TalkEventType is an enum of the different types of events.
TalkType is the type of talk.