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

Function configureExtension

apps/chrome-extension/e2e/webcam-start.spec.ts:200–253  ·  view source on GitHub ↗
(
	worker: Awaited<ReturnType<typeof getServiceWorker>>,
	apiBaseUrl: string,
)

Source from the content-addressed store, hash-verified

198};
199
200const configureExtension = async (
201 worker: Awaited<ReturnType<typeof getServiceWorker>>,
202 apiBaseUrl: string,
203) => {
204 await worker.evaluate(
205 async ({ authKey, bootstrapKey, settingsKey, apiBaseUrl }) => {
206 const chromeApi = (globalThis as ChromeGlobal).chrome;
207 await new Promise<void>((resolve) =>
208 chromeApi.storage.local.clear(() => resolve()),
209 );
210 await new Promise<void>((resolve) =>
211 chromeApi.storage.local.set(
212 {
213 [authKey]: { authApiKey: "auth-e2e", userId: "user-e2e" },
214 [bootstrapKey]: {
215 bootstrap: {
216 user: { id: "user-e2e", email: "e2e@cap.test" },
217 organization: { id: "org-e2e", name: "E2E" },
218 plan: { isPro: true, maxRecordingSeconds: 600 },
219 },
220 cachedAt: Date.now(),
221 },
222 [settingsKey]: {
223 apiBaseUrl,
224 capture: {
225 recordingMode: "fullscreen",
226 camera: null,
227 microphone: null,
228 },
229 webcam: {
230 enabled: true,
231 deviceId: "__cap_default_camera__",
232 position: "bottom-left",
233 size: 230,
234 shape: "round",
235 mirror: false,
236 },
237 microphone: { enabled: false, deviceId: null },
238 systemAudio: { enabled: false },
239 sounds: { enabled: false },
240 },
241 },
242 () => resolve(),
243 ),
244 );
245 },
246 {
247 apiBaseUrl,
248 authKey: AUTH_KEY,
249 bootstrapKey: BOOTSTRAP_CACHE_KEY,
250 settingsKey: SETTINGS_KEY,
251 },
252 );
253};
254
255const sendServiceWorkerMessage = async (
256 page: Page,

Callers 1

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected