MCPcopy
hub / github.com/CapSoftware/Cap / configureExtension

Function configureExtension

apps/chrome-extension/e2e/recording-upload.spec.ts:382–475  ·  view source on GitHub ↗
(
	worker: Awaited<ReturnType<typeof getServiceWorker>>,
	apiBaseUrl: string,
)

Source from the content-addressed store, hash-verified

380};
381
382const configureExtension = async (
383 worker: Awaited<ReturnType<typeof getServiceWorker>>,
384 apiBaseUrl: string,
385) => {
386 await worker.evaluate(
387 async ({
388 authKey,
389 bootstrapKey,
390 recordingMode,
391 settingsKey,
392 apiBaseUrl,
393 }) => {
394 const chromeApi = (globalThis as ChromeGlobal).chrome;
395 await new Promise<void>((resolve, reject) => {
396 chromeApi.storage.local.clear(() => {
397 const error = chromeApi.runtime.lastError;
398 if (error) {
399 reject(new Error(error.message ?? "Failed to clear storage"));
400 return;
401 }
402 resolve();
403 });
404 });
405 await new Promise<void>((resolve, reject) => {
406 chromeApi.storage.local.set(
407 {
408 [authKey]: {
409 authApiKey: "auth-e2e",
410 userId: "user-e2e",
411 },
412 [bootstrapKey]: {
413 bootstrap: {
414 user: {
415 id: "user-e2e",
416 email: "extension-e2e@cap.test",
417 },
418 organization: {
419 id: "org-e2e",
420 name: "Extension E2E",
421 },
422 plan: {
423 isPro: true,
424 maxRecordingSeconds: 600,
425 },
426 },
427 cachedAt: Date.now(),
428 },
429 [settingsKey]: {
430 apiBaseUrl,
431 capture: {
432 recordingMode,
433 camera: null,
434 microphone: null,
435 },
436 webcam: {
437 enabled: false,
438 deviceId: null,
439 position: "bottom-left",

Callers 1

startRecordingFunction · 0.70

Calls 2

rejectFunction · 0.85
resolveFunction · 0.50

Tested by

no test coverage detected