Skip to content

Commit

Permalink
fixed types
Browse files Browse the repository at this point in the history
  • Loading branch information
FrantaBOT committed Oct 27, 2024
1 parent dbd626b commit 742a360
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-nightly.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.1.4.1000

- Fixed an issue with avatars not loading

### 3.1.3.1000

- Added option hide shared chat
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "7TV",
"description": "Improve your viewing experience on Twitch & YouTube with new features, emotes, vanity and performance.",
"private": true,
"version": "3.1.3",
"version": "3.1.4",
"dev_version": "1.0",
"scripts": {
"start": "NODE_ENV=dev yarn build:dev && NODE_ENV=dev vite --mode dev",
Expand Down
9 changes: 1 addition & 8 deletions src/worker/worker.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class EventAPI {
);
}

private onDispatch(msg: EventAPIMessage<"DISPATCH">): void {
onDispatch(msg: EventAPIMessage<"DISPATCH">): void {
handleDispatchedEvent(this.getContext(), msg.data.type, msg.data.body);

log.debugWithObjects(["<EventAPI>", "Dispatch received"], [msg.data]);
Expand Down Expand Up @@ -170,13 +170,6 @@ export class EventAPI {
log.error("<EventAPI>", "Error received", msg.data.message);
}

onCosmetic(cosmetic: SevenTV.Cosmetic<"AVATAR">): void {
this.onMessage({
op: "DISPATCH",
data: cosmetic as EventAPIMessage<"DISPATCH">,
});
}

resume(sessionID: string): void {
this.sendMessage({
op: "RESUME",
Expand Down
13 changes: 7 additions & 6 deletions src/worker/worker.http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { convertBttvEmoteSet, convertFFZEmoteSet, convertFfzBadges } from "@/com
import { db } from "@/db/idb";
import type { WorkerDriver } from "./worker.driver";
import type { WorkerPort } from "./worker.port";
import { EventAPIMessage } from ".";

namespace API_BASE {
export const SEVENTV = import.meta.env.VITE_APP_API;
Expand Down Expand Up @@ -69,16 +70,16 @@ export class WorkerHttp {
driver.addEventListener("request_user_cosmetics", async (ev) => {
if (!ev.port) return;

const cosmetics = await this.API()
const cosmeticEvents = await this.API()
.seventv.loadUserCosmetics(ev.detail)
.catch(() => void 0);

if (!cosmetics) {
if (!cosmeticEvents) {
return;
}

for (const cosmetic of cosmetics) {
this.driver.eventAPI.onCosmetic(cosmetic);
for (const cosmeticEvent of cosmeticEvents) {
this.driver.eventAPI.onDispatch(cosmeticEvent);
}
});
}
Expand Down Expand Up @@ -316,7 +317,7 @@ export const seventv = {
return Promise.resolve(userConn.user);
},

async loadUserCosmetics(identifiers: ["id" | "username", string][]): Promise<SevenTV.Cosmetic<"AVATAR">[]> {
async loadUserCosmetics(identifiers: ["id" | "username", string][]): Promise<EventAPIMessage<"DISPATCH">[]> {
const body = {
identifiers: identifiers.map(([idType, id]) => `${idType}:${id}`),
};
Expand All @@ -329,7 +330,7 @@ export const seventv = {
return Promise.reject(resp);
}

const cosmetics = (await resp.json()) as SevenTV.Cosmetic<"AVATAR">[];
const cosmetics = (await resp.json()) as EventAPIMessage<"DISPATCH">[];
return Promise.resolve(cosmetics);
},
};
Expand Down

0 comments on commit 742a360

Please sign in to comment.