Skip to content

Commit

Permalink
Merge branch 'v5' into v5-set-user-currency-command
Browse files Browse the repository at this point in the history
  • Loading branch information
CaveMobster authored Dec 23, 2024
2 parents 03bae66 + 8cf66b3 commit bf58b7f
Show file tree
Hide file tree
Showing 95 changed files with 1,534 additions and 2,704 deletions.
7 changes: 0 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,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 Down
8 changes: 4 additions & 4 deletions src/backend/app-management/electron/events/when-ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ 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();
}
Expand Down Expand Up @@ -233,8 +233,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 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
13 changes: 6 additions & 7 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 @@ -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
Loading

0 comments on commit bf58b7f

Please sign in to comment.