diff --git a/README.md b/README.md index b275771..0b9d4e3 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,18 @@ Join the discord for support, & report any bugs or features on Github :heart: ## Development -See [docs/development.md](docs/development.md) +You will need the flutter SDK to be installed on your platform. +Follow the guide at https://docs.flutter.dev/get-started/install. +You will + +You might need to install `cmake`, `openssl`, `curl` and other depencies in order +to compile the project. + +```sh +git clone --recurse-submodules git@github.com:G-Ray/pikatorrent.git pikatorrent +cd pikatorrent/app +flutter run +``` ## Localization diff --git a/docs/building.md b/docs/building.md deleted file mode 100644 index ca11077..0000000 --- a/docs/building.md +++ /dev/null @@ -1,19 +0,0 @@ -# Building - -## Android - -to build a `.apk`: - -```sh -npm ci -npm -w @pikatorrent/app run build:android:preview -``` - -to build a `.aab`: - -```sh -npm ci -npm -w @pikatorrent/app run build:android:production -``` - -The built package will be available at the root folder. diff --git a/docs/development.md b/docs/development.md deleted file mode 100644 index 37836ad..0000000 --- a/docs/development.md +++ /dev/null @@ -1,89 +0,0 @@ -# Development - -Install dependencies: - -```sh -npm i -``` - -## Desktop - -```sh -npm run web # To Start the web server -npm run desktop # To start the electron app -``` - -## Android - -First build a development release, and install it on the target device. - -```sh -npm -w @pikatorrent/app run build:android:development -``` - -Send the `.apk` to the target device, and install the package. - -You will need to rebuild & install the development package each time a native dependency has been installed or updated. -See https://docs.expo.dev/develop/development-builds/introduction. - -```sh -npm run android -``` - -This will start the installed development with adb. Be sure to connect your target device to your computer. - -## Hub - -```sh -npm run cli hub -``` - -## Node - -```sh -npm run cli node -``` - -## Website - -```sh -npm run site -``` - -### Notes - -`patch-package` is not compatible with lockfile version 3. -As a workaround, create a temporary v2 lockfile with npm i --lockfile-version 2 - -# Folders structure - -## apps/ - -### apps/app - -The end-user frontend `app`, deployed as a desktop, mobile (native) app, or on a web server. - -### apps/cli - -The cli to host a `node` (pikatorrent backend) or to self-host the webrtc signaling `hub` available at https://www.npmjs.com/package/pikatorrent. - -### apps/desktop - -The electron code to run the `app` as a desktop app. - -### apps/site - -The website deployed at https://www.pikatorrent.com. - -## packages/ - -### packages/node - -The `node` is a server binary which can be install on a headless server. It is also included in the desktop app. - -It can be installed with `npm install -g pikatorrent`, and started with `pikatorrent node`. - -### packages/hub - -The signaling server to establish webrtc connections. This service allows an `app` & `node` to join and communicate with webrtc. -You should not need to use it, a public instance is hosted on hub.pikatorrent.com. diff --git a/docs/hub.md b/docs/hub.md deleted file mode 100644 index 17de353..0000000 --- a/docs/hub.md +++ /dev/null @@ -1,33 +0,0 @@ -# Hub - -The `hub` is a signaling server, to discover webrtc peers. - -## Deploy a hub instance - -Example of `docker-compose.yml` to deploy a hub with automatic TLS with caddy. - -```yml -version: '3' - -services: - hub: - image: docker.io/library/node:18-slim - restart: unless-stopped - command: sh -c "apt update && apt install -y git cmake && npm i -g pikatorrent && pikatorrent hub" - - caddy: - image: docker.io/library/caddy:2-alpine - restart: unless-stopped - command: caddy reverse-proxy --from hub.pikatorrent.com --to hub:9001 - ports: - - '80:80' - - '443:443' - - '443:443/udp' - volumes: - - caddy_data:/data - - caddy_config:/config - -volumes: - caddy_data: - caddy_config: -``` diff --git a/docs/peers-connection.md b/docs/peers-connection.md deleted file mode 100644 index f2f8c26..0000000 --- a/docs/peers-connection.md +++ /dev/null @@ -1,39 +0,0 @@ -## Definitions - -A `node` is the continously running "demon" where transmission-native is running. - -A `app` is a client application, which can be running on the web, or on a mobile. - -A `peer` can designate either a `node` or `app`, which will be connected to each other with webrtc. - -## Signaling connection connection - -A `node` or `app` first need to open a connection to a signaling server in order to exchange data needed to find each other. - -The implemented server use `websockets`. - -1. Each `peer` opens a `websocket` connection to the server -2. Each `peer` subscribes to a `channel` to expect responses. Each `peer` can open a channel with its chosen unique id (a random one). To subscribe, they send a message to the websocket with the following data: - -```jsonc -{ - "type": "subscribe", - id // peer id to receive messages -} -``` - -3. Each `peer` sends signaling data (see [simple-peer documentation](https://github.com/feross/simple-peer#peeronsignal-data--) documentation) whenever the `signal` event is emitted to a specific `peer` id, specifying its own `fromId` in order to receive the response back. - -```jsonc -{ - "type": "signal", - fromId, // client or node id - fromName, // Device name - toId, // client or node id - signal -} -``` - -4. When a new peer try to connect for the first time, we ask on the receiving peer to accept or reject the new connection. Once the user has accepted/rejected, we save the nodeId in a accepted/rejected list. - -5. Once `peers` has exchanged signals data (`offer` & `answer`), a webrtc connection should be established between an `app` and `node` with `simple-peer`.