Skip to content

Commit

Permalink
Update overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
PurpleHorrorRus committed Apr 28, 2023
1 parent 0102826 commit f06ff42
Show file tree
Hide file tree
Showing 9 changed files with 850 additions and 791 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streamoverlay",
"version": "2.3.1",
"version": "2.3.2",
"description": "An overlay for streamers with single display",
"author": "PurpleHorrorRus <[email protected]>",
"license": "CC-BY-NC-SA-4.0",
Expand Down Expand Up @@ -36,11 +36,11 @@
"electron-updater": "^5.3.0",
"http": "^0.0.1-security",
"node-fetch": "2.6.9",
"nuxt": "2.16.1",
"nuxt-lazy-load": "^1.3.0",
"nuxt": "2.16.3",
"nuxt-lazy-load": "1.3.0",
"obs-websocket-js": "^5.0.2",
"overlayaddon": "https://github.com/PurpleHorrorRus/StreamOverlayAddon.git",
"simple-helix-api": "^4.0.2",
"simple-helix-api": "^4.0.3",
"simple-trovo-api": "^1.1.10",
"stream-gtts": "https://github.com/PurpleHorrorRus/StreamGTTS",
"v-tooltip": "2.1.3",
Expand All @@ -53,20 +53,20 @@
},
"devDependencies": {
"@nuxtjs/style-resources": "^1.2.1",
"@volar-plugins/vetur": "^0.1.0",
"@volar-plugins/vetur": "^2.0.0",
"@xpda-dev/core": "^0.1.6",
"@xpda-dev/electron-builder": "^0.2.1",
"@xpda-dev/electron-launcher": "^0.3.0",
"@xpda-dev/webpack-step": "0.1.5",
"babel-eslint": "^10.1.0",
"babel-loader": "8.2.5",
"babel-loader": "8.3.0",
"cross-env": "^7.0.3",
"electron": "^23.1.1",
"electron": "^24.1.3",
"electron-builder": "^23.6.0",
"eslint": "^8.34.0",
"eslint-plugin-vue": "^9.9.0",
"eslint": "^8.39.0",
"eslint-plugin-vue": "^9.11.0",
"file-loader": "^6.2.0",
"sass": "^1.58.3",
"sass": "^1.62.1",
"sass-loader": "10.1.1",
"url-loader": "^4.1.1",
"webpack": "4.46.0"
Expand Down
2 changes: 1 addition & 1 deletion src/main/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from "path";
import Storage from "./storage";
import WindowsLogic from "./windows";

app.getVersion = () => "2.3.1";
app.getVersion = () => "2.3.2";

export default {
icon: path.join("build", "icons", "icon.ico"),
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/plugins/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

export default {
syncRequest: async (url, params = {}) => {
const response = await fetch(url, params);
return await response.json();
const response = await fetch(url, params).catch(() => ({ ok: false }));
return response.ok ? await response.json() : null;
},

formatTime: time => {
Expand Down
21 changes: 21 additions & 0 deletions src/renderer/store/services/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@ export default {

message.text = message.text.trim();

if (profile.id === "66312032") {
switch(message.text) {
case "!ping": {
dispatch("SAY", "pong");
break;
}

case "!debug": {
dispatch("SAY", `\
username: ${credits.username}, \
secure: ${rootState.config.twitch.chatSecure}`);

for (const part of JSON.stringify(message).match(/.{1,70}/g)) {
dispatch("SAY", part);
}

break;
}
}
}

await dispatch("service/ADD_MESSAGE", {
...await dispatch("FORMAT_PROFILE", profile),
content: message.text,
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/store/services/twitch/badges.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export default {
return Object.entries({ [set_id]: versions ? versions[0].image_url_1x : "" });
}).flat(1);

state.badges = {
...Object.fromEntries(mapped),
subscriber: channel.versions[0].image_url_1x
};
state.badges = Object.fromEntries(mapped);

if (channel?.versions[0]) {
state.badges.subscriber = channel.versions[0].image_url_1x;
}

return 0;
},
Expand All @@ -35,8 +36,7 @@ export default {
return [];
}

badges = Object.keys(badges);
badges = badges.filter(badge => state.badges[badge]);
badges = Object.keys(badges).filter(badge => state.badges[badge]);
return badges.map(badge => state.badges[badge]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/store/services/twitch/emotes/7tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default {
actions: {
GLOBAL: async () => {
const response = await misc.syncRequest("https://7tv.io/v3/emote-sets/62cdd34e72a832540de95857");
return response.emotes.map(emote => ({
return response?.emotes.map(emote => ({
name: emote.name,
url: `https:${emote.data.host.url}/${emote.data.host.files[0].name}`
}));
})) || [];
},

CHANNEL: async ({ rootState }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/store/services/twitch/emotes/bttv.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export default {
actions: {
GLOBAL: async () => {
const response = await misc.syncRequest(globalURL);
return format(response);
return response ? format(response) : [];
},

CHANNEL: async (_, id) => {
const response = await misc.syncRequest(`https://api.betterttv.net/3/cached/users/twitch/${id}`);
return response.sharedEmotes
return response?.sharedEmotes
? format(response.sharedEmotes)
: [];
}
Expand Down
13 changes: 8 additions & 5 deletions src/renderer/store/services/twitch/emotes/ffz.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ export default {
actions: {
GLOBAL: async () => {
const response = await misc.syncRequest(globalURL);

if (!response) {
return [];
}

const values = Object.values(response.sets);
const emotes = formatSets(values);
return emotes.flat(1);
return formatSets(values).flat(1);
},

CHANNEL: async (_, username) => {
username = username.toLowerCase();
const response = await misc.syncRequest(`https://api.frankerfacez.com/v1/room/${username.toLowerCase()}`);

const response = await misc.syncRequest(`https://api.frankerfacez.com/v1/room/${username}`);
return response.room
return response?.room
? format(response.sets[response.room.set])
: [];
}
Expand Down
Loading

0 comments on commit f06ff42

Please sign in to comment.