Skip to content

Commit c83849f

Browse files
authored
Merge pull request #45 from PiterWeb/main
New release trying wails build action
2 parents 91e69b9 + 178b0d8 commit c83849f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4853
-5928
lines changed

.github/workflows/main.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Wails build
2+
3+
on:
4+
push:
5+
tags:
6+
# Match any new tag
7+
- '*'
8+
9+
env:
10+
# Necessary for most environments as build failure can occur due to OOM issues
11+
NODE_OPTIONS: "--max-old-space-size=4096"
12+
13+
jobs:
14+
build:
15+
strategy:
16+
# Failure in one platform build won't impact the others
17+
fail-fast: false
18+
matrix:
19+
build:
20+
- name: 'RemoteControllerLinux'
21+
platform: 'linux/amd64'
22+
os: 'ubuntu-latest'
23+
- name: 'RemoteControllerWindows'
24+
platform: 'windows/amd64'
25+
os: 'windows-latest'
26+
- name: 'RemoteControllerDarwin'
27+
platform: 'darwin/universal'
28+
os: 'macos-latest'
29+
30+
runs-on: ${{ matrix.build.os }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
with:
35+
submodules: recursive
36+
37+
- name: Build wails
38+
uses: dAppServer/[email protected]
39+
id: build
40+
with:
41+
build-name: ${{ matrix.build.name }}
42+
build-platform: ${{ matrix.build.platform }}
43+
package: false
44+
go-version: '1.22'

README.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626

2727
## Resources 📚
2828

29-
- [FAQ](https://remote-controller.vercel.app/info/resources/faq/)
30-
- [Security](https://remote-controller.vercel.app/info/resources/security/)
29+
- [Docs](./docs/) 📘
30+
- [FAQ](https://remote-controller.vercel.app/info/resources/faq/) 💬
31+
- [Security](https://remote-controller.vercel.app/info/resources/security/) 🔐
3132

3233
- https://github.com/user-attachments/assets/f4a412fa-f403-4429-85fb-9c1e74bff458
3334

@@ -49,19 +50,19 @@
4950

5051
| Windows | Linux | MacOS | Browser (Only Client) |
5152
|--------- |------- |------- |--------- |
52-
|| (Only keyboard)⌛ Looking for contributions for Gamepad | | ✔ (Known Issues with Safari) |
53+
|| (Only keyboard)⌛ Looking for contributions for Gamepad | (In theory keyboard works)⌛ Looking for contributions for Gamepad | ✔ (Known Issues with Safari) |
5354

54-
### Gamepad Support 🎮
55+
### Native Gamepad Support 🎮
5556

5657
| PC Controller (XInput/DirectInput) | Xbox Controller (XInput) | PlayStation Controler
5758
|--------- |------- |------- |
58-
||||
59+
|||(You can achieve emulating a Xbox Controller) |
5960

6061
### Translations 🔠
6162

62-
| English | Spanish | Galician | Russian |Other languages |
63-
|--------- |------- |------- | ------- | ------- |
64-
| 100% ✔ | 100% ✔ | 100% ✔ | 29.5% |⌛ Looking for contributions
63+
| English | Spanish | Galician | Russian | French |Other languages |
64+
|--------- |------- |------- | ------- | ------- | ------- |
65+
| 100% ✔ | 100% ✔ | 100% ✔ | 100% ✔ | 100% ✔ (@Zorkyx22) |⌛ Looking for contributions
6566

6667
## Self Hosting ☁
6768

@@ -71,37 +72,50 @@ There is no way to self-host the infrastructure of RemoteController because it h
7172

7273
- Also you can host the Web version (but it is only frontend) to make like a network of Remote Controller web clients
7374

74-
## Build
75+
## Run Dev
7576

7677
### Prerequisites
7778

78-
You must have Wails CLI, NodeJS, npm and Golang installed.
79+
You must have Task CLI, Wails CLI, NodeJS, pnpm and Golang installed.
7980

8081
### How to
8182

82-
First go to the frontend folder and run
83+
Go to the root project folder and run
8384

84-
`$ pnpm install`<br>
85-
`$ pnpm run build`
85+
- Full App :
8686

87-
Now run the following command on the root directory of the main project:
87+
`$ task dev-all`
8888

89-
`$ wails build`
89+
- Frontend:
9090

91-
finally go to the build/bin folder and your executable will be there.
91+
`$ task dev-front`
9292

93-
> [!Note]
94-
> Please note the supported platforms in the table
93+
## Build
94+
95+
### Prerequisites
96+
97+
You must have Task CLI, Wails CLI, NodeJS, pnpm and Golang installed.
98+
99+
### How to
100+
101+
Go to the root project folder and run
102+
103+
- For general builds:
104+
105+
`$ task build`
95106

96-
## How it works 👷‍♂️
107+
- For Windows builds:
97108

98-
This desktop APP is based on the WebRTC 🎞 standard and it uses the power of Go to communicate 🗣 with the Gamepad emulation libraries.
99-
In Windows uses the ViGEm Bus Driver with the ViGEm Client DLL
109+
`$ task build-win`
100110

101-
For the low level actions uses Go.
102-
On the other hand the UI works with Web technologies (WASM, Sveltekit, Tailwind, DaisyUI & Typescript)
111+
- For Linux builds:
103112

104-
You can learn more about [how it works](./docs/README.md) under the hood all the project
113+
`$ task build-linux`
114+
115+
finally go to the build/bin folder and your executables will be there.
116+
117+
> [!Note]
118+
> Please note the supported platforms in the table
105119
106120
## Contributting 🤝
107121

Taskfile.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ tasks:
3434
- pnpm run dev
3535
desc: Run the frontend in development mode
3636
test:
37+
desc: Run E2E tests
3738
dir: frontend
39+
deps: [dev-all]
3840
cmds:
39-
- pnpm run test
40-
desc: Run the frontend tests
41+
- pnpm run test

docs/README.md

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Docs 📘
22

3-
## Frontend (UI Logic)
3+
## Frontend (Browser)
4+
5+
Source code location : [/frontend/](../frontend)
6+
7+
WebRTC code: [/frontend/src/lib/webrtc/](../frontend/src/lib/webrtc)
48

59
### [Frontend Docs](./FRONTEND.md)
610

@@ -15,6 +19,10 @@
1519

1620
## Backend (Dekstop APP Logic)
1721

22+
Source code location: [/main.go](../main.go) + [/src/](../src)
23+
24+
WebRTC code: [/src/net/](../src/net) + [/src/streaming_signal/](../src/streaming_signal/)
25+
1826
### [Backend Docs](./BACKEND.md)
1927

2028
### Stack:
@@ -32,4 +40,72 @@ WebRTC is totally supported by all main desktop/mobile browsers and is also avai
3240

3341
The purpose of WebRTC is to make a P2P connection between Host and Client devices to send Gamepad Input using data channels and also captured Video/Audio with media channels.
3442

35-
DisplayMedia is for capturing video/audio from desktop/aplications and them stream it through WebRTC media channel.
43+
DisplayMedia is for capturing video/audio from desktop/aplications and them stream it through WebRTC media channel.
44+
45+
### Wails
46+
47+
This project is using Wails so it might be important to know how wails works.
48+
49+
Wails is like Electron but for Go, and instead of embed a Chromium Browser you will use the existent browser of you OS (webview2, gtkwebview, ...).
50+
51+
You will have two parts:
52+
- "Browser":
53+
This is what runs HTML, CSS, JS, TS, WASM (provides the UI)
54+
- "Desktop APP":
55+
This is what runs Go code
56+
57+
#### Bindings
58+
59+
Wails can generate bindings in JS for Go generated functions. <br>
60+
61+
In the project all bindings are located in [/src/desktop/](../src/desktop/)
62+
63+
Real example:
64+
65+
This function located in [/src/desktop/app.go](../src/desktop/app.go)
66+
67+
```go
68+
func (a *App) GetCurrentOS() string {
69+
return strings.ToUpper(runtime.GOOS)
70+
}
71+
```
72+
will appear as
73+
74+
```js
75+
export function GetCurrentOS() {
76+
return window['go']['desktop']['App']['GetCurrentOS']();
77+
}
78+
```
79+
80+
in the path [/frontend/src/lib/wailsjs/go/desktop/App.js](../frontend/src/lib/wailsjs/go/desktop/App.js)
81+
82+
#### Events
83+
84+
Wails have listeners and event dispatchers to send data between JS <-> GO in a bidirectional flow (this are contained in the wails runtime pkg)
85+
86+
## Roles
87+
88+
First make sure to read the Wails section above.
89+
90+
We are going to start with ¿ How the two roles communicate ?.
91+
92+
To not enter in WebRTC matery we are going to say that each peer needs to need some information from the other after the connection begins so we need to pass that information.<br><br>
93+
To do that we share codes, this codes are simply the data needed by WebRTC but encoded and compressed to be the most portable it can, to not require the use of a signaling server. This way you will not have to self-host any serice.
94+
95+
Note: all the "codes" encoding & compression is done in Go or Wasm (generated from the Go code).
96+
97+
### Client
98+
99+
Client code is only located on the "Browser" (JS/TS).
100+
101+
The logic is very simple. The client creates a WebRTC connection with the host and through the Gamepad API of the "Browser" gets the gamepad data, later we copy the structure and send using a WebRTC Datachannel.
102+
If there is an available Screen + Audio stream we can connect to it creating a new WebRTC connection and using the previous as signaling server. The render of the stream is all done using Web APIs.
103+
104+
### Host
105+
106+
Host is the most complex role cause part of the logic of webrtc code is on the "Browser" and other in "Desktop APP".
107+
108+
This division of logic is because we need:
109+
- Go: A WebRTC connection that goes directly to the ViGEm driver (which is loaded as a DLL in Go) to insert the gamepad data or a similar situation with keyboard.
110+
111+
- JS/TS: We need to send the Screen + Audio stream to the client. To do that we need the WebRTC stream in the "Browser", one way of achieve this could have been doing a rtp stream proxy and use the Go WebRTC connection but that would have add latency and use of more resources. Because of that it is created a new WebRTC connection only for the stream on the "Browser", this connection is auto created and uses as signaling service the normal WebRTC connection used for Gamepad data.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe("Basic connection", () => {
2+
3+
it("load", () => {
4+
cy.visit('http://localhost:34115/');
5+
cy.wait(1000)
6+
cy.log("hello")
7+
})
8+
9+
})

frontend/cypress/e2e/config/languages.cy.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
describe('Tutorial flow', () => {
2+
it('Load main page ', () => {
3+
cy.visit('http://localhost:34115/');
4+
});
5+
6+
it('tutorial', () => {
7+
8+
cy.visit('http://localhost:34115/');
9+
cy.get('button.btn').click();
10+
cy.get('button.driver-popover-next-btn').click();
11+
cy.location('pathname').should('equal', '/mode/config');
12+
cy.wait(1000);
13+
cy.get('.grid > :nth-child(5) > .btn').click();
14+
cy.get(':nth-child(3) > .btn').click();
15+
cy.get(':nth-child(4) > .btn').click();
16+
cy.get('.grid > :nth-child(1) > .btn').click();
17+
cy.get('.grid > :nth-child(2) > .btn').click();
18+
cy.get('button.driver-popover-next-btn').click();
19+
cy.wait(1000);
20+
cy.get('button.driver-popover-next-btn').click();
21+
cy.location('pathname').should('equal', '/mode/config/advanced/stun');
22+
cy.wait(1000);
23+
cy.get('button.driver-popover-next-btn').click();
24+
cy.wait(1000);
25+
cy.get('button.driver-popover-next-btn').click();
26+
cy.wait(1000);
27+
cy.location('pathname').should('equal', '/mode/config');
28+
cy.get('button.driver-popover-next-btn').click();
29+
cy.wait(1000);
30+
cy.get('button.driver-popover-next-btn').click();
31+
cy.wait(1000);
32+
cy.get('button.driver-popover-next-btn').click();
33+
cy.location('pathname').should('equal', '/');
34+
});
35+
});

frontend/package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)