Commit Graph

37 Commits

Author SHA1 Message Date
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
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
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
shockrah
bdd4a63a8d * Fixing url construction for websockets 2021-04-09 21:52:57 -07:00
shockrah
7eb81f38f2 * Fixing bad /message/send route callback
Issue was that we weren't sending the correct headers/body data(ya I know)

- Removing mouse control from app since its completel irrelevant
!+ Putting app messagses behind a mutex for now since they are written to by
sockets and renderer process in the next few patches
2021-04-08 21:21:56 -07:00
shockrah
6088b0836f + Send message callback now implemented
+ channel switcher works as well, although it relies on /lc being ran prior to
its invocation
2021-04-08 15:45:20 -07:00
shockrah
9ad963f097 + Adding POST handler for message sending /message/send
Working as intended
2021-04-08 15:34:46 -07:00
shockrah
86cd551309 Adding option to build release version of tui 2021-04-07 20:42:30 -07:00
shockrah
31dd85d8f0 simple make file to avoid repeatng args all the time 2021-04-07 20:41:54 -07:00
shockrah
704f372c3e + Adding list_channel handler
More agressive channel caching may be required here but it works as an MVP for now

* Switch to hashmap for container of channel caches instead of vector
This should help with cache accesses as we don't have to iterate anymore
Also it makes data fetches much cleaner/shorthanded

* net::list_channels has its own private structure for collecting channels vector
This is basically required and is in the scope of the func itsefl to not pollute any other namespaces
2021-04-07 20:38:06 -07:00
shockrah
8be5547d9e fixed channel api type 2021-04-07 20:24:31 -07:00
shockrah
10e8b7331f + Login route added to net module
! No wrapper goes around this module to avoid fragmentation
Note that basically every network hit is built around try's so they'll all return
HttpResult<T>'s
2021-04-05 17:41:28 -07:00
shockrah
adea888b21 - Removing fluff from config structure 2021-04-05 17:37:43 -07:00
shockrah
0bee002164 + List channels backbone in place
Technically everything is there but I haven't really tested anything yet
Will 100% need fixing + optimizing

+ Switch server Command also working
! Requires a jwt check to avoid expensive+unnecssary network /login hits
! Probably have to hold onto the input to avoid spam somehow

ChannelCache is nearly ready for manipulation
2021-04-05 17:36:24 -07:00
shockrah
5ab2c961f6 - Adding listhost + listchan command variants 2021-04-05 17:00:59 -07:00
shockrah
939ee8c73f + Ignoring empty lines
+ Only adding / on '/' input activation
2021-04-05 16:54:27 -07:00
shockrah
a8d4ca9028 Removing blocking client from reqwest dep as its not needed 2021-04-05 16:53:19 -07:00
shockrah
0bb7c5f49b adding / to start commands now 2021-04-05 14:24:21 -07:00
shockrah
3c10d342eb - Removing dead_code attr from TEXT_CHANNEL
+ Adding Clone derivation to Channel struct
2021-04-04 17:36:58 -07:00
shockrah
a098121ab8 * Messages now grow from the top to the bottom(new messages ontop)
+ Option to enable/disable message-box borders

* Switching over to using bold! macro where applicable (especially in command.rs)
This change mostly reduces the eyesoreness of the termion code
2021-04-04 14:17:39 -07:00
shockrah
6fff48cfab * Messages now grow from the top to the bottom(new messages ontop)
+ Option to enable/disable message-box borders
* Switching over to using bold! macro where applicable
This change mostly reduces the eyesoreness of the termion code
2021-04-04 14:16:54 -07:00
shockrah
43e3f93aad + Handful of useful macros/functions that are used basically everywhere
! There's no real order to these as they are mostly miscellaneous
2021-04-04 14:15:06 -07:00
shockrah
1c85c88f96 * Normalized cache data structures a bit
* Also changed up the naming scheme to be more clear
* Config -> ConfigFile
- Removed ConfigFile::server_url method
! The ConfigFile struct is now pretty much entirely used for disk operations
* update_jwt method also take in correct parameters
2021-04-04 14:13:37 -07:00
shockrah
939042a4c5 skeleton code ready to start pluggin in async fetch calls to remote servers
Some model still has to be built to put RTC somewhere
Also stdout still requires async handling
2021-03-20 15:00:49 -07:00
shockrah
cb5975f235 FULL REWORK AND PORT TO TERMION
This patch is simply meant to mark the beginning of the newest phase for the tui build.
I've 100% settled on using termion as the backend and marking what is done so far

Renderer side:
	Termion has a similar issue where moving data happens very quietly so its best
	if the two (renderer and cache) have the their data to use as they please

Cache Side:
	Basically we own the data we're using because we constantly have to mutate data
	ourselves

Config in the middle:
	Mutable but only from the rendering side because the cache is completely transient
	It technically to own its data but it does anyway because the render(backend)
	 likes to consume data like there's no tomorrow
2021-03-17 20:39:42 -07:00
shockrah
de46c2ff38 Fixxing calling site for http::fetch_channels 2021-01-18 16:43:05 -08:00
shockrah
a58f8437c0 Adding port field to server config 2021-01-18 16:39:21 -08:00
shockrah
901e0218dd Fixed url formatting in fetch_channels 2021-01-18 16:38:41 -08:00
shockrah
20563f85d6 Added helper in Channel struct to easily parse out ip/name 2021-01-17 21:37:04 -08:00
shockrah
9b4909963d skeleton code for fetching channel data
Ready for open_channel to be implemented
2021-01-17 21:36:44 -08:00
shockrah
a7495367f8 fully supporting optional themes with -t 2021-01-17 20:10:40 -08:00
shockrah
ca9c10cdf2 Basic themes taken from zeno on reddit 2021-01-17 20:06:51 -08:00
shockrah
9dd05c1518 adding toml capability to load custom themes with -t flag 2021-01-17 20:05:21 -08:00
shockrah
963d29801d TUI client in progress now, for now its just being wireframed 2021-01-17 02:40:22 -08:00