stephen304 / bitcannon

A torrent index archiving, browsing, and backup tool
http://bitcannon.io/
MIT License
408 stars 40 forks source link

Node Rewrite #89

Open stephen304 opened 9 years ago

stephen304 commented 9 years ago

We should probably share ideas on how to accomplish a node rewrite. Basically I'm still trying to figure out how I can organize it so I can end up with a desktop app and a server daemon without duplicating too much logic. Ideally i'd love to write a node bitcannon server and then have the desktop app start up an instance of the server in the background and present the web ui, that's basically what I've tried to do here (but it ended up being the other way around with the server wrapping/serving the client for desktop use...)

I'm not sure how node packages work - if we can have a package that runs as a program and also exposes a library type thing, then maybe we could have a node-bitcannon package that can be run as a command for the server use case, but can also be required in the node desktop app.

What do you guys think?

OmgImAlexis commented 9 years ago

I think you should just go about separating the logic so the server and webui are a single project and then there's a simple desktop app that just wraps the webui using something like electron.

The main thing that need to be worked on are converting all of the Go code to Javascript, the main part being the UDP scraping.

stephen304 commented 9 years ago

I'm really leaning towards not having a ui on the server part. I'd like to take advantage of the versioned imports of node to allow me to safely decouple the ui (web and desktop) from the server.

Currently this codebase is almost what you suggest - minus the electron app. The thing is, I want the desktop app to include the server program to simplify the install process for regular users. Additionally, I think require()ing the server and using it as a library in the desktop client would be useful to avoid having to think about client server communications, as they would just be the same program.

OmgImAlexis commented 9 years ago

Well what about having the server with the web ui and then the electron app could have the server built in, that way people like me that just want the "server" can still have a ui when needed and people that want a standalone app can just install the electron app and it'll boot the server in the background?

I figure there's two types of people using this, those that want external integration such as SickRage, CouchPotato, etc. and those who just want something simple to use to download torrents from.

stephen304 commented 9 years ago

I think that sounds good. I'll see if I can diagram out how I want it to look soon™

stephen304 commented 9 years ago

I spoke too soon. Had a hard drive failure so this will be delayed until I get my laptop up and running again.