Skip to content

Commit

Permalink
Merge branch 'v5' into custom-scripts-overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
ebiggz committed Dec 27, 2024
2 parents cd4ba0a + 2bc5e84 commit b77cd7c
Show file tree
Hide file tree
Showing 298 changed files with 3,943 additions and 6,866 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Firebot Discord
url: https://discord.gg/crowbartools
url: https://discord.gg/crowbartools-372817064034959370
about: Feel free to drop by our Discord to get support with an issue or ask a question!
- name: Firebot Twitter
url: https://twitter.com/firebotapp
about: Send us a tweet!
- name: Firebot Bluesky
url: https://bsky.app/profile/firebot.app
about: Send us a post!
2 changes: 1 addition & 1 deletion .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
### Need help or have a question?
Please feel free to stop by our [Discord](https://discord.gg/tTmMbrG) or DM us on [Twitter](https://twitter.com/FirebotApp)!
Please feel free to stop by our [Discord](https://discord.gg/crowbartools-372817064034959370) or connect with us on [Bluesky](https://bsky.app/profile/firebot.app)!
4 changes: 2 additions & 2 deletions .github/workflows/compile-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
run: grunt build

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}
path: ./dist/install/${{ runner.os == 'macOS' && 'darwin' || runner.os }}/
Expand All @@ -118,7 +118,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download Compilation Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ./bundles/

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

An all-in-one desktop bot for Twitch featuring support for Chat Commands, Events, Timers, Currencies, Third Party Integrations, and so much more. Visit Firebot's [website](https://firebot.app) for more info.

![Build Status](https://github.com/crowbartools/Firebot/workflows/Build%20Status/badge.svg?branch=master)
![Build Status](https://github.com/crowbartools/Firebot/workflows/Build%20and%20Draft%20Release/badge.svg?branch=master)
![Build Status](https://github.com/crowbartools/Firebot/workflows/Build%20Tests/badge.svg?branch=v5)
[![Total Downloads](https://img.shields.io/github/downloads/crowbartools/firebot/total.svg)](https://firebot.app)
[![Version](https://img.shields.io/github/release/crowbartools/firebot.svg)](https://github.com/crowbartools/Firebot/releases)
[![Discord](https://img.shields.io/discord/372817064034959370.svg?label=Discord+(chat))](https://discord.gg/DegW792)
[![Discord](https://img.shields.io/discord/372817064034959370.svg?label=Discord+(chat))](https://discord.gg/crowbartools-372817064034959370)
[![Bluesky](https://img.shields.io/badge/[email protected]?logo=bluesky&logoColor=fff)](https://bsky.app/profile/firebot.app)

![Firebot Screenshot](https://i.imgur.com/Iu9BIix.png)

Expand All @@ -15,7 +16,7 @@ An all-in-one desktop bot for Twitch featuring support for Chat Commands, Events
Head on over to [Firebot's website](https://firebot.app) and download the latest version!

### What if I have a question or need help?
Please visit our [Discord server](https://discord.gg/DegW792) or send us a [Threads](https://threads.net/@FirebotApp) or [Bluesky](https://bsky.app/profile/firebot.app). We are more than happy to help.
Please visit our [Discord server](https://discord.gg/crowbartools-372817064034959370) or send us a [Threads](https://threads.net/@FirebotApp) or [Bluesky](https://bsky.app/profile/firebot.app). We are more than happy to help.

### I found a bug, how do I report it?
You can create a Bug Report [here](https://github.com/crowbartools/Firebot/issues/new?assignees=ebiggz%2C+LastMageTV&labels=bug&template=bug_report.md&title=%5BBUG%5D+). We'll reply as soon as we can.
Expand Down
188 changes: 103 additions & 85 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@types/fs-extra": "^11.0.4",
"@types/luxon": "^3.1.0",
"@types/node": "^18.18.2",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"electron": "^31.4.0",
Expand All @@ -46,11 +45,11 @@
"@aws-sdk/client-polly": "^3.26.0",
"@crowbartools/firebot-custom-scripts-types": "^5.53.2-6",
"@seald-io/nedb": "^4.0.4",
"@twurple/api": "^7.1.0",
"@twurple/auth": "^7.1.0",
"@twurple/chat": "^7.1.0",
"@twurple/eventsub-ws": "^7.1.0",
"@twurple/pubsub": "^7.1.0",
"@twurple/api": "^7.2.1",
"@twurple/auth": "^7.2.1",
"@twurple/chat": "^7.2.1",
"@twurple/eventsub-ws": "^7.2.1",
"@twurple/pubsub": "^7.2.1",
"@types/tinycolor2": "^1.4.6",
"@zunderscore/elgato-light-control": "^1.1.2",
"angular": "^1.8.0",
Expand Down Expand Up @@ -98,7 +97,6 @@
"fuse.js": "^7.0.0",
"glob": "^10.3.10",
"he": "^1.2.0",
"howler": "https://github.com/ebiggz/howler.js/tarball/master",
"list.js": "^1.5.0",
"luxon": "^3.1.1",
"marked": "^13.0.3",
Expand All @@ -120,7 +118,7 @@
"tiny-typed-emitter": "^2.1.0",
"tinycolor2": "^1.6.0",
"underscore": "^1.13.1",
"uuid": "^3.3.3",
"uuid": "^11.0.3",
"winston": "^2.4.4",
"winston-daily-rotate-file": "^1.7.2",
"ws": "^8.2.2",
Expand Down
11 changes: 11 additions & 0 deletions src/backend/app-management/electron/events/open-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ exports.openUrl = async (event, url) => {
}
break;

case "dashboard":
case "commands":
case "events":
case "time-based":
case "channel-rewards":
case "preset-effect-lists":
case "hotkeys":
case "counters":
frontendCommunicator.send("navigate", urlParams[0]);
break;

default:
logger.debug("No matching URL commands found");
break;
Expand Down
22 changes: 9 additions & 13 deletions src/backend/app-management/electron/events/when-ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ exports.whenReady = async () => {
windowManagement.updateSplashScreenStatus("Refreshing Twitch account data...");
await accountAccess.refreshTwitchData();

const twitchFrontendListeners = require("../../../twitch-api/frontend-twitch-listeners");
twitchFrontendListeners.setupListeners();

windowManagement.updateSplashScreenStatus("Starting stream status poll...");
connectionManager.startOnlineCheckInterval();

Expand Down Expand Up @@ -117,8 +114,9 @@ exports.whenReady = async () => {
const { loadRestrictions } = require("../../../restrictions/builtin-restrictions-loader");
loadRestrictions();

const fontManager = require("../../../fontManager");
fontManager.generateAppFontCssFile();
windowManagement.updateSplashScreenStatus("Loading fonts...");
const { FontManager } = require("../../../font-manager");
await FontManager.loadInstalledFonts();

windowManagement.updateSplashScreenStatus("Loading events...");
const eventsAccess = require("../../../events/events-access");
Expand Down Expand Up @@ -178,16 +176,14 @@ exports.whenReady = async () => {
builtinGameLoader.loadGames();

windowManagement.updateSplashScreenStatus("Loading custom variables...");
const {settings} = require("../../../common/settings-access");
if (settings.getPersistCustomVariables()) {
const { SettingsManager } = require("../../../common/settings-manager");
if (SettingsManager.getSetting("PersistCustomVariables")) {
const customVariableManager = require("../../../common/custom-variable-manager");
customVariableManager.loadVariablesFromFile();
}

// get importer in memory
windowManagement.updateSplashScreenStatus("Loading importers...");
const v4Importer = require("../../../import/v4/v4-importer");
v4Importer.setupListeners();

const setupImporter = require("../../../import/setups/setup-importer");
setupImporter.setupListeners();
Expand Down Expand Up @@ -235,8 +231,8 @@ exports.whenReady = async () => {
global.SCRIPTS_DIR = profileManager.getPathInProfile("/scripts/");

windowManagement.updateSplashScreenStatus("Running daily backup...");
const backupManager = require("../../../backup-manager");
await backupManager.onceADayBackUpCheck();
const { BackupManager } = require("../../../backup-manager");
await BackupManager.onceADayBackUpCheck();

// start the REST api server
windowManagement.updateSplashScreenStatus("Starting internal web server...");
Expand All @@ -254,8 +250,8 @@ exports.whenReady = async () => {
// load activity feed manager
require("../../../events/activity-feed-manager");

const iconManager = require("../../../common/icon-manager");
iconManager.loadFontAwesomeIcons();
const { IconManager } = require("../../../common/icon-manager");
await IconManager.loadFontAwesomeIcons();

windowManagement.updateSplashScreenStatus("Starting stream info poll...");
const streamInfoPoll = require("../../../twitch-api/stream-info-manager");
Expand Down
10 changes: 5 additions & 5 deletions src/backend/app-management/electron/events/windows-all-closed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ exports.windowsAllClosed = async () => {
const logger = require("../../../logwrapper");
logger.debug("All windows closed triggered");

const { settings } = require("../../../common/settings-access");
const backupManager = require("../../../backup-manager");
const { SettingsManager } = require("../../../common/settings-manager");
const { BackupManager } = require("../../../backup-manager");

// Stop all scheduled tasks
const scheduledTaskManager = require("../../../timers/scheduled-task-manager");
Expand All @@ -27,7 +27,7 @@ exports.windowsAllClosed = async () => {
chatModerationManager.stopService();

// Persist custom variables
if (settings.getPersistCustomVariables()) {
if (SettingsManager.getSetting("PersistCustomVariables")) {
const customVariableManager = require("../../../common/custom-variable-manager");
customVariableManager.persistVariablesToFile();
}
Expand All @@ -36,9 +36,9 @@ exports.windowsAllClosed = async () => {
const viewerOnlineStatusManager = require("../../../viewers/viewer-online-status-manager");
await viewerOnlineStatusManager.setAllViewersOffline();

if (settings.backupOnExit()) {
if (SettingsManager.getSetting("BackupOnExit")) {
// Make a backup
await backupManager.startBackup(false, app.quit);
await BackupManager.startBackup(false, app.quit);
} else {
app.quit();
}
Expand Down
4 changes: 2 additions & 2 deletions src/backend/app-management/electron/tray-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const electron = require("electron");
const { Menu, Tray, app, nativeImage } = electron;

const frontendCommunicator = require('../../common/frontend-communicator.js');
const { settings } = require("../../common/settings-access");
const { SettingsManager } = require("../../common/settings-manager");

let mainTray;
let minimizedToTray = false;
Expand Down Expand Up @@ -62,7 +62,7 @@ module.exports = function createTray(mainWindow) {
});

mainWindow.on('minimize', () => {
if (settings.getMinimizeToTray() && minimizedToTray !== true) {
if (SettingsManager.getSetting("MinimizeToTray") && minimizedToTray !== true) {
mainWindow.hide();
minimizedToTray = true;
}
Expand Down
21 changes: 10 additions & 11 deletions src/backend/app-management/electron/window-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const logger = require("../../logwrapper");
const { setupTitlebar, attachTitlebarToWindow } = require("custom-electron-titlebar/main");
const screenHelpers = require("./screen-helpers");
const frontendCommunicator = require("../../common/frontend-communicator");
const { settings } = require("../../common/settings-access");
const { SettingsManager } = require("../../common/settings-manager");
const { BackupManager } = require("../../backup-manager");

const argv = require('../../common/argv-parser');

Expand Down Expand Up @@ -253,9 +254,7 @@ async function createMainWindow() {
toolTip: "Open the folder where backups are stored",
sublabel: "Open the folder where backups are stored",
click: () => {
const backupFolder = path.resolve(
dataAccess.getPathInUserData("/backups/")
);
const backupFolder = BackupManager.backupFolderPath;
shell.openPath(backupFolder);
},
icon: await createIconImage("../../../gui/images/icons/mdi/folder-refresh-outline.png")
Expand Down Expand Up @@ -330,7 +329,7 @@ async function createMainWindow() {
toolTip: "Restores Firebot from a backup",
sublabel: "Restores Firebot from a backup",
click: async () => {
frontendCommunicator.send("restore-backup");
frontendCommunicator.send("backups:start-restore-backup");
},
icon: await createIconImage("../../../gui/images/icons/mdi/backup-restore.png")
},
Expand Down Expand Up @@ -359,16 +358,16 @@ async function createMainWindow() {
{
label: 'Join our Discord',
click: () => {
shell.openExternal("https://discord.gg/tTmMbrG");
shell.openExternal("https://discord.gg/crowbartools-372817064034959370");
},
icon: await createIconImage("../../../gui/images/icons/discord.png")
},
{
label: 'Follow @FirebotApp on Twitter',
label: 'Follow @firebot.app on Bluesky',
click: () => {
shell.openExternal("https://twitter.com/FirebotApp");
shell.openExternal("https://bsky.app/profile/firebot.app");
},
icon: await createIconImage("../../../gui/images/icons/mdi/twitter.png")
icon: await createIconImage("../../../gui/images/icons/bluesky.png")
},
{
type: 'separator'
Expand Down Expand Up @@ -473,7 +472,7 @@ async function createMainWindow() {
username: "Firebot"
});

if (settings.getOpenStreamPreviewOnLaunch() === true) {
if (SettingsManager.getSetting("OpenStreamPreviewOnLaunch") === true) {
createStreamPreviewWindow();
}

Expand All @@ -483,7 +482,7 @@ async function createMainWindow() {

mainWindow.on("close", (event) => {
const connectionManager = require("../../common/connection-manager");
if (!settings.hasJustUpdated() && connectionManager.chatIsConnected() && connectionManager.streamerIsOnline()) {
if (!SettingsManager.getSetting("JustUpdated") && connectionManager.chatIsConnected() && connectionManager.streamerIsOnline()) {
event.preventDefault();
dialog.showMessageBox(mainWindow, {
message: "Are you sure you want to close Firebot while connected to Twitch?",
Expand Down
6 changes: 3 additions & 3 deletions src/backend/auth/auth-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { EventEmitter } from "events";
import ClientOAuth2 from "client-oauth2";
import logger from "../logwrapper";
import { AuthProvider, AuthProviderDefinition } from "./auth";
import { settings } from "../common/settings-access";
import { SettingsManager } from "../common/settings-manager";
import frontendCommunicator from "../common/frontend-communicator";
import { Notification, app } from "electron";
import windowManagement from "../app-management/electron/window-management";

class AuthManager extends EventEmitter {
private readonly _httpPort: string;
private readonly _httpPort: number;
private _authProviders: AuthProvider[];

constructor() {
super();

this._authProviders = [];
this._httpPort = settings.getWebServerPort();
this._httpPort = SettingsManager.getSetting("WebServerPort");
}

registerAuthProvider(provider: AuthProviderDefinition): void {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/auth/twitch-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from "axios";
import authManager from "./auth-manager";
import accountAccess, { FirebotAccount } from "../common/account-access";
import logger from "../logwrapper";
import { secrets } from "../secrets-manager";
import { SecretsManager } from "../secrets-manager";
import { AuthProviderDefinition } from "./auth";
import { getExpiryDateOfAccessToken } from "@twurple/auth";

Expand All @@ -14,7 +14,7 @@ class TwitchAuthProviders {
readonly streamerAccountProviderId = "twitch:streamer-account";
readonly botAccountProviderId = "twitch:bot-account";

readonly twitchClientId = secrets.twitchClientId;
readonly twitchClientId = SecretsManager.secrets.twitchClientId;

readonly streamerAccountProvider: AuthProviderDefinition = {
id: this.streamerAccountProviderId,
Expand Down
Loading

0 comments on commit b77cd7c

Please sign in to comment.