2022-05-13 20:30:36 +02:00
---
2023-07-14 14:41:58 +02:00
title: Web
2022-05-13 20:30:36 +02:00
weight: 23
---
2023-05-08 11:22:35 +02:00
## How to build on Linux
2023-06-03 22:48:41 +02:00
Run below on Linux or Mac (works on Windows too, however you may need to slightly modify some commands, e.g. change `wget` to `curl.exe -O` ):
2022-05-13 20:30:36 +02:00
2022-05-17 17:02:52 +02:00
```sh
2023-04-26 13:48:32 +02:00
git clone https://github.com/JelleBuning/rustdesk.git
2023-07-14 14:41:58 +02:00
cd rustdesk
git switch fix_build
2023-03-31 08:32:57 +02:00
cd flutter/web/js
2022-05-17 17:02:52 +02:00
2023-06-03 22:48:41 +02:00
# Install protoc first, see: https://google.github.io/proto-lens/installing-protoc.html
2022-05-13 20:30:36 +02:00
npm install ts-proto
2023-06-03 22:48:41 +02:00
# Only works with vite <= 2.8, see: https://github.com/vitejs/vite/blob/main/docs/guide/build.md#chunking-strategy
2023-04-06 10:45:51 +02:00
npm install vite@2.8
2023-04-06 12:41:48 +02:00
2023-06-03 22:48:41 +02:00
# Required for yarn build
2023-04-06 12:41:48 +02:00
npm install yarn -g
npm install typescript -g
npm install protoc -g
2022-05-13 20:30:36 +02:00
yarn build
2022-05-17 17:02:52 +02:00
2022-05-17 19:54:39 +02:00
cd ..
2022-05-17 17:02:52 +02:00
2023-07-15 21:51:29 +02:00
# About details of YUV converter, check this https://github.com/rustdesk/rustdesk/issues/364#issuecomment-1023562050
2022-05-13 20:30:36 +02:00
wget https://github.com/rustdesk/doc.rustdesk.com/releases/download/console/web_deps.tar.gz
2023-06-03 22:48:41 +02:00
# Decompress to the current directory
2022-05-13 20:30:36 +02:00
tar xzf web_deps.tar.gz
2022-05-17 17:02:52 +02:00
2022-05-17 19:54:39 +02:00
cd ..
2022-05-13 20:30:36 +02:00
# Good Luck!
flutter run -d chrome
```
2022-08-18 18:37:39 +02:00
2023-06-10 00:03:28 +02:00
## How to build release on Linux
2023-07-14 14:41:58 +02:00
If you want to host the web client you should build a release before running it on a web server.
2023-06-10 00:03:28 +02:00
To do so follow the steps shown above except the `flutter run -d chrome` command. Continue with the following commands:
2023-06-08 14:31:56 +02:00
```sh
flutter build web --release
cd build/web
# You could use any server, just an example
python -m http.server 8000
```
2023-07-14 14:41:58 +02:00
To configure the build on HTTPS we would recommend following the instructions from the following [source ](https://medium.com/flutter-community/how-to-host-flutter-using-nginx-a71bcb11d96 ).
2023-06-30 23:29:30 +02:00
2023-07-15 21:51:29 +02:00
> Currently, YUV converter and VP9 are the bottleneck.
2023-05-08 11:22:35 +02:00
## How to build with Docker
2023-06-03 22:48:41 +02:00
Run below on Linux or Mac:
- Begin by installing flutter for [Linux ](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually ) or [macOS ](https://docs.flutter.dev/get-started/install/macos )
- Setup the flutter app locally:
2023-05-08 11:22:35 +02:00
```sh
git clone https://github.com/JelleBuning/rustdesk.git
2023-07-14 14:41:58 +02:00
cd rustdesk
2023-05-08 11:22:35 +02:00
git switch fix_build
cd flutter/web/js
2023-06-03 22:48:41 +02:00
# Install protoc first, see: https://google.github.io/proto-lens/installing-protoc.html
2023-05-08 11:22:35 +02:00
npm install ts-proto
2023-06-03 22:48:41 +02:00
# Only works with vite <= 2.8, see: https://github.com/vitejs/vite/blob/main/docs/guide/build.md#chunking-strategy
2023-05-08 11:22:35 +02:00
npm install vite@2.8
2023-06-03 22:48:41 +02:00
# Required for yarn build
2023-05-08 11:22:35 +02:00
npm install yarn -g
npm install typescript -g
npm install protoc -g
yarn build
```
2023-06-03 22:48:41 +02:00
2023-05-08 11:22:35 +02:00
- Create a `Dockerfile` with the following content under `flutter` directory:
```Dockerfile
2023-06-03 22:48:41 +02:00
# Install operating system and dependencies
2023-05-08 11:22:35 +02:00
FROM ubuntu:20.04
2023-07-14 14:41:58 +02:00
ENV DEBIAN_FRONTEND=noninteractive
2023-05-08 11:22:35 +02:00
2023-07-14 14:41:58 +02:00
RUN apt-get update
2023-05-08 11:22:35 +02:00
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3 clang cmake ninja-build pkg-config libgtk-3-dev
RUN apt-get clean
2023-07-14 14:41:58 +02:00
# Download Flutter SDK from Flutter GitHub repo
2023-05-08 11:22:35 +02:00
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
# Run flutter doctor
RUN flutter doctor
# Enable flutter web
RUN flutter channel master
RUN flutter upgrade
RUN flutter config --enable-web
# Copy files to container and build
RUN mkdir /app/
2023-07-14 14:41:58 +02:00
# I was unable to build web app from dockerfile
2023-06-03 22:48:41 +02:00
# So instead I built it locally and commented the "flutter build web" in this file
2023-05-08 11:22:35 +02:00
COPY . /app/
WORKDIR /app/
# RUN flutter build web
# Record the exposed port
EXPOSE 5000
2023-06-03 22:48:41 +02:00
# Make server startup script executable and start the web server
2023-05-08 11:22:35 +02:00
RUN ["chmod", "+x", "/app/server/server.sh"]
ENTRYPOINT [ "/app/server/server.sh"]
```
2023-06-03 22:48:41 +02:00
2023-05-08 11:22:35 +02:00
- Create `server` directory under `flutter`
- Create a `server.sh` file with the following content under `flutter/server` directory:
2023-06-03 22:48:41 +02:00
2023-05-08 11:22:35 +02:00
```sh
#!/bin/bash
# Set the port
PORT=5000
# Stop any program currently running on the set port
echo 'preparing port' $PORT '...'
fuser -k 5000/tcp
2023-06-03 22:48:41 +02:00
# Switch directory
2023-05-08 11:22:35 +02:00
cd build/web/
# Start the server
echo 'Server starting on port' $PORT '...'
python3 -m http.server $PORT
```
2023-06-03 22:48:41 +02:00
2023-07-15 21:51:29 +02:00
- Build the Docker image:
2023-06-03 22:48:41 +02:00
2023-05-08 11:22:35 +02:00
```sh
docker build -t rustdesk-web-client .
```
2023-06-03 22:48:41 +02:00
2023-07-15 21:51:29 +02:00
- Run the Docker image:
2023-06-03 22:48:41 +02:00
2023-05-08 11:22:35 +02:00
```sh
docker run -p 5000:5000 rustdesk-web-client
```
2023-06-03 22:48:41 +02:00
2023-05-08 11:22:35 +02:00
- Open your browser and go to `localhost:5000` to see the web app
2023-06-03 22:48:41 +02:00
### RustDesk Web Client using existing Docker image
2023-07-15 21:51:29 +02:00
If you do not want to build the Docker image yourself, you can use the image I built and uploaded to [Docker Hub ](https://hub.docker.com/r/keyurbhole/flutter_web_desk ).
2023-06-03 22:48:41 +02:00
- Pull the image:
2023-05-08 11:22:35 +02:00
```sh
docker pull keyurbhole/flutter_web_desk
```
2023-06-03 22:48:41 +02:00
- Run the image:
2023-05-08 11:22:35 +02:00
```sh
docker run -p 5000:5000 keyurbhole/flutter_web_desk
```
2023-06-03 22:48:41 +02:00
- Open your browser and go to `localhost:5000` to see the web app