Skip to content

Commit b5ea3ee

Browse files
authored
Merge branch 'v5' into poll-and-prediction-overlay-widgets
2 parents 52f08c0 + 8268ea3 commit b5ea3ee

69 files changed

Lines changed: 488 additions & 384 deletions

File tree

Some content is hidden

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

‎package-lock.json‎

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

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"motion-v": "^2.3.0",
114114
"ng-toast": "^2.0.0",
115115
"ng-youtube-embed": "^1.7.16",
116-
"node-cache": "^4.2.1",
116+
"node-cache": "^5.1.2",
117117
"node-hue-api": "^5.0.0-beta.16",
118118
"node-json-db": "^1.4.1",
119119
"node-xlsx": "^0.24.0",

‎src/backend/app-management/electron/screen-helpers.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export async function takeScreenshot(displayId: number): Promise<string> {
1616
const matchingScreen = screens.find(d => d.id === displayId);
1717

1818
const resolution = matchingScreen ? {
19-
width: matchingScreen.size.width * matchingScreen.scaleFactor,
20-
height: matchingScreen.size.height * matchingScreen.scaleFactor
19+
width: Math.round(matchingScreen.size.width * matchingScreen.scaleFactor),
20+
height: Math.round(matchingScreen.size.height * matchingScreen.scaleFactor)
2121
} : {
2222
width: 1920,
2323
height: 1080

‎src/backend/app-management/electron/window-management.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,11 @@ function updateSplashScreenStatus(newStatus) {
741741

742742
SettingsManager.on("settings:setting-updated:OverlayInstances", createAppMenu);
743743

744-
frontendCommunicator.on("getAllDisplays", () => {
744+
frontendCommunicator.onAsync("getAllDisplays", async () => {
745745
return screenHelpers.getAllDisplays();
746746
});
747747

748-
frontendCommunicator.on("getPrimaryDisplay", () => {
748+
frontendCommunicator.onAsync("getPrimaryDisplay", async () => {
749749
return screenHelpers.getPrimaryDisplay();
750750
});
751751

‎src/backend/effects/builtin/take-screenshot.ts‎

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { EffectType, DiscordCustomEmbed } from "../../../types";
1+
import type {
2+
EffectType,
3+
DiscordCustomEmbed,
4+
BackendCommunicator
5+
} from "../../../types";
26

37
import { takeScreenshot } from "../../app-management/electron/screen-helpers";
48
import {
@@ -49,7 +53,9 @@ const effect: EffectType<{
4953
},
5054
optionsTemplate: `
5155
<eos-container header="Display">
52-
<dropdown-select options="displayOptions" selected="effect.displayId"></dropdown-select>
56+
<firebot-dropdown
57+
options="displayOptions"
58+
ng-model="effect.displayId" />
5359
</eos-container>
5460
5561
<screenshot-effect-options effect="effect"></screenshot-effect-options>
@@ -60,20 +66,32 @@ const effect: EffectType<{
6066
</div>
6167
</eos-container>
6268
`,
63-
optionsController: ($scope, backendCommunicator) => {
64-
const displays = backendCommunicator.fireEventSync("getAllDisplays") as Electron.Display[];
65-
const primaryDisplay = backendCommunicator.fireEventSync("getPrimaryDisplay") as Electron.Display;
66-
67-
$scope.displayOptions = displays.reduce((acc, display, i) => {
68-
const isPrimary = display.id === primaryDisplay.id;
69-
acc[display.id] = `Display ${i + 1}${isPrimary ? ` (Primary)` : ''}`;
70-
return acc;
71-
}, {});
72-
73-
if ($scope.effect.displayId == null ||
74-
$scope.displayOptions[$scope.effect.displayId] == null) {
75-
$scope.effect.displayId = displays[0].id;
76-
}
69+
optionsController: ($scope, backendCommunicator: BackendCommunicator) => {
70+
$scope.displayOptions = [];
71+
72+
$scope.refreshDisplays = async () => {
73+
const displays: Electron.Display[] = await backendCommunicator.fireEventAsync("getAllDisplays");
74+
const primaryDisplay: Electron.Display = await backendCommunicator.fireEventAsync("getPrimaryDisplay");
75+
76+
let i = 1;
77+
$scope.displayOptions = displays.map((d) => {
78+
const isPrimary = d.id === primaryDisplay.id;
79+
return {
80+
name: isPrimary
81+
? `Display ${i++} (${d.label}) (Primary)`
82+
: `Display ${i++} (${d.label})`,
83+
value: d.id
84+
};
85+
});
86+
87+
if ($scope.effect.displayId == null
88+
|| !$scope.displayOptions.some(d => d.value === $scope.effect.displayId)
89+
) {
90+
$scope.effect.displayId = displays[0].id;
91+
}
92+
};
93+
94+
$scope.refreshDisplays();
7795
},
7896
optionsValidator: (effect) => {
7997
const errors: string[] = [];

‎src/backend/integrations/builtin/obs/communicator.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import {
2222
export function setupFrontendListeners(
2323
frontendCommunicator: FrontendCommunicatorModule
2424
) {
25-
frontendCommunicator.on<never, string[]>(
25+
frontendCommunicator.onAsync<never, string[]>(
2626
"obs-get-group-list",
27-
getGroupList
27+
async () => getGroupList()
2828
);
2929

3030
frontendCommunicator.onAsync<never, string[]>(

‎src/backend/integrations/builtin/obs/effects/change-scene-collection.ts‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { EffectType } from "../../../../../types/effects";
1+
import type { EffectType, BackendCommunicator } from "../../../../../types";
22
import { setCurrentSceneCollection } from "../obs-remote";
33

44
export const ChangeSceneCollectionEffectType: EffectType<{
55
sceneCollectionName: string;
6+
custom: boolean;
67
}> = {
78
definition: {
89
id: "ebiggz:obs-change-scene-collection",
@@ -31,30 +32,29 @@ export const ChangeSceneCollectionEffectType: EffectType<{
3132
</div>
3233
</eos-container>
3334
`,
34-
optionsController: ($scope: any, backendCommunicator: any, $q: any) => {
35+
optionsController: ($scope, backendCommunicator: BackendCommunicator) => {
3536
$scope.isObsConfigured = false;
3637

3738
$scope.sceneCollections = [];
3839

39-
$scope.customCollection = {name: "Set Custom", custom: true};
40+
$scope.customCollection = { name: "Set Custom", custom: true };
4041

41-
$scope.selectSceneCollection = (sceneCollection: {name: string, custom: boolean}) => {
42+
$scope.selectSceneCollection = (sceneCollection: { name: string, custom: boolean }) => {
4243
$scope.effect.custom = sceneCollection.custom;
4344
if (!sceneCollection.custom) {
4445
$scope.effect.sceneCollectionName = sceneCollection.name;
4546
}
4647
};
4748

48-
$scope.getSceneCollections = () => {
49-
$scope.isObsConfigured = backendCommunicator.fireEventSync("obs-is-configured");
49+
$scope.getSceneCollections = async () => {
50+
$scope.isObsConfigured = await backendCommunicator.fireEventAsync("obs-is-configured");
5051

51-
$q.when(
52-
backendCommunicator.fireEventAsync("obs-get-scene-collection-list")
53-
).then((sceneCollections: string[]) => {
52+
try {
53+
const sceneCollections: string[] = await backendCommunicator.fireEventAsync("obs-get-scene-collection-list");
5454
$scope.sceneCollections = [];
5555
if (sceneCollections != null) {
5656
sceneCollections.forEach((sceneCollection) => {
57-
$scope.sceneCollections.push({name: sceneCollection, custom: false});
57+
$scope.sceneCollections.push({ name: sceneCollection, custom: false });
5858
});
5959
}
6060
$scope.sceneCollections.push($scope.customCollection);
@@ -64,8 +64,9 @@ export const ChangeSceneCollectionEffectType: EffectType<{
6464
$scope.selected = $scope.sceneCollections.find(collection =>
6565
collection.name === $scope.effect.sceneCollectionName);
6666
}
67-
});
67+
} catch { }
6868
};
69+
6970
$scope.getSceneCollections();
7071
},
7172
optionsValidator: (effect) => {

‎src/backend/integrations/builtin/obs/effects/change-scene-effect-type.ts‎

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { EffectType } from "../../../../../types/effects";
1+
import type { EffectType, BackendCommunicator } from "../../../../../types";
22
import { setCurrentScene } from "../obs-remote";
33

44
export const ChangeSceneEffectType: EffectType<{
55
sceneName: string;
6+
custom: boolean;
67
}> = {
78
definition: {
89
id: "ebiggz:obs-change-scene",
@@ -31,40 +32,40 @@ export const ChangeSceneEffectType: EffectType<{
3132
</div>
3233
</eos-container>
3334
`,
34-
optionsController: ($scope: any, backendCommunicator: any, $q: any) => {
35+
optionsController: ($scope, backendCommunicator: BackendCommunicator) => {
3536
$scope.isObsConfigured = false;
3637

3738
$scope.scenes = [];
3839

39-
$scope.customScene = {name: "Set Custom", custom: true};
40+
$scope.customScene = { name: "Set Custom", custom: true };
4041

41-
$scope.selectScene = (scene: {name: string, custom: boolean}) => {
42+
$scope.selectScene = (scene: { name: string, custom: boolean }) => {
4243
$scope.effect.custom = scene.custom;
4344
if (!scene.custom) {
4445
$scope.effect.sceneName = scene.name;
4546
}
4647
};
4748

48-
$scope.getScenes = () => {
49-
$scope.isObsConfigured = backendCommunicator.fireEventSync("obs-is-configured");
49+
$scope.getScenes = async () => {
50+
$scope.isObsConfigured = await backendCommunicator.fireEventAsync("obs-is-configured");
5051

51-
$q.when(backendCommunicator.fireEventAsync("obs-get-scene-list")).then(
52-
(scenes: string[]) => {
53-
$scope.scenes = [];
54-
if (scenes != null) {
55-
scenes.forEach((scene) => {
56-
$scope.scenes.push({name: scene, custom: false});
57-
});
58-
}
59-
$scope.scenes.push($scope.customScene);
60-
if ($scope.effect.custom) {
61-
$scope.selected = $scope.customScene;
62-
} else {
63-
$scope.selected = $scope.scenes.find(scene => scene.name === $scope.effect.sceneName);
64-
}
52+
try {
53+
const scenes: string[] = await backendCommunicator.fireEventAsync("obs-get-scene-list");
54+
$scope.scenes = [];
55+
if (scenes != null) {
56+
scenes.forEach((scene) => {
57+
$scope.scenes.push({ name: scene, custom: false });
58+
});
6559
}
66-
);
60+
$scope.scenes.push($scope.customScene);
61+
if ($scope.effect.custom) {
62+
$scope.selected = $scope.customScene;
63+
} else {
64+
$scope.selected = $scope.scenes.find(scene => scene.name === $scope.effect.sceneName);
65+
}
66+
} catch { }
6767
};
68+
6869
$scope.getScenes();
6970
},
7071
optionsValidator: (effect) => {

‎src/backend/integrations/builtin/obs/effects/create-recording-chapter.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EffectType } from "../../../../../types/effects";
1+
import type { EffectType } from "../../../../../types";
22
import { createRecordChapter } from "../obs-remote";
33

44
export const CreateRecordChapter: EffectType<{

‎src/backend/integrations/builtin/obs/effects/save-replay-buffer.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EffectType } from "../../../../../types/effects";
1+
import type { EffectType } from "../../../../../types";
22
import { saveReplayBuffer } from "../obs-remote";
33

44
export const SaveReplayBufferEffectType: EffectType = {
@@ -21,7 +21,7 @@ export const SaveReplayBufferEffectType: EffectType = {
2121
return [];
2222
},
2323
onTriggerEvent: async () => {
24-
saveReplayBuffer();
24+
await saveReplayBuffer();
2525
return true;
2626
}
2727
};

0 commit comments

Comments
 (0)