Commit Graph

942 Commits

Author SHA1 Message Date
shockrahwow
bb55832064 + Adding roadmap
* Hopefully fixing pipeline script
Cargo kept trying to rebuild everything so hopefully the new change
forces a usage of artifacts that _should_ be there
2021-05-08 21:28:43 -07:00
shockrah
5d0f02507b - Removing build-keys job
Was basically pointless since it's literally just two commands

! full-mock-test job now has scripts/run-api-tests.sh as its source code
This makes it way easier to debug the pipeline when things go wrong as there's
lots of _different_ things going on in that script.
While the script itself is still there it is completely deprecated and safe to remove
at this point

! PAIN Peko
Dependancies might be fucked because gitlab-runner doesn't use deps at all and frankly
I'm completely over doing this stupid patch. Next is decentralized features which is way
more fun to do so if it breaks I'll fix it but its likely an issue with artifacts
2021-05-03 13:30:52 -07:00
shockrah
f094ab49de * Adding some safey into the mock-client tester so that it doesn't just explode in pipelines 2021-05-03 13:24:24 -07:00
shockrah
7c8bc8b4fc - Removing warning
! Increasing wait time on client mock script to avoid firing too early
2021-05-01 19:16:18 -07:00
shockrah
11d1652467 * Fixing push/popd path typo
* Removing export command from cargo-unit-test job
This was causing the job to fail so the env vars have been moved to live under
the ci file's job-level variables key
2021-05-01 17:13:32 -07:00
shockrah
f845f1e1ec + Adding missing args to build-sh script call 2021-05-01 16:56:25 -07:00
shockrah
1dcdbbaec4 Setting env variables for cargo test job 2021-05-01 16:52:33 -07:00
shockrah
1cf95f1f27 * Fixed issue with npm build that was supposed to be npm install 2021-05-01 16:28:59 -07:00
shockrah
4218bc396a - Removing changes tracker for now
! Even though this mains we're going to cargo build a lot more than normal
it also means pipeline status won't be fucked for no reason(hopefully)
2021-05-01 16:16:08 -07:00
shockrah
5498766c1e + Adding in script to setup python package requirements
* Also I've updated the docker image that this pipeline uses as it didn't have node
and pip installed for some reason
Link to relevant docker image: https://hub.docker.com/r/shockrah/fc-pipeline
2021-05-01 15:46:17 -07:00
shockrah
1805023afd * Changing target docker to pipeline docker image
* Increasing expries_in flags to be 30 minutes from 15
+ Adding build-keys job which builds hmac keys
+ build-rtc-server: simple build job
* Moving cargo-test-json-api (unit tests) to the bottom with the other tests

! full-mock-tests are now implemented so its time to watch them fail horribly
2021-05-01 15:10:18 -07:00
shockrah
f6e6c59837 * Fixing privileges issue in db user 2021-04-29 22:15:32 -07:00
shockrah
db67caab96 * Fixing issue where the proper db isn't selected 2021-04-29 22:01:19 -07:00
shockrah
4b47eca257 * Fixing pathing on migrations directory
* Moving all sql logs to their own log file to avoid cluttering stdout with things
that aren't relevant to the immediate goal here
2021-04-29 21:49:36 -07:00
shockrah
85660e2fc9 - Removing old scripts that aren't useful to anyone but myself
+ Adding new bootstrapping script for Docker testing pipeline
This build-database script is what is going to setup things like our tables for us
so that we can actually run our test queries

! Basically turning off the ci right now since its going through some large breaking changes
It's going to be broken for a while so there's no point in running it into
a wall of predictable failures
2021-04-29 21:32:43 -07:00
shockrah
44bfed1351 * Moving script to /scripts/ 2021-04-27 13:41:20 -07:00
shockrah
32eb669f96 * messages.recent_messages now uses the /message/recent
This should be more clear in its intentions and basically gives the behavior
you expect when looking at this method
2021-04-27 13:40:12 -07:00
shockrah
e0d5b8b5f7 + Adding back the test script so its ready for ci 2021-04-27 13:28:15 -07:00
shockrah
34426038d9 * Fixing busted invite test in api client tester
+ Adding some more invite status checks
+ Adding a verbose invite usage check for sanity reasons

- Removing run-api-tests script as it now goes into the /scripts/ directory

+ Adding the wss-hmac setup from the command line arg
It was literally just 1 if statement that I forgot to write in
2021-04-27 13:27:39 -07:00
shockrah
2a1881db20 + Adding commandline parameter parser for specifying wss-hmac and api-hmac
The respective flags are -w|--wss-hmac and -H|--hmac
Default values are wss-hmac.secre hmac.secrett respectively
2021-04-27 13:24:59 -07:00
shockrah
61a3f1d4f5 + Adding first pass of a pair of invite endpoint tests 2021-04-26 02:01:04 -07:00
shockrah
c9658ad5b4 + Adding command line flag [-H/--hmac] to specify hmac file path
This is really just for testing purposes since the files tend to be in
awkward to reach path

- Removing if args.len == 0 check
Basically cannon-fodder tbh

* Auth now reads hmac path from environment var

! All of the above is added for the wss hmac as well

+ Adding command line flag [-W/--wss-hmac] to specify wss-hmac file path
2021-04-26 01:58:18 -07:00
shockrah
1ee2f1a321 + Adding argparse to dependancy list 2021-04-26 01:34:29 -07:00
shockrah
225a874f5d Ignoring secret hmac files 2021-04-25 12:40:53 -07:00
shockrah
90b584eaa2 * Fixing /invites/join as it was returning the wrong struct data 🤦
Secret value given to user was literally the encrypted secret because I forgot
to rebind it

- removing dev key lmaoooo
These are generated super easily and this key doesn't actually go to anything
so its really not a problem, although it is annoying that its there
2021-04-25 12:40:08 -07:00
shockrah
e2e68c51ba - Removing old client test code in favor of new structure
+ Moving tests to the new client
- Removing web/ module
! Currently all tests are passing 17/17 but the real trickery comes with doing this
on CI which should will likely take some magic somewhere
Or we'll just extend the freechat docker image to finally have all the required
dependancies and just test on that with diesel and what not
2021-04-21 21:38:25 -07:00
shockrah
9ab9cdb176 + db-lib::Channel::get added and Returns a Result<Option<Channel>> for simplicity
This is really only for check if a particular channel exists for /messages/recent's backend

* Flattening db-lib::Message::last_n
SHould make code more readable as it now has a more linear flow

* api::Messages::recent_messages now 404's when a channel that doesn't exist is request
2021-04-21 21:33:30 -07:00
shockrah
432e94054f Fixing minor errors that were preventing tests fro mbeing ran oops :p 2021-04-21 17:23:00 -07:00
shockrah
38ff0edd39 ! Massive test suite overhaul see details below !
Problem: the old test suite was extremely inflexible
This meant that making new tests took way too much time.

+ This new rework makes the new client's backend much thinner and less "magical"
With less magic going on we can pass way more data more easily to the actual
http-request engine making the convenience wrapper over top it much more flexible

Translating old tests to the new engine might take a while but for now the old
client codebase is completely deprecated and will no longer be used+updated
2021-04-21 17:22:16 -07:00
shockrah
c4d7eb9111 * api::channels::list_channels has more relevant docs
Better matching against return types so we're not throwing away errors
	This just entails swapping the if let for a match statement

* db-lib::Message::send has more updated docs on what variants of Response it returns

* api::messages::send_message has better error logging now and more relevant comments
2021-04-21 17:14:33 -07:00
shockrah
ef73b39f4f + Adding db-lib::common::try_error_passthrough
This is more heavily used in Message::send as a way of discerning "real" server errors
from those that are caused  by user input. The name itself might not be super fitting either

* Moving code for inserting textual messages into its own function
This splits up the logic a bit for Message::send but this segment of logic is also
much simpler than that of file upload

* Flattening Message::send overall
Keeping this function as flat as can be is crucial as it is one of the heavier+most
important funcs in the whole JSON API codebase

Files are now also generated correctly and asynchronously
2021-04-21 16:08:23 -07:00
shockrah
52676cdd1f - Removing /messages/from_id as its no longer usable with the new id generation model
+ Adding new flags to sample .env file
+ Wrapper script run-api-tests.sh which does as its called
- Removing build.sh in favor of run-api-tests.sh
Makefile takes care of building, and apitests are ran with special script anyway
2021-04-20 12:09:05 -07:00
shockrah
bb2201c00e ! First pass base implementation for /messages/recent
This api method is made for clients to easily say "give me the n[1,100] latest
messages in some channel
This commit contains code that is largely untested but contains some base code
such that I can correct issues in the next _tested_ commit
2021-04-17 15:55:10 -07:00
shockrah
591e993329 + Adding cache handler for adding lots of messages from one server call
+ Better error logging in cache

! There is still lots of debug logs which at some point need to be built _out_ from prod builds
Also I need some prod builds

+ Adding more return type annotations for clarity/docs sake

- Removed ancient docs in messages module as they were basically just straight up wrong
2021-04-15 19:57:13 -07:00
shockrah
68e22e1b38 - removing uninportant things
+ messages module was for some reason still using legacy url generation(fixed that)
+ switching types to use bigint since everything is u64/i64 on the backend
2021-04-14 23:00:39 -07:00
shockrah
40351f934e + New cache ipc handlers for adding server caches
Interface for this is fiddly and probably requires real docs to be further developed
without losing my mind doc the whole cache at some point
+ New cache ipc handlers for adding a new open web socket
Web socket comes with some basic listeners, however very litte/nothing
is being done check the health of these connections or to try when possible.

+ Cache now adds actual message objects to its message arrays instead of raw strings (wew)
+ Events module has been added to move the parsing logic/validation away from everything else

+ The basic Event structure has some niftier-than-you-think behavior for data acccess which the cache can leverage for more concise+ correct behavior
2021-04-14 23:00:26 -07:00
shockrah
01c245cbba Ignoring more compiled js and building new events module 2021-04-14 22:48:41 -07:00
shockrah
522890fa00 + rtc::new_message now takes a Pool ref to make the second call for the user name
! Start taking public user params like this in the JWT to reduce on network hits
It's cheap and reliable enough but the idea just now came to me so do that at some point
2021-04-14 22:46:31 -07:00
shockrah
894a5bae34 - Removing more behavior from the cache for complexity reduciton
+ Cache is no longer contained in app structure
This should let us later throw this into an Arc<Mutex<>> for better
async support.
! Also more cache access safety is being done on the front end because the cahe doesn't guarantee much on access
Perhaps some convenience wrappers would make this look nicer(with inline)

!!! Main needs a lot of flattening
It's technically not much of a problem since most of the code behind 1/2 match's
which really just bloat the hell out of indentation making it look bad when its not _that_ bad.
However it still bugs me so I should probably do something about that(also (inline))
2021-04-14 22:44:57 -07:00
shockrah
39ae3ba6be Adding example of websocket url 2021-04-14 22:39:06 -07:00
shockrah
0b0bcd5de6 First pass docs for rtc capabilities 2021-04-14 22:38:43 -07:00
shockrah
42d6a77050 - Removing network control from the cache
From this point forward the cache should basically just be a data container.
Methods on the cache object are there for convenience and should only ever
return very simple data [booleans, integers, () etc.].
The cache should also have very litter/no concept of commands to decouple it
from the renderer process.
! list_channels is still implemented in the cache however it remaains a vestige
and will be moved to the net module

Also the client is getting some new packages for websocket connections and
while they work some additional work has to be put in to figure out where fug to
actually place the websocket so that it can update the cache+DOM in a seomewhat sensible fashion
2021-04-11 17:39:54 -07:00
shockrah
3708d2cd08 Removing websocket changes as they don't architecturally work and thus require too many workarounds
A better architecture must be implemented to have good websocket support
2021-04-10 17:09:25 -07:00
shockrah
102c3b2a10 Electron on Linux hangs when making two successive async calls over the network
Without this calls to /channels/list would break after the first API hit
2021-04-10 17:09:25 -07:00
shockrah
72f3461341 ! Due to user-id's being randomly generated it is now much more likely that id's can't be parsed by javascript properly
Json-bigint should help alleviate this issue by correctly parsing numbers for us

- Removing url method in favor of new url property in server config model

+ Building UserConfigs and ServerConfig from typical JS Obects
This should reduce some up front complexity regarding parameters

! Fix: using new url property instead of protocol + host + port

- Reducing upfront complexity of public channels API
* Also moving to using new updated server.url property
* Channels also handles its part of updating the dom now

bigint parsing in configs now

* More switches to server.url property
2021-04-10 17:09:21 -07:00
shockrah
89bd257213 * More explicit query string guard in /channels/list endpoint handler
* rtc::make_url now builds websocket urls more robustly incase we have to percent
encode them
2021-04-10 16:45:13 -07:00
shockrah
283c201e96 * More explicit query string guard in /channels/list endpoint handler
* rtc::make_url now builds websocket urls more robustly incase we have to percent
encode them
2021-04-10 16:44:24 -07:00
shockrah
f92ced1241 + Websocket setup is almost proper but it completely hangs after we start listening for connections
Of course this is an issue because we can no longer get data from the user
A full rearchitecting may be in order here however its not impossible to modify the current architecture so far

The main issue here is that the cache is doing too much I think

If the termion(main input) task does its thing, and a socket task,
waits around waiting to build a sub task(socket) then we may be able to
pass messages to the socket task to open up sockets when request
This allows us to have shared state via message passing and a main task
can take care of updating the cache.

The renderer can then request data from the cache when it needs to render stuff
2021-04-09 22:10:08 -07:00
shockrah
a0b8e82000 Adding tungstenite for async websocket support 2021-04-09 21:55:31 -07:00
shockrah
abd2537918 really simple debugger logger, will remove at some point but it has use right now 2021-04-09 21:55:04 -07:00