Skip to content

Commit

Permalink
Merge pull request #170 from LordTocs/tocs
Browse files Browse the repository at this point in the history
Hotfixes for 0.3.0
  • Loading branch information
LordTocs authored Sep 2, 2022
2 parents f82ea44 + 3316c7d commit 96e4154
Show file tree
Hide file tree
Showing 12 changed files with 1,590 additions and 1,208 deletions.
2,658 changes: 1,537 additions & 1,121 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "castmate",
"version": "0.3.0",
"version": "0.3.1",
"private": "true",
"description": "CastMate is a broadcaster tool that allows Twitch viewers to interact with a broadcasters stream components through Chat Commands, Channel Point rewards, and more.",
"author": "LordTocs & FitzBro",
Expand All @@ -9,7 +9,8 @@
"buildpublish": "vite build --mode production && electron-builder --config electron-builder-config.cjs --publish always",
"dev": "vite",
"eb": "electron-builder --config electron-builder-config.cjs",
"postinstall": "electron-builder install-app-deps"
"postinstall": "electron-builder install-app-deps",
"runbuild": "npm run build & cd release/win-unpacked/ && CastMate.exe"
},
"main": "dist/electron/main/backgroundLoader.js",
"engines": {
Expand Down Expand Up @@ -65,7 +66,7 @@
"vue-mixpanel": "^2.0.0",
"vue-router": "^4.0.16",
"vuedraggable": "^4.1.0",
"vuetify": "^3.0.0-beta.9",
"vuetify": "^3.0.0-beta.10",
"vuex": "^4.0.2"
},
"eslintConfig": {
Expand Down
95 changes: 28 additions & 67 deletions src/main/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ import { initCastMate } from './castmate.js';
autoUpdater.autoInstallOnAppQuit = false;
autoUpdater.autoDownload = false;

//Setup dev update yaml only if we're in debug mode.
/*if (isDevelopment) {
autoUpdater.updateConfigPath = path.join(
__dirname,
"../dev-app-update.yml" // change path if needed
);
}*/

// Set application name for Windows 10+ notifications
if (process.platform === 'win32') app.setAppUserModelId(app.getName())

Expand All @@ -34,15 +26,6 @@ if (!app.requestSingleInstanceLock()) {
process.exit(0)
}

/*
// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
])
*/



process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';

const dist = path.join(__dirname, '../..')
Expand All @@ -57,35 +40,51 @@ const ROOT_PATH = {
const iconPath = app.isPackaged ? renderer : 'src/renderer/assets/icons'

const preload = path.join(__dirname, '../preload/preload.js')
const url = `http://${process.env['VITE_DEV_SERVER_HOST']}:${process.env['VITE_DEV_SERVER_PORT']}`
const url = `http://${process.env['VITE_DEV_SERVER_HOSTNAME']}:${process.env['VITE_DEV_SERVER_PORT']}`

let mainWindow = null;
async function createWindow() {
// Create the browser window.

const indexHtml = path.join(ROOT_PATH.renderer, 'index.html')

function createWindowBase(htmlFile, params, width, height) {


const win = new BrowserWindow({
width: 1600,
height: 900,
width,
height,
icon: path.join(iconPath, 'icon.png'),
webPreferences: {
//preload,
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
},
frame: false
})


if (app.isPackaged) {
win.loadFile(indexHtml)
const htmlFullPath = path.join(ROOT_PATH.renderer, htmlFile)
console.log("Loading From File " + htmlFullPath);
win.loadFile(htmlFullPath, {
query: params
})
} else {
win.loadURL(url)
const fullUrl = url + "/" + htmlFile
console.log("Loading From URL " + fullUrl);
win.loadURL(fullUrl, {
query: params
})
}

win.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
});


return win
}

async function createWindow() {
const win = createWindowBase("index.html", null, 1600, 900);

win.on("close", () => {
//Workaround for electron bug.
if (win.webContents.isDevToolsOpened()) {
Expand All @@ -97,50 +96,12 @@ async function createWindow() {
app.quit();
})

win.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
});

mainWindow = win;
}

async function createUpdaterWindow(updateData) {
const updaterHtml = path.join(ROOT_PATH.dist, 'updater.html')

const win = new BrowserWindow({
width: 600,
height: 400,
icon: path.join(iconPath, 'icon.png'),
webPreferences: {

// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: true, //process.env.ELECTRON_NODE_INTEGRATION,
enableRemoteModule: true,
contextIsolation: false,
},
frame: false
})

//remoteMain.enable(win.webContents);

const params = new URLSearchParams(updateData)

if (app.isPackaged) {
win.loadFile(updaterHtml + "?" + params)
} else {
win.loadURL(url + '/updater.html' + "?" + params)
}

const win = createWindowBase("updater.html", updateData, 600, 400)
updateContext.window = win;

win.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
});


}

const updateContext = {};
Expand Down
5 changes: 3 additions & 2 deletions src/main/plugins/obs.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ export default {
required: true,
async enum() {
const { inputs } = await this.obs.call('GetInputList');
return inputs.map(i => i.inputName);
const { scenes } = await this.obs.call('GetSceneList');
return [...inputs.map(i => i.inputName), ...scenes.map(s => s.sceneName)];
}
},
filterName: {
Expand Down Expand Up @@ -383,7 +384,7 @@ export default {
async enum({ scene}) {
this.logger.info('Fetching sources for ' + scene);
const { sceneItems } = await this.obs.call("GetSceneItemList", { sceneName: scene });
return sceneItems.map(i => i.itemName);
return sceneItems.map(i => i.sourceName);
}
},
enabled: {
Expand Down
2 changes: 2 additions & 0 deletions src/main/plugins/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,9 @@ export default {
},

async deleteReward(id) {
const idx = this.rewards.findIndex(r => r.id == id);
await this.channelTwitchClient.channelPoints.deleteCustomReward(this.channelId, id);
this.rewards.splice(idx, 1);
}
},
async onProfileLoad(profile, config) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/utils/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export class Analytics {

this.ipcSender = ipcSender;

ipcMain.handle("analytics_track", async (eventName, data) => {
ipcMain.handle("analytics_track", async (ipcEvent, eventName, data) => {
this.track(eventName, data);
})

ipcMain.handle("analytics_set", async (data) => {
ipcMain.handle("analytics_set", async (ipcEvent, data) => {
this.set(data);
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export default {
set(newActions) {
if (!this.modelValue) {
//Assume inline.
console.log("new edit");
const newAuto = generateEmptyAutomation();
newAuto.actions = newActions;
this.$emit("update:modelValue", newAuto);
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/automations/AutomationSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
import { mapIpcs } from "../../utils/ipcMap";
import { mapGetters } from "vuex";
import NamedItemModal from "../dialogs/NamedItemModal.vue";
import AutomationQuickEditDialog from "./AutomationQuickEditDialog.vue";
import { mapModel } from "../../utils/modelValue";
import { defineAsyncComponent } from "vue";
export default {
name: "automation-selector",
props: {
Expand All @@ -49,7 +50,7 @@ export default {
},
components: {
NamedItemModal,
AutomationQuickEditDialog,
AutomationQuickEditDialog: defineAsyncComponent(() => import("./AutomationQuickEditDialog.vue")),
},
computed: {
...mapGetters("ipc", ["paths"]),
Expand Down
11 changes: 6 additions & 5 deletions src/renderer/components/data/DataInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,20 @@ import TimeInput from "./types/TimeInput.vue";
import StringInput from "./types/StringInput.vue";
import NumberInput from "./types/NumberInput.vue";
import BooleanInput from "./types/BooleanInput.vue";
import { defineAsyncComponent } from 'vue'
import ObjectInput from "./types/ObjectInput.vue";
import ArrayInput from "./types/ArrayInput.vue";
import AutomationSelector from "../automations/AutomationSelector.vue";
export default {
name: "data-input",
components: {
ObjectInput: defineAsyncComponent(() => import("./types/ObjectInput.vue")),
ArrayInput: defineAsyncComponent(() => import("./types/ArrayInput.vue")),
ObjectInput,
ArrayInput,
NumberInput,
FileAutocomplete,
StringInput,
ColorPicker,
AutomationSelector: defineAsyncComponent(() => import("../automations/AutomationSelector.vue")),
AutomationSelector,
RewardSelector,
RangeInput,
TimeInput,
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/components/data/types/EnumInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ export default {
this.allItems = items;
this.enumItems = items;
this.loading = false;
}
catch(err)
{
console.err("Error getting enum items from main process", err);
console.error("Error getting enum items from main process", err);
}
this.loading = false;
}
},
},
Expand Down
1 change: 0 additions & 1 deletion src/renderer/views/Rewards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export default {
methods: {
...mapIpcs("twitch", ["getRewards"]),
async refresh() {
console.log("Refreshing Rewards");
this.rewards = await this.getRewards();
}
},
Expand Down
4 changes: 3 additions & 1 deletion updater.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
<title>CastMate - Update</title>
</head>
<body>
<div id="app"> </div>
<div id="app">
Uh oh, it looks like the updater broke! You can just run the installer from <a href="https://www.github.com/CastMate/LordTocs/Releases/Latest" target="_blank">GitHub</a>
</div>
<script type="module" src="/src/renderer/updater/main.js"></script>
</body>
</html>

0 comments on commit 96e4154

Please sign in to comment.