Rookout's site addon to support local files and folders
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci upgrade circleci mac image Dec 11, 2018
assets/icons
graphql
src
.gitignore
LICENSE
README.md Undo shit (#18) Dec 3, 2018
build.sh
index-worker.html
package-lock.json
package.json
tsconfig.json
tslint.json
validate_version.sh

README.md

Introduction

This electron app is used to expose local client's folders to our webapp (app.rookout.com)
via a local GraphQL server

There are 3 components to this electron app:

  1. The main process
  2. The react web app
  3. An invisible worker window

Features

  1. CircleCI
  2. Cross platform
  3. Secure via Access Token
  4. Auto updates
  5. Search Indexing

The main process

Written in Typescript, the main process is used to initialize the windows and communicate with them via electron's built in RPC functionality.
It helps the windows achieve functionalities they cannot access directly (e.g: desktop notifications, tray icon)

The react web app

Written in ES6, and uses create-react-app, The react app is the window the client actually sees.
The window exposes configurations to the clients and stuff like add/delete/edit repositories, exposing the access token (see Access Token)

The invisible worker window

The invisible worker window runs the GraphQL server and manages all operations on repositories (CRUD operations and indexing)
The reason we open an invisible windows (and not use the main process for that) is because the indexing job is cpu heavy and we cannot block the main process, as it blocks renderer processes as well (reference)

The access Token

Because we listen on http://localhost:44512 (which is the graphql endpoint we spin), every website running on the client's machine has access to our API.
In order to restrict access we use an access token whitout which every call to our API will return status 401 see auth middleware

Project initialization

  1. run yarn in /src/webapp to install webapp dependencies
  2. run npm install in root directory to install electron's dependencies

Run in development

In development we run the webpack server to serve the react web app. We do this because we get hot reload when we modify the react code.
To run the webapp server:

  1. run yarn run start in /src/webapp to run development server
  2. run npm start in the root directory to run the electron app

Build for production

TODO (see circleci yaml)