diff options
| author | Kyren223 <kyren223@proton.me> | 2025-08-05 17:01:05 +0300 |
|---|---|---|
| committer | Kyren223 <kyren223@proton.me> | 2025-08-05 17:01:05 +0300 |
| commit | 7b1ee08d61c77da12f139881631ddb94bb3e6647 (patch) | |
| tree | eb269273170a511b52b44b00a3bd35656f1a6d0f | |
| parent | 274dee5b25ed249492faeea1c0a4e33aa26cb60c (diff) | |
Updated todos and notes
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | internal/client/ui/auth/auth.go | 6 | ||||
| -rw-r--r-- | internal/client/ui/core/core.go | 1 | ||||
| -rw-r--r-- | internal/client/ui/core/state/state.go | 40 | ||||
| -rw-r--r-- | internal/client/ui/tosscreen/tosscreen.go | 4 | ||||
| -rw-r--r-- | internal/client/ui/viminput/viminput.go | 14 | ||||
| -rw-r--r-- | internal/server/api/api.go | 6 | ||||
| -rw-r--r-- | internal/server/server.go | 13 | ||||
| -rw-r--r-- | pkg/snowflake/snowflake.go | 2 |
9 files changed, 22 insertions, 66 deletions
@@ -11,8 +11,6 @@ The Discord alternative for Terminal nerds. -TODO(kyren): replace screenshot with tape (or have both?) - <p> <img src="./assets/eko-screenshot.png" width="100%" alt="Eko Showcase"> </p> diff --git a/internal/client/ui/auth/auth.go b/internal/client/ui/auth/auth.go index 27d9377..453e423 100644 --- a/internal/client/ui/auth/auth.go +++ b/internal/client/ui/auth/auth.go @@ -98,8 +98,8 @@ ___] | |__] | \| | | \|`) ) func init() { - // HACK: to avoid a circular dependency, so core can transition to this - // I don't like how go has this issue, I would rather slower compilations + // HACK(kyren): to avoid a circular dependency + // so core can transition to this model ui.NewAuth = func() tea.Model { return New() } @@ -159,7 +159,7 @@ func New() Model { m.SetSignup(false) - m.Update(nil) // HACK: force an update + m.Update(nil) // HACK(kyren): force an update return m } diff --git a/internal/client/ui/core/core.go b/internal/client/ui/core/core.go index 3ccc67f..bd4fb73 100644 --- a/internal/client/ui/core/core.go +++ b/internal/client/ui/core/core.go @@ -180,7 +180,6 @@ func (m Model) View() string { return m.tos.View() case ConnectedAcceptedTos: - // TODO(kyren): auth return m.loading.View() case Authenticated: diff --git a/internal/client/ui/core/state/state.go b/internal/client/ui/core/state/state.go index ad2b711..ca1b66c 100644 --- a/internal/client/ui/core/state/state.go +++ b/internal/client/ui/core/state/state.go @@ -212,7 +212,7 @@ func UpdateMessages(info *packet.MessagesInfo) { Users: unknownUsers, }) - // Note: this is a naive approach + // NOTE(kyren): this is a naive approach // Ideally we check each message that was added/removed // For the frequency/receiver/sender id and only remove that // But it can be very slow when there are thousands of messages @@ -340,7 +340,7 @@ func UpdateNotifications(info *packet.NotificationsInfo) []snowflake.ID { // When someone messages you, and you don't have a signal with him // already, add a signal with him so you see his messages - // PERF: IsFrequency is expensive so contains is checked first + // PERF(kyren): IsFrequency is expensive so contains is checked first if !slices.Contains(Data.Signals, source) && !IsFrequency(source) { signals = append(signals, source) } @@ -402,42 +402,6 @@ func SendFinalData() { case <-done: log.Println("All final writes completed successfully") } - - // HACK: Give a small grace period for the writes to be processed - // Tweak this value as needed - // time.Sleep(20 * time.Millisecond) - - // TODO: - // I think the issue is that it's random which of these 2 requests goes - // first (bcz it only does the first request after the client disconnects) - // I could fix it server side but eh maybe not - // this should instead use a method that blocks until a response was - // received, which may need a new gateway method to do that as currently - // it just always sends to the prograg - // If this is tedious enough it might be worth it to just do it on the - // server side - - // Also later on I should probably remove the calculate notifs in core - // it can be replaced with just diff-ing incoming notifs - // this will most likely work fine although there are some issues with - // scopes like becoming an admin/no longer being admin or gaining - // or losing access to frequencies and of course msg deletions - // But it's probably the right approach (also WAYYYYYY faster) - - // Then there is also the issue of when switching to a frequency - // not yet receiving the history so it says "no keep" bcz it's not loaded - // but with history it would've said "yes keep" so the solutin would - // be to rework it quite a bit to make it stateless or smthing - // Then that should be most issues when it comes to notifications - // just need to make sure local/remote notifs reset properly when - // reaching the bottom - - // log.Println("BLOCKING...") - // <-ctx.Done() - // log.Println("CTX DANZO") - - // TODO: remove this before release - // assert.NoError(ctx.Err(), "context has ran out of time!") } func UpdateBlockedUsers(info *packet.BlockInfo) { diff --git a/internal/client/ui/tosscreen/tosscreen.go b/internal/client/ui/tosscreen/tosscreen.go index 8591af2..af0d77b 100644 --- a/internal/client/ui/tosscreen/tosscreen.go +++ b/internal/client/ui/tosscreen/tosscreen.go @@ -128,10 +128,10 @@ func (m *Model) updateContent() { glamour.WithWordWrap(lineWidth), ) content := m.content - content = strings.ReplaceAll(content, "@", "") // HACK: workaround to remove mailto links + content = strings.ReplaceAll(content, "@", "") // HACK(kyren): workaround to remove mailto links content, err := r.Render(content) assert.NoError(err, "this should never error") - content = strings.ReplaceAll(content, "", "@") // HACK: workaround to remove mailto links + content = strings.ReplaceAll(content, "", "@") // HACK(kyren): workaround to remove mailto links m.vp.SetContent(content) } diff --git a/internal/client/ui/viminput/viminput.go b/internal/client/ui/viminput/viminput.go index b4f7f4a..178bce5 100644 --- a/internal/client/ui/viminput/viminput.go +++ b/internal/client/ui/viminput/viminput.go @@ -405,7 +405,7 @@ func (m *Model) handleKeys(key tea.KeyMsg) { m.handleNormalModeKeys(key) m.Save() case InsertMode: - // Note: we don't want to save on insert mode + // NOTE(kyren): we don't want to save on insert mode // That'd mean it'd save on every keystroke which will // be very annoying m.handleInsertModeKeys(key) @@ -582,7 +582,7 @@ func (m *Model) handleNormalModeKeys(key tea.KeyMsg) { runeLines = append(runeLines, []rune(line)) } - // Note: caps to line length, needed for len=0 col=0 + // NOTE(kyren): caps to line length, needed for len=0 col=0 splittingCol := min(m.cursorColumn+1, len(line)) line := m.lines[m.cursorLine] after := line[splittingCol:] @@ -696,12 +696,12 @@ func (m *Model) handleInsertModeKeys(key tea.KeyMsg) { return } - // Note: commented out because enter is used to send a message + // NOTE(kyren): commented out because enter is used to send a message // even in insert mode, an alternative that discord uses is // to use Shift+Enter for this functionality but unfortunately // this is not supported in bubbletea (probably due to terminal limitations) - // If there is a way to add this for Shift+Enter please notify me - // at Kyren223@proton.me + // If there is a way to add this for Shift+Enter please open an issue + // or a pull request and notify me, or email Kyren223@proton.me // if key.Type == tea.KeyEnter { // line := m.lines[m.cursorLine] @@ -1946,7 +1946,7 @@ func (m *Model) handleVisualModeKeys(key tea.KeyMsg) { if motion == "p" { m.Yank(copyOfPaste) // Restore } - // Note: we don't restore for "P" because we use it like + // NOTE(kyren): we don't restore for "P" because we use it like // <leader>p (we paste over and keep what we had) // Shift+P in visual mode is pretty useless/uncommon // So using that instead of adding <leader>p makes more sense @@ -2066,7 +2066,7 @@ func (m *Model) handleVisualLineModeKeys(key tea.KeyMsg) { if motion == "p" { m.Yank(copyOfPaste) // Restore } - // Note: we don't restore for "P" because we use it like + // NOTE(kyren): we don't restore for "P" because we use it like // <leader>p (we paste over and keep what we had) // Shift+P in visual mode is pretty useless/uncommon // So using that instead of adding <leader>p makes more sense diff --git a/internal/server/api/api.go b/internal/server/api/api.go index 2a0452a..9828af6 100644 --- a/internal/server/api/api.go +++ b/internal/server/api/api.go @@ -589,7 +589,7 @@ func DeleteNetwork(ctx context.Context, sess *session.Session, request *packet.D return &ErrInternalError } - // NOTE: important check, make sure they are the owner (authorized) + // NOTE(kyren): important check, make sure they are the owner (authorized) if network.OwnerID != sess.ID() { return &ErrPermissionDenied } @@ -1148,7 +1148,7 @@ func EditMessage(ctx context.Context, sess *session.Session, request *packet.Edi return &ErrInternalError } - // Note: it is possible to edit your messages in any context + // NOTE(kyren): it is possible to edit your messages in any context // regardless if you are in the network or if you have access to // the frequency (or a user signal), as long as you know the message ID // This should be fine but may be changed later to be more strict @@ -1640,7 +1640,7 @@ func Authenticate(ctx context.Context, sess *session.Session, request *packet.Au sess.Manager().AddSession(sess, user.ID, request.PubKey) - // NOTE: as per the protocol, this must be the first message after auth + // NOTE(kyren): as per the protocol, this must be the first message after auth payload := &packet.UsersInfo{Users: []data.User{user}} ok := sess.Write(ctx, payload) if !ok { diff --git a/internal/server/server.go b/internal/server/server.go index 9794038..bdfba15 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -362,7 +362,7 @@ func (server *server) handleConnection(conn net.Conn) { slog.InfoContext(ctx, "processor done") }() - // NOTE: IMPROTANT LEGAL STUFF + // NOTE(kyren): IMPROTANT LEGAL STUFF // Sending this first thing, before client sends us any data sendTosInfo(ctx, sess) @@ -552,15 +552,10 @@ func timeout[T packet.Payload]( apiRequest func(context.Context, *session.Session, T) packet.Payload, ctx context.Context, sess *session.Session, request T, ) packet.Payload { - // TODO(kyren): Remove the channel and just wait directly? - // No - We need to use a channel so timeout works properly + // NOTE(kyren): We need to use a channel so timeout works properly responseChan := make(chan packet.Payload) - // TODO: Check if this is now fixed after the rewrite: - // currently just ignoring the given context - // this fixes the issue where the client disconnects so the server - // doesn't bother and cancels the request - ctx, cancel := context.WithTimeout(ctx, timeoutDuration) // no longer ignoring + ctx, cancel := context.WithTimeout(ctx, timeoutDuration) defer cancel() go func() { @@ -607,7 +602,7 @@ func TokensPerRequest(requestType packet.PacketType) float64 { case packet.PacketDeviceAnalytics: return 0.2 // arbitrary - // TODO: once I get more data for these, add them + // TODO(kyren): once I get more data for these, add them case packet.PacketBlockUser: case packet.PacketCreateFrequency: case packet.PacketCreateNetwork: diff --git a/pkg/snowflake/snowflake.go b/pkg/snowflake/snowflake.go index 8a281de..be56631 100644 --- a/pkg/snowflake/snowflake.go +++ b/pkg/snowflake/snowflake.go @@ -27,7 +27,7 @@ import ( const ( // Epoch is set to the twitter snowflake epoch of Nov 04 2010 01:42:54 UTC in milliseconds - // TODO: change this to eko epoch when eko is production ready + // TODO(kyren): change this to eko epoch when eko is production ready Epoch int64 = 1288834974657 nodeBits = 10 stepBits = 12 |
