Skip to content

The free and privacy-friendly screen recorder with no limits πŸŽ₯

Harden recording lifecycle cleanup and action button recovery flow

Alyssa Xcd31d43e6e88
diff --git a/src/manifest.json b/src/manifest.json
index e6873d3..e4766d5 100755
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -3,7 +3,7 @@
"name": "__MSG_extName__",
"description": "__MSG_extDesc__",
"default_locale": "en",
- "version": "4.3.2",
+ "version": "4.3.3",
"background": {
"service_worker": "background.bundle.js"
},
diff --git a/src/pages/Background/listeners/onActionButtonClickedListener.js b/src/pages/Background/listeners/onActionButtonClickedListener.js
index 007ad2a..b4340c4 100644
--- a/src/pages/Background/listeners/onActionButtonClickedListener.js
+++ b/src/pages/Background/listeners/onActionButtonClickedListener.js
@@ -5,7 +5,6 @@ import {
clearEditorTabReference,
} from "../tabManagement";
import { sendMessageRecord } from "../recording/sendMessageRecord.js";
-import { stopRecording } from "../recording/stopRecording.js";
import { loginWithWebsite } from "../auth/loginWithWebsite.js";
const CLOUD_FEATURES_ENABLED =
@@ -25,13 +24,18 @@ const handleTabMessaging = async (tab) => {
: null;
if (targetTab) {
- sendMessageTab(preferredTabId, { type: "stop-recording-tab" });
+ await sendMessageTab(preferredTabId, { type: "stop-recording-tab" });
} else {
- sendMessageTab(tab.id, { type: "stop-recording-tab" });
+ await sendMessageTab(tab.id, { type: "stop-recording-tab" });
chrome.storage.local.set({ activeTab: tab.id });
}
} catch (error) {
- console.error("Error in handleTabMessaging:", error);
+ console.error("[Screenity][ActionClick] handleTabMessaging failed, trying direct recorder stop:", error);
+ try {
+ await sendMessageRecord({ type: "stop-recording-tab" });
+ } catch (recorderErr) {
+ console.error("[Screenity][ActionClick] direct recorder stop also failed:", recorderErr);
+ }
}
};
@@ -102,7 +106,9 @@ const openPlaygroundOrPopup = async (tab) => {
tab.url.includes("/playground.html") || tab.url.includes("/setup.html");
if ((!isForbidden || isPlaygroundOrSetup) && navigator.onLine) {
- sendMessageTab(tab.id, { type: "toggle-popup" });
+ sendMessageTab(tab.id, { type: "toggle-popup" })
+ .then(() => console.log("[Screenity][ActionClick] toggle-popup delivered to tab", tab.id))
+ .catch((err) => console.error("[Screenity][ActionClick] toggle-popup FAILED to tab", tab.id, String(err).slice(0, 120)));
chrome.storage.local.set({ activeTab: tab.id });
} else {
const newTab = await chrome.tabs.create({
@@ -123,65 +129,117 @@ const openPlaygroundOrPopup = async (tab) => {
}
};
+/** Check whether a tab ID refers to a tab that actually exists. */
+const doesTabExist = async (tabId) => {
+ if (!Number.isInteger(tabId)) return false;
+ try {
+ await chrome.tabs.get(tabId);
+ return true;
+ } catch {
+ return false;
+ }
+};
+
+/** Check whether an offscreen document is actually running. */
+const isOffscreenAlive = async () => {
+ try {
+ const contexts = await chrome.runtime.getContexts({});
+ return contexts.some((c) => c.contextType === "OFFSCREEN_DOCUMENT");
+ } catch {
+ return false;
+ }
+};
+
// Main action button listener
export const onActionButtonClickedListener = () => {
chrome.action.onClicked.addListener(async (tab) => {
try {
- // Recover a previous recording whose editor failed to open (expires after 1h).
- const { editorRecoveryUrl, editorRecoveryAt } = await chrome.storage.local.get(["editorRecoveryUrl", "editorRecoveryAt"]);
- if (editorRecoveryUrl) {
- const ageMs = Date.now() - (editorRecoveryAt || 0);
- if (ageMs < 60 * 60 * 1000) {
- await chrome.storage.local.remove(["editorRecoveryUrl", "editorRecoveryAt"]);
- chrome.tabs.create({ url: editorRecoveryUrl, active: true });
- return;
- }
- // Expired β€” clear and fall through to normal behavior
+ const snap = await chrome.storage.local.get([
+ "recording", "pendingRecording", "restarting", "recorderSession",
+ "recordingTab", "offscreen",
+ "postStopEditorOpening", "postStopEditorOpened",
+ "editorRecoveryUrl",
+ ]);
+ console.log("[Screenity][ActionClick] storage:", snap, "tab:", tab.id);
+
+ if (snap.editorRecoveryUrl) {
await chrome.storage.local.remove(["editorRecoveryUrl", "editorRecoveryAt"]);
}
- const { recording, pendingRecording, restarting, recorderSession } =
- await chrome.storage.local.get([
- "recording",
- "pendingRecording",
- "restarting",
- "recorderSession",
- ]);
+ const { recording, pendingRecording, restarting, recorderSession } = snap;
const sessionRecording = recorderSession?.status === "recording";
const isRecordingActive = Boolean(
recording || pendingRecording || restarting || sessionRecording,
);
if (isRecordingActive) {
- // Check whether an actual recorder still exists before treating this as
- // an active recording. If no recorder is present, the flags are stale
- // (e.g. countdown was cancelled while a race left recording:true in
- // storage). Reset and open the popup instead of silently swallowing the
- // click.
- const { recordingTab, offscreen } = await chrome.storage.local.get([
- "recordingTab",
- "offscreen",
- ]);
- const hasActiveRecorder = recordingTab || offscreen || sessionRecording;
+ const { recordingTab, offscreen } = snap;
+ let hasActiveRecorder = false;
+
+ if (sessionRecording) {
+ const sessionOwnerTabId =
+ recorderSession?.recorderTabId || recorderSession?.tabId || null;
+ if (sessionOwnerTabId && (await doesTabExist(sessionOwnerTabId))) {
+ hasActiveRecorder = true;
+ } else {
+ console.warn(
+ "[Screenity][ActionClick] recorderSession stale (owner tab",
+ sessionOwnerTabId,
+ "is dead) β€” clearing",
+ );
+ chrome.storage.local.set({
+ recorderSession: recorderSession
+ ? { ...recorderSession, status: "stale-cleared", clearedAt: Date.now() }
+ : null,
+ });
+ }
+ }
+
+ if (recordingTab && !hasActiveRecorder) {
+ if (await doesTabExist(recordingTab)) {
+ hasActiveRecorder = true;
+ } else {
+ console.warn("[Screenity][ActionClick] recordingTab", recordingTab, "is dead β€” clearing");
+ chrome.storage.local.set({ recordingTab: null });
+ }
+ }
+
+ if (offscreen && !hasActiveRecorder) {
+ if (await isOffscreenAlive()) {
+ hasActiveRecorder = true;
+ } else {
+ console.warn("[Screenity][ActionClick] offscreen flag stale (no document) β€” clearing");
+ chrome.storage.local.set({ offscreen: false });
+ }
+ }
if (!hasActiveRecorder) {
console.warn(
- "[Screenity] Stale recording flags detected (no recorder). Resetting.",
- { recording, pendingRecording, restarting, sessionRecording },
+ "[Screenity][ActionClick] branch: stale-reset-then-popup.",
+ { recording, pendingRecording, restarting, sessionRecording, recordingTab, offscreen },
);
await chrome.storage.local.set({
recording: false,
pendingRecording: false,
restarting: false,
+ offscreen: false,
+ recordingTab: null,
+ postStopEditorOpened: false,
+ postStopEditorOpening: false,
recordingToScene: false,
projectId: null,
activeSceneId: null,
});
+ chrome.runtime
+ .sendMessage({ type: "clear-recording-session-safe", reason: "action-button-stale-reset" })
+ .catch(() => {});
await openPlaygroundOrPopup(tab);
} else {
+ console.log("[Screenity][ActionClick] branch: handle-tab-messaging (active recorder)");
await handleTabMessaging(tab);
}
} else {
+ console.log("[Screenity][ActionClick] branch: normal-popup");
// Reset storage keys before opening the popup
await chrome.storage.local.set({
recordingToScene: false,
diff --git a/src/pages/Background/offscreen/discardOffscreenDocuments.js b/src/pages/Background/offscreen/discardOffscreenDocuments.js
index 6e177d5..144ca27 100644
--- a/src/pages/Background/offscreen/discardOffscreenDocuments.js
+++ b/src/pages/Background/offscreen/discardOffscreenDocuments.js
@@ -1,5 +1,6 @@
/**
* Closes any active offscreen document if it exists.
+ * Also clears the offscreen storage flag to prevent stale state.
*/
export const discardOffscreenDocuments = async () => {
try {
@@ -14,4 +15,5 @@ export const discardOffscreenDocuments = async () => {
} catch (error) {
console.error("Failed to discard offscreen documents:", error.message);
}
+ chrome.storage.local.set({ offscreen: false });
};
diff --git a/src/pages/Background/recording/discardRecording.js b/src/pages/Background/recording/discardRecording.js
index a7e7833..55bbea7 100644
--- a/src/pages/Background/recording/discardRecording.js
+++ b/src/pages/Background/recording/discardRecording.js
@@ -14,6 +14,8 @@ export const discardRecording = async () => {
recording: false,
restarting: false,
pendingRecording: false,
+ offscreen: false,
+ postStopEditorOpened: false,
});
chrome.storage.local.set({ pipForceClose: Date.now() });
chrome.storage.local.set({ recordingUiTabId: null });
diff --git a/src/pages/Background/recording/recordingHelpers.js b/src/pages/Background/recording/recordingHelpers.js
index 3d6f435..eaeb7f1 100644
--- a/src/pages/Background/recording/recordingHelpers.js
+++ b/src/pages/Background/recording/recordingHelpers.js
@@ -78,7 +78,8 @@ export const handleRecordingComplete = async () => {
});
}
// Clear so subsequent recordings don't conflict
- chrome.storage.local.set({ recordingTab: null });
+ chrome.storage.local.set({ recordingTab: null, offscreen: false });
+ console.log("[Screenity][BG] handleRecordingComplete fired, recordingTab:", recordingTab);
};
export const handleRecordingError = async (request) => {
@@ -141,6 +142,8 @@ export const handleRecordingError = async (request) => {
recording: false,
recordingUiTabId: null,
tabRecordedID: null,
+ offscreen: false,
+ postStopEditorOpened: false,
});
chrome.runtime
diff --git a/src/pages/Background/recording/startRecording.js b/src/pages/Background/recording/startRecording.js
index 1ade7f1..3446d85 100644
--- a/src/pages/Background/recording/startRecording.js
+++ b/src/pages/Background/recording/startRecording.js
@@ -61,6 +61,8 @@ export const startRecording = async () => {
chrome.storage.local.remove(["recordingMeta"]);
}
+ chrome.storage.local.set({ lastRecordingType: recordingType || "screen" });
+
// Initialize diagnostic session for this recording
const { quality, systemAudio, audioInput, backup, offscreen, alarm, alarmTime, countdown } =
await chrome.storage.local.get([
diff --git a/src/pages/Background/recording/stopRecording.js b/src/pages/Background/recording/stopRecording.js
index 10f2986..ab4a6df 100644
--- a/src/pages/Background/recording/stopRecording.js
+++ b/src/pages/Background/recording/stopRecording.js
@@ -94,6 +94,7 @@ export const stopRecording = async () => {
recording: false,
recordingDuration: duration,
tabRecordedID: null,
+ offscreen: false,
});
chrome.storage.local.set({ recordingUiTabId: null });
chrome.storage.local.set({ pipForceClose: Date.now() });
@@ -321,6 +322,10 @@ export const handleStopRecordingTab = async (request) => {
: 0;
diagEvent("stop-tab", { duration: stopTabDuration, reason: request.reason || null, memoryError: Boolean(request.memoryError), fastRecorderInUse: Boolean(fastRecorderInUse) });
+ if (stopTabDuration > 0) {
+ chrome.storage.local.set({ recordingDuration: stopTabDuration });
+ }
+
if (!isSubscribed) {
const { fastRecorderActiveRecordingId } = await chrome.storage.local.get([
"fastRecorderActiveRecordingId",
diff --git a/src/pages/Content/context/ContentState.jsx b/src/pages/Content/context/ContentState.jsx
index 733c177..fa839ad 100644
--- a/src/pages/Content/context/ContentState.jsx
+++ b/src/pages/Content/context/ContentState.jsx
@@ -262,6 +262,7 @@ const ContentState = (props) => {
showPopup: true,
pendingRecording: false,
tabCaptureFrame: false,
+ pipEnded: false,
time: 0,
timer: 0,
preparingRecording: false,
@@ -337,6 +338,7 @@ const ContentState = (props) => {
tabCaptureFrame: false,
pendingRecording: false,
preparingRecording: false,
+ pipEnded: false,
blurMode: false,
drawingMode: false,
}));
diff --git a/src/pages/Content/context/messaging/handlers.js b/src/pages/Content/context/messaging/handlers.js
index 182399c..d36a15c 100644
--- a/src/pages/Content/context/messaging/handlers.js
+++ b/src/pages/Content/context/messaging/handlers.js
@@ -525,6 +525,7 @@ export const setupHandlers = () => {
showExtension: false,
recording: false,
paused: false,
+ pipEnded: false,
time: 0,
timer: 0,
}));
@@ -536,6 +537,7 @@ export const setupHandlers = () => {
...prev,
pendingRecording: false,
preparingRecording: false,
+ pipEnded: false,
}));
});
@@ -547,6 +549,12 @@ export const setupHandlers = () => {
state.recording ||
state.pipEnded
) {
+ console.warn("[Screenity][Content] start-stream BLOCKED by guard state:", {
+ preparingRecording: state.preparingRecording,
+ pendingRecording: state.pendingRecording,
+ recording: state.recording,
+ pipEnded: state.pipEnded,
+ });
return;
}
@@ -836,6 +844,7 @@ export const setupHandlers = () => {
...prev,
pendingRecording: false,
preparingRecording: false,
+ pipEnded: false,
}));
});
diff --git a/src/pages/Recorder/Recorder.jsx b/src/pages/Recorder/Recorder.jsx
index 2029421..1afd7cb 100644
--- a/src/pages/Recorder/Recorder.jsx
+++ b/src/pages/Recorder/Recorder.jsx
@@ -427,10 +427,19 @@ const Recorder = () => {
*/
const startRecordingTick = () => {
if (recordingTick.current) clearInterval(recordingTick.current);
- recordingTick.current = setInterval(() => {
- if (isRecording.current) {
- chrome.storage.local.set({ recordingNow: Date.now() });
- }
+ recordingTick.current = setInterval(async () => {
+ if (!isRecording.current || !recordingStartTime.current) return;
+ const { totalPausedMs, pausedAt, paused } =
+ await chrome.storage.local.get(["totalPausedMs", "pausedAt", "paused"]);
+ const now = Date.now();
+ const basePaused = Number(totalPausedMs) || 0;
+ const extraPaused =
+ paused && pausedAt ? Math.max(0, now - Number(pausedAt)) : 0;
+ const elapsed = Math.max(
+ 0,
+ now - recordingStartTime.current - basePaused - extraPaused,
+ );
+ chrome.storage.local.set({ recordingNow: now, recordingDuration: elapsed });
}, 1000);
};
diff --git a/src/pages/Region/Recorder.jsx b/src/pages/Region/Recorder.jsx
index d3a0b60..ee646ab 100644
--- a/src/pages/Region/Recorder.jsx
+++ b/src/pages/Region/Recorder.jsx
@@ -111,6 +111,8 @@ const Recorder = () => {
const hasChunks = useRef(false);
const lastSize = useRef(0);
const pausedStateRef = useRef(false);
+ const recordingStartTimeRef = useRef(null);
+ const recordingTick = useRef(null);
// Main stream (recording)
const liveStream = useRef(null);
@@ -199,6 +201,31 @@ const Recorder = () => {
}
};
+ const startRecordingTick = () => {
+ if (recordingTick.current) clearInterval(recordingTick.current);
+ recordingTick.current = setInterval(async () => {
+ if (!recordingStartTimeRef.current) return;
+ const { totalPausedMs, pausedAt, paused } =
+ await chrome.storage.local.get(["totalPausedMs", "pausedAt", "paused"]);
+ const now = Date.now();
+ const basePaused = Number(totalPausedMs) || 0;
+ const extraPaused =
+ paused && pausedAt ? Math.max(0, now - Number(pausedAt)) : 0;
+ const elapsed = Math.max(
+ 0,
+ now - recordingStartTimeRef.current - basePaused - extraPaused,
+ );
+ chrome.storage.local.set({ recordingNow: now, recordingDuration: elapsed });
+ }, 1000);
+ };
+
+ const stopRecordingTick = () => {
+ if (recordingTick.current) {
+ clearInterval(recordingTick.current);
+ recordingTick.current = null;
+ }
+ };
+
async function canFitChunk(byteLength) {
const now = performance.now();
if (now - lastEstimateAt.current < ESTIMATE_INTERVAL_MS) {
@@ -1201,6 +1228,7 @@ const Recorder = () => {
}
const recordingStartTime = Date.now();
+ recordingStartTimeRef.current = recordingStartTime;
await setRecordingTimingState({
recording: true,
paused: false,
@@ -1209,6 +1237,7 @@ const Recorder = () => {
totalPausedMs: 0,
});
pausedStateRef.current = false;
+ startRecordingTick();
chrome.storage.local.set({
recording: true,
restarting: false,
@@ -1280,6 +1309,8 @@ const Recorder = () => {
async function stopRecording() {
clearStartRetry();
+ stopRecordingTick();
+ recordingStartTimeRef.current = null;
isFinishing.current = true;
regionRef.current = false;
await updateFreeFinalizeStatus("stopping", 0);
@@ -1346,6 +1377,8 @@ const Recorder = () => {
const dismissRecording = async () => {
clearStartRetry();
+ stopRecordingTick();
+ recordingStartTimeRef.current = null;
regionRef.current = false;
useWebCodecs.current = false;
await setRecordingTimingState({
@@ -1387,6 +1420,8 @@ const Recorder = () => {
const restartRecording = async () => {
clearStartRetry();
+ stopRecordingTick();
+ recordingStartTimeRef.current = null;
if (isRestarting.current) {
return false;
}
diff --git a/src/pages/Sandbox/context/ContentState.jsx b/src/pages/Sandbox/context/ContentState.jsx
index 2e28854..b6335d5 100644
--- a/src/pages/Sandbox/context/ContentState.jsx
+++ b/src/pages/Sandbox/context/ContentState.jsx
@@ -734,6 +734,7 @@ const ContentState = (props) => {
...prevState,
webm: fixedWebm,
ready: true,
+ isFfmpegRunning: false,
}));
chrome.runtime.sendMessage({ type: "recording-complete" });
return;
@@ -768,6 +769,7 @@ const ContentState = (props) => {
...prevState,
webm: fixedWebm,
ready: true,
+ isFfmpegRunning: false,
}));
chrome.runtime.sendMessage({ type: "recording-complete" });
return;
@@ -801,6 +803,7 @@ const ContentState = (props) => {
...prevState,
webm: blob,
ready: true,
+ isFfmpegRunning: false,
}));
chrome.runtime.sendMessage({ type: "recording-complete" });
return;
@@ -826,9 +829,33 @@ const ContentState = (props) => {
...prevState,
webm: blob,
ready: true,
+ isFfmpegRunning: false,
}));
chrome.runtime.sendMessage({ type: "recording-complete" });
}
+
+ // 45s safety timeout for the direct-blob path β€” force ready if
+ // fixWebmDuration or readAsDataURL hangs.
+ if (withBlob) {
+ setTimeout(() => {
+ const s = contentStateRef.current;
+ if (s?.ready) return;
+ console.warn(
+ "[Screenity][WebM] reconstructVideo(blob) safety timeout: forcing ready with raw blob",
+ );
+ setContentState((prev) => {
+ if (prev.ready) return prev;
+ return {
+ ...prev,
+ webm: prev.webm || prev.rawBlob || withBlob,
+ ready: true,
+ noffmpeg: true,
+ isFfmpegRunning: false,
+ };
+ });
+ chrome.runtime.sendMessage({ type: "recording-complete" });
+ }, 45000);
+ }
};
const checkMemory = () => {
@@ -1104,6 +1131,16 @@ const ContentState = (props) => {
ffmpegLoaded: true,
processingProgress: 0,
}));
+ // Try to recover chunks.
+ buildBlobFromChunks()
+ .then((blob) => {
+ if (!blob) {
+ chrome.runtime.sendMessage({
+ type: "send-chunks-to-sandbox",
+ });
+ }
+ })
+ .catch(() => {});
sendResponse({ status: "error", error: result.error });
return;
}
@@ -1160,6 +1197,16 @@ const ContentState = (props) => {
ffmpegLoaded: true,
processingProgress: 0,
}));
+ // Try to recover chunks.
+ buildBlobFromChunks()
+ .then((blob) => {
+ if (!blob) {
+ chrome.runtime.sendMessage({
+ type: "send-chunks-to-sandbox",
+ });
+ }
+ })
+ .catch(() => {});
sendResponse({ status: "error", error: result.error });
return;
}
@@ -1216,6 +1263,8 @@ const ContentState = (props) => {
ffmpegLoaded: true,
processingProgress: 0,
}));
+ // Try to recover chunks.
+ buildBlobFromChunks().catch(() => {});
sendResponse({ status: "error", error: result.error });
return;
}
@@ -1469,6 +1518,8 @@ const ContentState = (props) => {
ffmpegLoaded: true,
isFfmpegRunning: false,
}));
+ console.log("[Screenity][Editor] recording-complete sent from ffmpeg-load-error fallback");
+ chrome.runtime.sendMessage({ type: "recording-complete" });
// if (!navigator.onLine) {
// setContentState((prevState) => ({
@@ -1645,13 +1696,21 @@ const ContentState = (props) => {
setContentState((prev) => {
// Double-check inside the updater for concurrent state races.
if (prev.ffmpegLoaded || prev.noffmpeg) return prev;
+ // Also set ready when falling back β€” getBlob() early-returns
+ // when noffmpeg is true, so ready would never be set otherwise.
+ const fallbackWebm = prev.webm || prev.rawBlob;
return {
...prev,
noffmpeg: true,
ffmpegLoaded: true,
fallback: true,
+ ...(fallbackWebm && !prev.ready
+ ? { webm: fallbackWebm, ready: true }
+ : {}),
};
});
+ console.log("[Screenity][Editor] recording-complete sent from ffmpeg-load-timeout fallback");
+ chrome.runtime.sendMessage({ type: "recording-complete" });
}, 30000);
return () => clearTimeout(timer);
diff --git a/src/pages/Sandbox/layout/player/RightPanel.js b/src/pages/Sandbox/layout/player/RightPanel.js
index debe449..6462505 100644
--- a/src/pages/Sandbox/layout/player/RightPanel.js
+++ b/src/pages/Sandbox/layout/player/RightPanel.js
@@ -240,9 +240,14 @@ const RightPanel = () => {
? source
: new Blob([source], { type: "video/webm" });
const ext = blob.type.includes("mp4") ? "mp4" : "webm";
- const title = s.title || "screenity-recording";
+ const rawTitle = s.title || "screenity-recording";
+ const safe = rawTitle
+ .replace(/[\\:*?"<>|]/g, " ")
+ .replace(/[\u0000-\u001F\u007F]/g, " ")
+ .replace(/\s+/g, " ")
+ .trim() || "screenity-recording";
const url = window.URL.createObjectURL(blob);
- chrome.downloads.download({ url, filename: `${title}.${ext}` }, () => {
+ chrome.downloads.download({ url, filename: `${safe}.${ext}` }, () => {
window.URL.revokeObjectURL(url);
});
};
diff --git a/src/pages/utils/buildSupportContext.js b/src/pages/utils/buildSupportContext.js
index b47e7d3..d98e6e2 100644
--- a/src/pages/utils/buildSupportContext.js
+++ b/src/pages/utils/buildSupportContext.js
@@ -7,7 +7,10 @@ const MAX_ERR_LEN = 120;
const sanitizeError = (err) => {
if (!err) return "";
- const str = typeof err === "string" ? err : String(err);
+ const str =
+ typeof err === "string"
+ ? err
+ : err.message || err.errorCode || JSON.stringify(err);
return str
.replace(/https?:\/\/[^\s)]+/gi, "[url]")
.replace(/chrome-extension:\/\/[^\s)]+/gi, "[ext]")
@@ -55,6 +58,7 @@ export const buildSupportContext = async (opts = {}) => {
try {
const keys = [
"lastRecordingError",
+ "lastRecordingType",
"recordingType",
"fastRecorderInUse",
"fastRecorderDisabledReason",
@@ -64,19 +68,18 @@ export const buildSupportContext = async (opts = {}) => {
];
const store = await chrome.storage.local.get(keys);
- if (store.recordingType) ctx.recType = store.recordingType;
+ const recType = store.lastRecordingType || store.recordingType;
+ if (recType) ctx.recType = recType;
if (store.fastRecorderInUse != null)
ctx.fast = store.fastRecorderInUse ? "1" : "0";
if (store.fastRecorderDisabledReason)
ctx.fastOff = String(store.fastRecorderDisabledReason).slice(0, 60);
- if (store.isSubscribed != null) {
- ctx.sub = store.isSubscribed ? "1" : "0";
- // Override the build-time cloud flag with actual subscription state
- // so the support URL reflects whether this attempt used cloud or local.
- ctx.cloud = store.isSubscribed ? "1" : "0";
- }
+ ctx.sub = store.isSubscribed ? "1" : "0";
+ ctx.cloud = store.isSubscribed ? "1" : "0";
if (store.lastRecordingError) {
- ctx.lastErr = sanitizeError(store.lastRecordingError);
+ ctx.lastErr = sanitizeError(
+ store.lastRecordingError.why || store.lastRecordingError.error,
+ );
if (store.lastRecordingError.errorCode)
ctx.errCode = store.lastRecordingError.errorCode;
}