Skip to content

Commit a29255c

Browse files
committed
[chrome] add sentry integration
1 parent 6090097 commit a29255c

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

packages/chrome/src/main.tsx

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,39 @@ let app = document.getElementById("app")!;
99
import { Shell } from "./components/Shell";
1010
import { App } from "./App";
1111
import { css } from "dreamland/core";
12-
import { setWispUrl } from "./IsolatedFrame";
12+
import { setWispUrl } from "./proxy/wisp";
1313

14-
// load puter sdk
1514
if (import.meta.env.VITE_PUTER_BRANDING) {
16-
let script = <script src="https://js.puter.com/v2/"></script>;
17-
document.head.appendChild(script);
15+
let promises = [];
16+
17+
let puterSdk = <script src="https://js.puter.com/v2/"></script>;
18+
document.head.append(puterSdk);
19+
promises.push(
20+
new Promise<void>((res) => {
21+
puterSdk.onload = () => res();
22+
})
23+
);
1824

19-
await new Promise((resolve) => {
20-
script.onload = () => resolve(null);
21-
});
25+
if (import.meta.env.VITE_SENTRY_URL) {
26+
let sentrySdk = (
27+
<script
28+
src={import.meta.env.VITE_SENTRY_URL}
29+
crossorigin="anonymous"
30+
></script>
31+
);
32+
document.head.append(sentrySdk);
33+
promises.push(
34+
new Promise<void>((res, rej) => {
35+
sentrySdk.onload = () => res();
36+
sentrySdk.onerror = () => {
37+
console.error("Error loading Sentry (adblocker?)");
38+
res();
39+
};
40+
})
41+
);
42+
}
43+
44+
await Promise.all(promises);
2245
}
2346

2447
export const isPuter =
@@ -74,12 +97,12 @@ export async function mount(): Promise<HTMLElement> {
7497
if (import.meta.env.VITE_PUTER_BRANDING) {
7598
if (!puter.auth.isSignedIn()) {
7699
await puter.auth.signIn();
77-
return;
78100
}
79101

80102
let wisp = await puter.net.generateWispV1URL();
81103
setWispUrl(wisp);
82-
console.log(wisp);
104+
} else {
105+
setWispUrl(import.meta.env.VITE_WISP_URL);
83106
}
84107
return built;
85108
} catch (e) {

0 commit comments

Comments
 (0)