Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit 872d6fb

Browse files
committed
Merge branch 'master' into feature/9-remove-client-listeners
2 parents c71e3f7 + 2de19bc commit 872d6fb

File tree

20 files changed

+106
-29
lines changed

20 files changed

+106
-29
lines changed

nodecg-io-core/dashboard/authentication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const spanPasswordNotice = document.getElementById("spanPasswordNotice") as HTML
1212

1313
// Add key listener to password input
1414
inputPassword?.addEventListener("keyup", function (event) {
15-
if (event.keyCode === 13) {
15+
if (event.keyCode === 13 || event.key === "Enter") {
1616
event.preventDefault();
1717
loadFramework();
1818
}

nodecg-io-core/dashboard/bundles.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function renderBundleDeps(): void {
2929
return;
3030
}
3131

32-
const bundle = selectBundle.options[selectBundle.selectedIndex].value;
32+
const bundle = selectBundle.options[selectBundle.selectedIndex]?.value;
3333
const bundleDependencies = config.data.bundles[bundle];
3434
if (bundleDependencies === undefined) {
3535
return;
@@ -49,7 +49,7 @@ export function renderInstanceSelector(): void {
4949
}
5050

5151
// Rendering options
52-
const serviceType = selectBundleDepTypes.options[selectBundleDepTypes.selectedIndex].value;
52+
const serviceType = selectBundleDepTypes.options[selectBundleDepTypes.selectedIndex]?.value;
5353
const instances = ["none"];
5454

5555
for (const instName in config.data.instances) {
@@ -64,7 +64,7 @@ export function renderInstanceSelector(): void {
6464
updateOptionsArr(selectBundleInstance, instances);
6565

6666
// Selecting option of current set instance
67-
const bundle = selectBundle.options[selectBundle.selectedIndex].value;
67+
const bundle = selectBundle.options[selectBundle.selectedIndex]?.value;
6868
const currentInstance = config.data.bundles[bundle]?.find((dep) => dep.serviceType === serviceType)
6969
?.serviceInstance;
7070
let index = 0;
@@ -78,9 +78,9 @@ export function renderInstanceSelector(): void {
7878
}
7979

8080
export async function setServiceDependency(): Promise<void> {
81-
const bundle = selectBundle.options[selectBundle.selectedIndex].value;
82-
const instance = selectBundleInstance.options[selectBundleInstance.selectedIndex].value;
83-
const type = selectBundleDepTypes.options[selectBundleDepTypes.selectedIndex].value;
81+
const bundle = selectBundle.options[selectBundle.selectedIndex]?.value;
82+
const instance = selectBundleInstance.options[selectBundleInstance.selectedIndex]?.value;
83+
const type = selectBundleDepTypes.options[selectBundleDepTypes.selectedIndex]?.value;
8484

8585
const msg: Partial<SetServiceDependencyMessage> = {
8686
bundleName: bundle,

nodecg-io-core/dashboard/serviceInstance.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export async function saveInstanceConfig(): Promise<void> {
117117
showError(undefined);
118118

119119
try {
120-
const instName = selectInstance.options[selectInstance.selectedIndex].value;
120+
const instName = selectInstance.options[selectInstance.selectedIndex]?.value;
121121
const config = JSON.parse(editor.getValue());
122122
const msg: Partial<UpdateInstanceConfigMessage> = {
123123
config: config,
@@ -133,7 +133,7 @@ export async function saveInstanceConfig(): Promise<void> {
133133
// Delete button
134134
export async function deleteInstance(): Promise<void> {
135135
const msg: Partial<DeleteServiceInstanceMessage> = {
136-
instanceName: selectInstance.options[selectInstance.selectedIndex].value,
136+
instanceName: selectInstance.options[selectInstance.selectedIndex]?.value,
137137
};
138138

139139
const deleted = await sendAuthenticatedMessage("deleteServiceInstance", msg);
@@ -146,15 +146,22 @@ export async function deleteInstance(): Promise<void> {
146146

147147
// Create button
148148
export async function createInstance(): Promise<void> {
149-
const service = selectService.options[selectService.options.selectedIndex].value;
149+
showError(undefined);
150+
const service = selectService.options[selectService.options.selectedIndex]?.value;
150151
const name = inputInstanceName.value;
151152

152153
const msg: Partial<CreateServiceInstanceMessage> = {
153154
serviceType: service,
154155
instanceName: name,
155156
};
156157

157-
await sendAuthenticatedMessage("createServiceInstance", msg);
158+
try {
159+
await sendAuthenticatedMessage("createServiceInstance", msg);
160+
} catch (e) {
161+
showError(e);
162+
return;
163+
}
164+
158165
// Give the browser some time to create the new instance select option and to add them to the DOM
159166
setTimeout(() => {
160167
selectServiceInstance(name);
@@ -203,7 +210,7 @@ function renderInstances() {
203210
function selectServiceInstance(instanceName: string) {
204211
for (let i = 0; i < selectInstance.options.length; i++) {
205212
const opt = selectInstance.options[i];
206-
if (opt.value === instanceName) {
213+
if (opt?.value === instanceName) {
207214
selectInstance.selectedIndex = i;
208215
onInstanceSelectChange(instanceName);
209216
break;

nodecg-io-core/extension/instanceManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export class InstanceManager extends EventEmitter {
4848
* @return void if everything went fine and a string describing the issue if not
4949
*/
5050
createServiceInstance(serviceType: string, instanceName: string): Result<void> {
51+
if (!instanceName) {
52+
return error("Instance name must not be empty.");
53+
}
54+
5155
// Check if a instance with the same name already exists.
5256
if (this.serviceInstances[instanceName] !== undefined) {
5357
return error("A service instance with the same name already exists.");

nodecg-io-irc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
},
3131
"license": "MIT",
3232
"devDependencies": {
33-
"@types/irc": "^0.3.33",
3433
"@types/node": "^14.14.13",
3534
"nodecg": "^1.7.4",
3635
"typescript": "^4.1.3"
3736
},
3837
"dependencies": {
38+
"@types/irc": "^0.3.33",
3939
"irc": "^0.5.2",
4040
"nodecg-io-core": "^0.1.0"
4141
}

nodecg-io-serial/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"license": "MIT",
3333
"devDependencies": {
3434
"@types/node": "^14.14.13",
35-
"@types/serialport": "^8.0.1",
3635
"nodecg": "^1.7.4",
3736
"typescript": "^4.1.3"
3837
},
3938
"dependencies": {
39+
"@types/serialport": "^8.0.1",
4040
"@serialport/parser-readline": "^9.0.1",
4141
"nodecg-io-core": "^0.1.0",
4242
"serialport": "^9.0.3"

nodecg-io-telegram/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
"license": "MIT",
3232
"devDependencies": {
3333
"@types/node": "^14.14.13",
34-
"@types/node-telegram-bot-api": "^0.50.4",
3534
"nodecg": "^1.7.4",
3635
"typescript": "^4.1.3"
3736
},
3837
"dependencies": {
39-
"nodecg-io-core": "^0.1.0",
40-
"node-telegram-bot-api": "^0.51.0"
38+
"@types/node-telegram-bot-api": "^0.50.4",
39+
"node-telegram-bot-api": "^0.51.0",
40+
"nodecg-io-core": "^0.1.0"
4141
}
4242
}

nodecg-io-twitch/extension/index.ts renamed to nodecg-io-twitch-chat/extension/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface TwitchServiceConfig {
1010
export { TwitchServiceClient } from "./twitchClient";
1111

1212
module.exports = (nodecg: NodeCG) => {
13-
new TwitchService(nodecg, "twitch", __dirname, "../twitch-schema.json").register();
13+
new TwitchService(nodecg, "twitch-chat", __dirname, "../twitch-schema.json").register();
1414
};
1515

1616
class TwitchService extends ServiceBundle<TwitchServiceConfig, TwitchServiceClient> {

nodecg-io-twitch/package.json renamed to nodecg-io-twitch-chat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "nodecg-io-twitch",
2+
"name": "nodecg-io-twitch-chat",
33
"version": "0.1.0",
44
"description": "Allows to connect to twitch with your account, send and receive messages and much more. It can be used to create Twitch-Bots.",
55
"homepage": "https://nodecg.io/samples/twitch",

0 commit comments

Comments
 (0)