Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ci #33

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
34b1c5e
Update packages
SamuelWei Dec 2, 2024
c04f140
Add CI
SamuelWei Dec 2, 2024
e37bbf9
Remove branch restrictions
SamuelWei Dec 2, 2024
c1221b1
Include package-lock.json
SamuelWei Dec 2, 2024
531b828
Disable fast failing
SamuelWei Dec 2, 2024
262bfeb
Fix working dir
SamuelWei Dec 2, 2024
fbac958
Remove package file
SamuelWei Dec 2, 2024
4ff3cdf
Add to gitignore
SamuelWei Dec 2, 2024
39afcb2
Install npm without lock file
SamuelWei Dec 2, 2024
e7a73af
Set node version to 20
SamuelWei Dec 2, 2024
5ccca7c
Downgrade elgato-stream-deck
SamuelWei Dec 2, 2024
05c270f
Add code for ubuntu
SamuelWei Dec 2, 2024
e2d95ba
Add libusb
SamuelWei Dec 2, 2024
4fc8bd9
Add more build tools
SamuelWei Dec 2, 2024
481adc9
run node 16
SamuelWei Dec 2, 2024
f8cd29e
Vite exclude node-hid
SamuelWei Dec 3, 2024
ee45a73
Disable npm rebuild for electron
SamuelWei Dec 3, 2024
9df214c
Set release type to github
SamuelWei Dec 3, 2024
a4edf1f
Add details to package.json
SamuelWei Dec 3, 2024
2d344a0
Remove the dir
SamuelWei Dec 3, 2024
aa93862
Add github token
SamuelWei Dec 3, 2024
f4a69b3
Update to node 20
SamuelWei Dec 3, 2024
e19758b
Add after install
SamuelWei Dec 3, 2024
e7e9a2c
Move udev rules to lib
SamuelWei Dec 3, 2024
469269a
Set streamdeck brightness
SamuelWei Dec 3, 2024
9803638
Add udev trigger
SamuelWei Dec 3, 2024
393f114
Upload windows and mac packages
SamuelWei Dec 3, 2024
d1162cf
Remove spaces from artifacts
SamuelWei Dec 3, 2024
86df51b
Add close button
SamuelWei Dec 3, 2024
5e8da44
Fix cs
SamuelWei Dec 3, 2024
75753c7
Fix mac artifact upload
SamuelWei Dec 3, 2024
1191d89
Debug mac artifacts
SamuelWei Dec 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/build-appliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: 📦 Build Appliance electon app
on:
push:
# branches: [ "main"]
# paths:
# - 'appliance-application/**'
pull_request:
branches: [ "main" ]
paths:
- 'appliance-application/**'


jobs:
release:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Install Node.js and NPM
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install system dependencies on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt -y update
sudo apt install -y g++-12 build-essential pkg-config libudev-dev libusb-1.0-0 libusb-1.0-0-dev
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100

- name: Install dependencies
run: npm install
working-directory: appliance-application


- name: Build
run: npm run compile
working-directory: appliance-application
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload .deb artifact
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: "BBB-RoomMediaConnector.deb"
path: appliance-application/dist/*.deb

- name: Upload .rpm artifact
uses: actions/upload-artifact@v4
if: matrix.os == 'ubuntu-latest'
with:
name: "BBB-RoomMediaConnector.rpm"
path: appliance-application/dist/*.rpm

- name: Upload .exe artifact
uses: actions/upload-artifact@v4
if: matrix.os == 'windows-latest'
with:
name: "BBB-RoomMediaConnector.exe"
path: appliance-application/dist/*.exe

- name: Upload .app artifact
uses: actions/upload-artifact@v4
if: matrix.os == 'macos-latest'
with:
name: "BBB-RoomMediaConnector.app"
path: appliance-application/dist/
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ appliance-application/node_modules
appliance-application/packages/main/dist
appliance-application/packages/preload/dist
appliance-application/packages/renderer/dist
package-lock.json

# Python
.Python
Expand Down
23 changes: 21 additions & 2 deletions appliance-application/.electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,33 @@ module.exports = async function () {
output: 'dist',
buildResources: 'buildResources',
},
files: ['packages/**/dist/**', "packages/**/assets/**"],
files: ['packages/**/dist/**', 'packages/**/assets/**'],
extraMetadata: {
version: getVersion(),
},

npmRebuild: false,

appId: 'org.bigbluebutton.room-media.appliance',

// Specify linux target just for disabling snap compilation
linux: {
target: 'deb',
target: ['deb', 'rpm'],
},
win: {
target: ['portable'],
},
deb: {
afterInstall: 'linux/after-install.tpl',
},
rpm: {
afterInstall: 'linux/after-install.tpl',
},

publish: [
{
provider: 'github',
},
],
};
};
2 changes: 2 additions & 0 deletions appliance-application/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ thumbs.db
# Editor-based Rest Client
.idea/httpRequests
/.idea/csv-plugin.xml

package-lock.json
30 changes: 30 additions & 0 deletions appliance-application/linux/after-install.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Write udev rules for BBB Room Connector
cat <<EOT > /lib/udev/rules.d/50-bbb-room-connector.rules
SUBSYSTEM=="input", GROUP="input", MODE="0660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0084", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0086", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0090", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="009a", MODE="660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00aa", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0080", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0084", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0086", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0090", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="009a", MODE="660", TAG+="uaccess"
KERNEL=="hidraw*", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="00aa", MODE="660", TAG+="uaccess"
EOT

# Reload udev rules
udevadm control --reload-rules
udevadm trigger
21 changes: 13 additions & 8 deletions appliance-application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
"version": "1.0.0",
"private": true,
"main": "packages/main/dist/index.mjs",
"repository": "bigbluebutton/bigbluebutton-room-media-connector",
"author": {
"name": "Samuel Weirich",
"email": "[email protected]"
},
"scripts": {
"build": "npm run build:main && npm run build:preload && npm run build:renderer",
"build:main": "cd ./packages/main && vite build",
"build:preload": "cd ./packages/preload && vite build",
"build:renderer": "cd ./packages/renderer && vite build",
"compile": "cross-env MODE=production npm run build && electron-builder build --config .electron-builder.config.js --dir --config.asar=false",
"compile": "cross-env MODE=production npm run build && electron-builder build --config .electron-builder.config.js --config.asar=false",
"test": "npm run test:main && npm run test:preload && npm run test:renderer && npm run test:e2e",
"test:e2e": "npm run build && vitest run",
"test:main": "vitest run -r packages/main --passWithNoTests",
"test:preload": "vitest run -r packages/preload --passWithNoTests",
"test:renderer": "vitest run -r packages/renderer --passWithNoTests",
"watch": "node scripts/watch.mjs",
"start": "cross-env MODE=production npm run build && electron .",
"lint": "eslint . --ext js,mjs,cjs,ts,mts,cts,vue",
"typecheck:main": "tsc --noEmit -p packages/main/tsconfig.json",
"typecheck:preload": "tsc --noEmit -p packages/preload/tsconfig.json",
Expand All @@ -31,11 +37,11 @@
"@vue/test-utils": "^2.4.6",
"autoprefixer": "^10.4.16",
"cross-env": "7.0.3",
"electron": "^31.3.1",
"electron-builder": "^24.13.3",
"electron": "^33.2.1",
"electron-builder": "^25.1.8",
"eslint": "^9.8.0",
"eslint-plugin-vue": "^9.18.1",
"happy-dom": "^14.12.3",
"happy-dom": "^15.11.7",
"nano-staged": "0.8.0",
"playwright": "^1.45.3",
"postcss": "^8.4.31",
Expand All @@ -45,20 +51,19 @@
"unplugin-auto-expose": "0.0.5",
"vite": "^5.3.5",
"vitest": "^2.0.5",
"vue": "^3.4.35",
"vue": "^3.5.13",
"vue-tsc": "^2.0.29"
},
"dependencies": {
"@apollo/client": "^3.10.8",
"@elgato-stream-deck/node": "^6.2.0",
"@elgato-stream-deck/node": "^7.1.1",
"@heroicons/vue": "^2.0.18",
"@julusian/jpeg-turbo": "^2.1.0",
"@julusian/jpeg-turbo": "^2.2.0",
"axios": "^1.6.2",
"electron-updater": "^6.3.2",
"graphql": "^16.8.1",
"graphql-ws": "^5.16.0",
"sharp": "^0.33.4",
"vue-template-compiler": "^2.7.16",
"ws": "^8.14.2"
}
}
1 change: 0 additions & 1 deletion appliance-application/packages/main/src/HID.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export interface HID {

newOffer(accept: () => void, reject: () => void): void;

acceptedOffer(): void;
Expand Down
39 changes: 18 additions & 21 deletions appliance-application/packages/main/src/bbb-graphql.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import {createClient} from 'graphql-ws';
import WebSocket from 'ws'
import WebSocket from 'ws';
import {
ApolloClient,
InMemoryCache,
Expand All @@ -25,11 +25,11 @@ export class BBBGraphql {
private apolloClient: ApolloClient<NormalizedCacheObject> | undefined;
private userId: string | null = null;

constructor (joinUrl: string) {
constructor(joinUrl: string) {
this.joinUrl = joinUrl;
}

public async connect () {
public async connect() {
if (!(await this.requestSessionToken())) {
console.error('Failed to request session token.');
return false;
Expand All @@ -53,7 +53,7 @@ export class BBBGraphql {
return true;
}

private async requestSessionToken (): Promise<boolean> {
private async requestSessionToken(): Promise<boolean> {
try {
console.debug('Join link used:', this.joinUrl);
const joinUrl = new URL(this.joinUrl);
Expand Down Expand Up @@ -87,9 +87,8 @@ export class BBBGraphql {
return false;
}

private async getAuthToken(): Promise<boolean> {

if (!(this?.apolloClient)) {
private async getAuthToken(): Promise<boolean> {
if (!this?.apolloClient) {
return false;
}
const USER_CURRENT_QUERY = gql`
Expand All @@ -100,12 +99,10 @@ export class BBBGraphql {
}
`;

const { data } = await this.apolloClient.query(
{
query: USER_CURRENT_QUERY,
fetchPolicy: 'network-only',
}
);
const {data} = await this.apolloClient.query({
query: USER_CURRENT_QUERY,
fetchPolicy: 'network-only',
});

if (data && data?.user_current?.[0]?.authToken) {
console.log('IN getAuthToken: ', data);
Expand All @@ -116,7 +113,7 @@ export class BBBGraphql {
return false;
}

public async connectToGraphQL () {
public async connectToGraphQL() {
await this.initApolloClient();

console.debug('--- Connecting to GraphQL... ---');
Expand All @@ -136,7 +133,7 @@ export class BBBGraphql {
return false;
}

if (!(this?.apolloClient)) {
if (!this?.apolloClient) {
console.error('apolloClient is not set.');
return false;
}
Expand Down Expand Up @@ -165,7 +162,7 @@ export class BBBGraphql {
return true;
}

private async initApolloClient (): Promise<boolean> {
private async initApolloClient(): Promise<boolean> {
let wsLink;
try {
// Check if cookies are not null before attempting to find a cookie
Expand All @@ -181,7 +178,7 @@ export class BBBGraphql {

// You need to override the WebSocket class to add the cookie
class WebSocketWithCookie extends WebSocket {
constructor (address: string, protocols?: string | string[]) {
constructor(address: string, protocols?: string | string[]) {
super(address, protocols, {
headers: {
Cookie: jSessionCookie,
Expand Down Expand Up @@ -251,18 +248,18 @@ export class BBBGraphql {
return true;
}

public getApolloClient () {
public getApolloClient() {
return this.apolloClient;
}

public getUserId () {
public getUserId() {
return this.userId;
}

public async leaveMeeting () {
public async leaveMeeting() {
if (this?.apolloClient) {
await this.apolloClient.clearStore();
this.apolloClient.stop();
}
}
}
}
Loading
Loading