Skip to content

Commit

Permalink
Merge branch 'main' into feat/coreui-5
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jul 7, 2024
2 parents 5ed5e2e + b5c1cbf commit e5cf878
Show file tree
Hide file tree
Showing 19 changed files with 1,080 additions and 227 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push]
jobs:
check-types:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -37,6 +39,7 @@ jobs:
linux64:
runs-on: ubuntu-20.04
needs: check-types
timeout-minutes: 20

outputs:
version: ${{ steps.filenames.outputs.longversion }}
Expand Down Expand Up @@ -110,6 +113,7 @@ jobs:
linux-arm64:
runs-on: ubuntu-20.04
needs: check-types
timeout-minutes: 20

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -179,6 +183,7 @@ jobs:
osx:
runs-on: macos-12
needs: check-types
timeout-minutes: 60

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -247,6 +252,7 @@ jobs:
osx-arm64:
runs-on: macos-12
needs: check-types
timeout-minutes: 60

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -319,6 +325,7 @@ jobs:
win64:
runs-on: windows-2019
needs: check-types
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -383,6 +390,7 @@ jobs:

docker-image:
runs-on: ubuntu-latest
timeout-minutes: 10

needs:
- linux64
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-type-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [pull_request]
jobs:
check-types:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sync-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ env:
jobs:
sync-modules:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand Down
5 changes: 3 additions & 2 deletions companion/lib/Controls/ActionRecorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,10 @@ export default class ActionRecorder extends EventEmitter {
* @param {string} connectionId
* @param {string} actionId
* @param {Record<string,any>} options
* @param {number} delay
* @param {string | undefined} uniquenessId
*/
receiveAction(connectionId, actionId, options, uniquenessId) {
receiveAction(connectionId, actionId, options, delay, uniquenessId) {
const changedSessionIds = []

if (this.#currentSession) {
Expand All @@ -382,7 +383,7 @@ export default class ActionRecorder extends EventEmitter {
instance: connectionId,
action: actionId,
options: options,
delay: session.actionDelay ?? 0,
delay: (session.actionDelay ?? 0) + delay,

uniquenessId,
}
Expand Down
5 changes: 4 additions & 1 deletion companion/lib/Instance/Definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class InstanceDefinitions extends CoreBase {
}

if (style.text) {
// @ts-expect-error not in module typings
if (style.textExpression) {
try {
const parseResult = this.instance.variable.parseExpression(style.text, null)
Expand Down Expand Up @@ -345,6 +344,7 @@ class InstanceDefinitions extends CoreBase {
action: action.action,
options: cloneDeep(action.options ?? {}),
delay: action.delay ?? 0,
headline: action.headline,
}))
}
}
Expand All @@ -358,6 +358,7 @@ class InstanceDefinitions extends CoreBase {
options: cloneDeep(feedback.options ?? {}),
isInverted: feedback.isInverted,
style: cloneDeep(feedback.style),
headline: feedback.headline,
}))
}

Expand Down Expand Up @@ -457,6 +458,7 @@ class InstanceDefinitions extends CoreBase {
options: fb.options,
style: fb.style,
isInverted: !!fb.isInverted,
headline: fb.headline,
})),
steps:
rawPreset.steps.length === 0
Expand All @@ -479,6 +481,7 @@ class InstanceDefinitions extends CoreBase {
action: act.actionId,
options: act.options,
delay: act.delay,
headline: act.headline,
}))
}

Expand Down
4 changes: 4 additions & 0 deletions companion/lib/Instance/Wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,11 +797,15 @@ class SocketEventsHandler {
* @returns {Promise<void>}
*/
async #handleRecordAction(msg) {
let delay = msg.delay || 0
if (isNaN(delay) || delay < 0) delay = 0

try {
this.#registry.controls.actionRecorder.receiveAction(
this.connectionId,
msg.actionId,
msg.options,
delay,
msg.uniquenessId ?? undefined
)
} catch (/** @type {any} */ e) {
Expand Down
15 changes: 9 additions & 6 deletions companion/lib/Internal/Surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,19 +554,22 @@ export default class Surface {
* @param {number | 'back' | 'forward' | '+1' | '-1'} toPage
*/
#changeSurfacePage(surfaceId, toPage) {
const currentPage = this.#surfaceController.devicePageGet(surfaceId, true)
const groupId = this.#surfaceController.getGroupIdFromDeviceId(surfaceId)
if (!groupId) return

const currentPage = this.#surfaceController.devicePageGet(groupId, true)
if (currentPage === undefined) {
// Bad surfaceId
// Bad groupId
} else {
// no history yet
// start with the current (from) page
let pageHistory = this.#pageHistory.get(surfaceId)
let pageHistory = this.#pageHistory.get(groupId)
if (!pageHistory) {
pageHistory = {
history: [currentPage],
index: 0,
}
this.#pageHistory.set(surfaceId, pageHistory)
this.#pageHistory.set(groupId, pageHistory)
}

if (toPage === 'back' || toPage === 'forward') {
Expand All @@ -579,7 +582,7 @@ export default class Surface {
if (pageTarget !== undefined) {
pageHistory.index = pageIndex

this.#surfaceController.devicePageSet(surfaceId, pageTarget, true)
this.#surfaceController.devicePageSet(groupId, pageTarget, true)
}
} else {
let newPage = toPage
Expand All @@ -595,7 +598,7 @@ export default class Surface {
if (isNaN(newPage)) newPage = 1

// Change page
this.#surfaceController.devicePageSet(surfaceId, newPage, true, true)
this.#surfaceController.devicePageSet(groupId, newPage, true, true)

// Clear forward page history beyond current index, add new history entry, increment index;
pageHistory.history = pageHistory.history.slice(0, pageHistory.index + 1)
Expand Down
4 changes: 1 addition & 3 deletions companion/lib/Log/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import winston from 'winston'
import Transport from 'winston-transport'
import supportsColor from 'supports-color'
import consoleColors from './Colors.js'
import { init, addBreadcrumb, getCurrentScope } from '@sentry/node'
import { rewriteFramesIntegration } from '@sentry/integrations'
import '@sentry/tracing'
import { init, addBreadcrumb, getCurrentScope, rewriteFramesIntegration } from '@sentry/node'
import debounceFn from 'debounce-fn'

const SentrySeverity = {
Expand Down
12 changes: 12 additions & 0 deletions companion/lib/Surface/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,18 @@ class SurfaceController extends CoreBase {
}
}

/**
* Get the groupId for a surfaceId (or groupId)
* @param {string} surfaceOrGroupId
* @param {boolean=} looseIdMatching
* @returns {string | undefined}
*/
getGroupIdFromDeviceId(surfaceOrGroupId, looseIdMatching) {
const surfaceGroup = this.#getGroupForId(surfaceOrGroupId, looseIdMatching)

return surfaceGroup?.groupId
}

#resetAllDevices() {
// Destroy any groups and detach their contents
for (const surfaceGroup of this.#surfaceGroups.values()) {
Expand Down
6 changes: 2 additions & 4 deletions companion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@
},
"dependencies": {
"@companion-app/shared": "*",
"@companion-module/base": "~1.8.0",
"@companion-module/base": "~1.9.0-2",
"@elgato-stream-deck/node": "^6.2.0",
"@julusian/image-rs": "^0.4.0",
"@julusian/jpeg-turbo": "^2.1.0",
"@loupedeck/node": "^1.1.2",
"@napi-rs/canvas": "^0.1.53",
"@sentry/integrations": "^7.118.0",
"@sentry/node": "^7.118.0",
"@sentry/tracing": "^7.118.0",
"@sentry/node": "^8.13.0",
"archiver": "^7.0.1",
"body-parser": "^1.20.2",
"bonjour-service": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion launcher/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import path from 'path'
import url, { fileURLToPath } from 'url'
import fs from 'fs-extra'
import { init, getCurrentScope } from '@sentry/electron'
import { init, getCurrentScope } from '@sentry/electron/main'
import systeminformation from 'systeminformation'
import Store from 'electron-store'
import electron, { ipcMain, app, BrowserWindow, dialog } from 'electron'
Expand Down
2 changes: 1 addition & 1 deletion launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dev": "electron dev.cjs"
},
"dependencies": {
"@sentry/electron": "^4.24.0",
"@sentry/electron": "^5.1.0",
"chokidar": "^3.6.0",
"debounce-fn": "^6.0.0",
"electron-store": "^10.0.0",
Expand Down
7 changes: 4 additions & 3 deletions module-legacy/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4767,6 +4767,7 @@ stream-shift@^1.0.0:
integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==

"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0:
name string-width-cjs
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -5358,9 +5359,9 @@ ws@8.13.0:
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==

ws@^7.4.5, ws@^7.4.6, ws@^7.5.5:
version "7.5.9"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591"
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==
version "7.5.10"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9"
integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==

ws@~7.4.2:
version "7.4.6"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@companion-app/workspace",
"version": "3.4.0",
"packageManager": "yarn@4.2.1",
"packageManager": "yarn@4.3.1",
"workspaces": [
"companion",
"shared-lib",
Expand Down
2 changes: 2 additions & 0 deletions shared-lib/lib/Model/Presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ export interface PresetFeedbackInstance {
options: CompanionOptionValues
style: Partial<CompanionButtonStyleProps> | undefined
isInverted?: boolean
headline?: string
}

export interface PresetActionInstance {
action: string
options: CompanionOptionValues
delay: number
headline?: string
}

export interface PresetActionSets {
Expand Down
Loading

0 comments on commit e5cf878

Please sign in to comment.