Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
feat: add website extension metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
TroyKomodo committed Oct 27, 2024
1 parent 94c88ef commit 4b2d23c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/views/OAuth2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function handleRoute() {
const params = new URLSearchParams(route.hash.slice(1));
const token = params.get("token");
let is7TV;
let is7TV: boolean;
try {
is7TV = opener.location.origin === window.origin;
} catch (e) {
Expand Down
10 changes: 8 additions & 2 deletions src/worker/worker.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ export class EventAPI {
connect(transport: EventAPITransport): void {
if (this.eventSource || this.socket || !this.url) return;

const url = new URL(this.url);

// Add query param giving the version of the website / src
url.searchParams.append("app", "7tv-website-old");
url.searchParams.append("version", import.meta.env.VITE_APP_VERSION);

this.transport = transport;

if (this.transport === "WebSocket") {
this.socket = new WebSocket(this.url);
this.socket = new WebSocket(url);
this.socket.onopen = () => this.onOpen();
this.socket.onclose = () => this.onClose();
this.socket.onmessage = (ev) => {
Expand All @@ -44,7 +50,7 @@ export class EventAPI {
};
}

log.debug("<EventAPI>", "Connecting...", `url=${this.url}`);
log.debug("<EventAPI>", "Connecting...", `url=${url}`);
}

getSocket(): WebSocket | null {
Expand Down
1 change: 0 additions & 1 deletion src/worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export function handleMessage<N extends WorkerMessageName>(evt: WorkerMessage<N>
switch (evt.name) {
case "EventCommandSubscribe": {
const d = evt.data as WorkerMessageData<"EventCommandSubscribe">;

eventAPI.subscribe(d.type, d.condition);
break;
}
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
"moduleResolution": "node",
"resolveJsonModule": true
},
"include": ["vite.config.ts"]
}
7 changes: 6 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { version } from "./package.json";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig, loadEnv } from "vite";

// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
process.env = {
...process.env,
...loadEnv(mode, process.cwd()),
VITE_APP_VERSION: version,
};

return defineConfig({
build: {
Expand Down

0 comments on commit 4b2d23c

Please sign in to comment.