Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untangle client and server #4861

Merged
merged 95 commits into from Apr 27, 2024
Merged

Untangle client and server #4861

merged 95 commits into from Apr 27, 2024

Commits on Apr 21, 2024

  1. wip: msg

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    3eb1913 View commit details
    Browse the repository at this point in the history
  2. wip: searchquery

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    68ba13c View commit details
    Browse the repository at this point in the history
  3. wip sharedmsg in client

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    b67e469 View commit details
    Browse the repository at this point in the history
  4. move chan enums

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    3f0ee6a View commit details
    Browse the repository at this point in the history
  5. shared: extract chan + user

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    d0b71ab View commit details
    Browse the repository at this point in the history
  6. mention

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    d716402 View commit details
    Browse the repository at this point in the history
  7. network

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    12a0b0b View commit details
    Browse the repository at this point in the history
  8. wip: config

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    f0ee3be View commit details
    Browse the repository at this point in the history
  9. Use SharedTypes

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    383907c View commit details
    Browse the repository at this point in the history
  10. changelog: don't type assert to a broken type

    The mandatory fields are unset, stop lying to the compiler
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    4d23760 View commit details
    Browse the repository at this point in the history
  11. changelog data type

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    7bc184b View commit details
    Browse the repository at this point in the history
  12. configuration

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    8e6920a View commit details
    Browse the repository at this point in the history
  13. fix msg event

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    7073584 View commit details
    Browse the repository at this point in the history
  14. chatuserlist

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    88c8830 View commit details
    Browse the repository at this point in the history
  15. import fix

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    194b4e1 View commit details
    Browse the repository at this point in the history
  16. searchresponse

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    3217536 View commit details
    Browse the repository at this point in the history
  17. further chan fixes

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    e57e547 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    e43cbb1 View commit details
    Browse the repository at this point in the history
  19. unused import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    6984e8f View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    636b5c5 View commit details
    Browse the repository at this point in the history
  21. Some whitespace is good mkey

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9aee3e3 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    c869ea9 View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    b89b0ca View commit details
    Browse the repository at this point in the history
  24. fix missing import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    fceffd4 View commit details
    Browse the repository at this point in the history
  25. fix bad typing

    There were quite some errors, where the type was passed the wrong way
    ```
    // This is invalid
    "change-password": ({ old_password: string, new_password: string, verify_password: string})
    
    // What was actually meant
    "change-password": (data: { old_password: string, new_password: string, verify_password: string})
    ```
    
    The whole callback function is also very verbose as is, with fluff we don't need.
    It's always a function that returns void, so there's no real information to be gained
    by spelling it out time and time again.
    
    Let's use a helper type that just accepts the payload.
    That should make the above error impossible to do.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    e9ef59b View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    843db17 View commit details
    Browse the repository at this point in the history
  27. Split sort event

    The sort event bundled networks and channels for no reason at all.
    They share none of the actual logic, so combining them just makes
    the typing poor but serves no benefit.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    0067c30 View commit details
    Browse the repository at this point in the history
  28. wip: unbork init progress

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    f5c691f View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    0660a87 View commit details
    Browse the repository at this point in the history
  30. socket-events: fix up init

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9ab9ad0 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    5621538 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    46f3fd9 View commit details
    Browse the repository at this point in the history
  33. server: fix init client

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    60486bf View commit details
    Browse the repository at this point in the history
  34. fix search event params

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    a8e7022 View commit details
    Browse the repository at this point in the history
  35. remove obsolete import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    98452cc View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    e15b121 View commit details
    Browse the repository at this point in the history
  37. type Server

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    5ee9c2b View commit details
    Browse the repository at this point in the history
  38. network event: remove unused array

    All the network events only ever emit a single copy
    There's no point in wrapping it into an array
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    bf7eb0e View commit details
    Browse the repository at this point in the history
  39. client: properly type the emit method

    This breaks the world -.-
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    35e38d1 View commit details
    Browse the repository at this point in the history
  40. fix join socket type

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9c4d24d View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    1c4ce5d View commit details
    Browse the repository at this point in the history
  42. publicClient: add FIXME and ignore the type mismatch

    The publicClient interface is utterly horrific.
    It allows any client to inject arbitrary events into the socket.io
    event stream.
    This should get wrapped into a "plugin" event so that it can get properly
    typed, better yet, this should get removed completely.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    c20cd6b View commit details
    Browse the repository at this point in the history
  43. fix socket-event: network

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    fe4f497 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    3ea5170 View commit details
    Browse the repository at this point in the history
  45. Configuration menu
    Copy the full SHA
    29750a3 View commit details
    Browse the repository at this point in the history
  46. socket-events/msg: if/else chains are not a switch replacement

    If we switch on a field, use switch for god's sake.
    If/elif chains are for cases where you have multiple selectors.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    1565eb8 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    42ea66c View commit details
    Browse the repository at this point in the history
  48. Configuration menu
    Copy the full SHA
    300bd4c View commit details
    Browse the repository at this point in the history
  49. fix more

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    bfca0ca View commit details
    Browse the repository at this point in the history
  50. remove dead import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    7287c6b View commit details
    Browse the repository at this point in the history
  51. socket-events: fix join

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    5003764 View commit details
    Browse the repository at this point in the history
  52. store: fix import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    14b9169 View commit details
    Browse the repository at this point in the history
  53. Configuration menu
    Copy the full SHA
    4d0474b View commit details
    Browse the repository at this point in the history
  54. add socket-events import to entry point

    socket-events aren't ever imported, if we don't do that however
    webpack never actually sees any code that leads to it and skips
    bundling it.
    
    So for now, do an import that has the side effect of registering
    all the events until we have a proper registration in place that's
    a bit more sane to call
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    0311e5f View commit details
    Browse the repository at this point in the history
  55. fix mentions import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    17ba07d View commit details
    Browse the repository at this point in the history
  56. fix mentions

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9f2c82e View commit details
    Browse the repository at this point in the history
  57. add todo

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9898f38 View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    bb7c392 View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    540144c View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    4614c35 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    a4afa08 View commit details
    Browse the repository at this point in the history
  62. Configuration menu
    Copy the full SHA
    b8a9fe0 View commit details
    Browse the repository at this point in the history
  63. ignore: keep happy path on the left

    It is much easier to follow the control flow if error checks
    are done on the indented path, immediately returning.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    5274fdc View commit details
    Browse the repository at this point in the history
  64. ignore: move ignorelist to its own command

    ignorelist shares no logic with /ignore or /unignore so it shouldn't
    share a file. That just makes typing awkward.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    071a5af View commit details
    Browse the repository at this point in the history
  65. ignore: clean up the types and conditionals

    Now that ignorelist doesn't muddy the waters, we can clean up
    all the funny conditional types and enforce `when`
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    b8400a3 View commit details
    Browse the repository at this point in the history
  66. ignore: remove dead import

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    917fdb2 View commit details
    Browse the repository at this point in the history
  67. Configuration menu
    Copy the full SHA
    c3fc54e View commit details
    Browse the repository at this point in the history
  68. Configuration menu
    Copy the full SHA
    5c8951f View commit details
    Browse the repository at this point in the history
  69. cap: type the boolean

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    edb96f6 View commit details
    Browse the repository at this point in the history
  70. kick: use the user object

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    92a0aff View commit details
    Browse the repository at this point in the history
  71. Configuration menu
    Copy the full SHA
    e2b56cf View commit details
    Browse the repository at this point in the history
  72. publicClient: type fix

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    8c41356 View commit details
    Browse the repository at this point in the history
  73. Configuration menu
    Copy the full SHA
    5001d60 View commit details
    Browse the repository at this point in the history
  74. server: somewhat type fix auth related functions

    The auth functions are a bloody mess and need to be cleaned up.
    using various callback functions and using variables as pointers makes the logic
    hard to follow and hence idiotic to type too, as multiple orthogonal logic paths
    are mixed up into one function.
    
    This really needs to be untangled
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    e61e356 View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    82e4150 View commit details
    Browse the repository at this point in the history
  76. sharedMsg: remove userAway

    userAway is purely server side and we don't send it to the client
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    fc98055 View commit details
    Browse the repository at this point in the history
  77. Configuration menu
    Copy the full SHA
    4b07e05 View commit details
    Browse the repository at this point in the history
  78. Configuration menu
    Copy the full SHA
    96848c1 View commit details
    Browse the repository at this point in the history
  79. Configuration menu
    Copy the full SHA
    f25fee4 View commit details
    Browse the repository at this point in the history
  80. test/client: fix import path

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    4ceafb6 View commit details
    Browse the repository at this point in the history
  81. fix mode tests

    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    31d9872 View commit details
    Browse the repository at this point in the history
  82. Configuration menu
    Copy the full SHA
    1edb5a7 View commit details
    Browse the repository at this point in the history
  83. Configuration menu
    Copy the full SHA
    c866430 View commit details
    Browse the repository at this point in the history
  84. Configuration menu
    Copy the full SHA
    5e444be View commit details
    Browse the repository at this point in the history
  85. Configuration menu
    Copy the full SHA
    7f5e0f3 View commit details
    Browse the repository at this point in the history
  86. Configuration menu
    Copy the full SHA
    03151e0 View commit details
    Browse the repository at this point in the history
  87. Configuration menu
    Copy the full SHA
    6241eed View commit details
    Browse the repository at this point in the history
  88. Configuration menu
    Copy the full SHA
    6c9d2c3 View commit details
    Browse the repository at this point in the history
  89. components/MessageTypes/errors: fix eslint errors

    This makes the code somewhat ugly, but to properly fix we need
    to enforce the needed fields
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    91ac363 View commit details
    Browse the repository at this point in the history
  90. test/chan: getFilteredClone has more fields than the test thinks

    The codebase shoves various things into channel objects to transmit them
    for things like channel lists etc.
    
    This however means that the type does contains the fields and needs
    to export them.
    
    We should clean up the events so that we can get rid of all that.
    But for now, we adapt the test expectation to reality.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    a200bab View commit details
    Browse the repository at this point in the history
  91. test/chan: remove users field from test

    The client side fetches the user list when needed, we don't send
    it over from the server.
    Hence modify the test expectation.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    5567f07 View commit details
    Browse the repository at this point in the history
  92. test: token in init event payload is undefined not null

    Doesn't matter which, code happens to emit undefined.
    Adapt test expectation over writing strange || null code.
    The conditional just checks for a falsey value.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    8372c5a View commit details
    Browse the repository at this point in the history
  93. Configuration menu
    Copy the full SHA
    1ec67a6 View commit details
    Browse the repository at this point in the history
  94. NetworkForm: disable unsafe return lints for now

    The NetworkForm type is wrong, hence the compiler can't infer the type.
    This needs quite some changes, so for now we just turn the linter off
    for the 2 watch functions.
    The whole component is too dynamic to fix easily.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    36cb75e View commit details
    Browse the repository at this point in the history
  95. server: don't throw in async callback from index requests

    This was flagged as an issue by codeQL
    
    > Server crash [High]
    > The server of this route handler will terminate when an
    > uncaught exception from this location escapes an
    > asynchronous callback.
    brunnre8 committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    8eb398c View commit details
    Browse the repository at this point in the history