Skip to content

Commit de91a43

Browse files
committed
Merge branch 'v3.2.13'
2 parents f5b515a + f16b7fb commit de91a43

5 files changed

Lines changed: 48 additions & 38 deletions

File tree

extension-unpacked.zip

71 Bytes
Binary file not shown.

extension/background.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,23 @@ chrome.runtime.onMessage.addListener(function (messageUnTyped, sender, sendRespo
135135
})
136136
}
137137

138-
if (message.type === "enable_beta") {
138+
if ((message.type === "enable_beta") || (message.type === "enable_beta_with_notification")) {
139+
const showNotification = (message.type === "enable_beta_with_notification")
140+
139141
enableBeta().then((message) => {
140-
/** @type {ExtensionResponse} */
141-
const response = { success: true, message: message }
142-
sendResponse(response)
142+
registerContentScripts(showNotification).then((message) => {
143+
/** @type {ExtensionResponse} */
144+
const response = { success: true, message: message }
145+
sendResponse(response)
146+
})
147+
.catch((error) => {
148+
// Fails with error codes: not defined
149+
const parsedError = /** @type {ErrorObject} */ (error)
150+
151+
/** @type {ExtensionResponse} */
152+
const response = { success: false, message: parsedError }
153+
sendResponse(response)
154+
})
143155
})
144156
.catch((error) => {
145157
// Fails with error codes: not defined
@@ -194,9 +206,12 @@ chrome.runtime.onUpdateAvailable.addListener(() => {
194206
})
195207
})
196208

197-
// Register content scripts whenever runtime permission is provided by the user
209+
// Register content scripts whenever runtime permission change—mostly serves as a backup for changes made outside the UI.
198210
chrome.permissions.onAdded.addListener((event) => {
199-
registerContentScripts()
211+
// Prevent competing with explicit content script registrations
212+
setTimeout(() => {
213+
registerContentScripts()
214+
}, 2000)
200215
})
201216

202217

@@ -639,7 +654,7 @@ function enableBeta() {
639654
/**
640655
* @param {boolean} [showNotification]
641656
*/
642-
function registerContentScripts(showNotification = true) {
657+
function registerContentScripts(showNotification = false) {
643658
return new Promise((resolve, reject) => {
644659
chrome.permissions.getAll().then((permissions) => {
645660
if (permissions.origins?.includes("https://*.zoom.us/*") && permissions.origins?.includes("https://teams.live.com/*") && permissions.origins?.includes("https://teams.microsoft.com/*")) {
@@ -699,8 +714,8 @@ function registerContentScripts(showNotification = true) {
699714
chrome.notifications.create({
700715
type: "basic",
701716
iconUrl: "icon.png",
702-
title: "Enabled! Join Zoom/Teams meetings on the browser",
703-
message: "Refresh any existing Zoom/Teams pages"
717+
title: "Enabled!",
718+
message: "Join Teams/Zoom meetings on the browser. Refresh any existing Zoom/Teams pages"
704719
})
705720
}
706721
})

extension/content.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ function showNotification(extensionStatusJSON) {
639639
}
640640
chrome.runtime.sendMessage(message, (responseUntyped) => {
641641
const response = /** @type {ExtensionResponse} */ (responseUntyped)
642-
console.log(response)
643642
if (!response.success) {
644643
text.innerHTML += `<br/><br/> <b>Teams and Zoom transcripts are in beta. <u>Click to enable.</u></b>`
645644
obj.style.cssText += extensionStatusJSON.showBetaMessage ? `cursor: pointer;` : ``
@@ -650,8 +649,15 @@ function showNotification(extensionStatusJSON) {
650649
}
651650
chrome.runtime.sendMessage(message, function (responseUntyped) {
652651
const response = /** @type {ExtensionResponse} */ (responseUntyped)
653-
console.log(response)
654-
if (!response.success) {
652+
if (response.success) {
653+
if (response.message === "Teams and Zoom content scripts registered") {
654+
alert("Enabled! Join Teams/Zoom meetings on the browser. Refresh any existing Zoom/Teams pages.")
655+
}
656+
else {
657+
alert("Already enabled! Go ahead, enjoy your day!")
658+
}
659+
}
660+
else {
655661
alert(response.message)
656662
}
657663
})

extension/popup.js

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,35 +36,24 @@ window.onload = function () {
3636
})
3737

3838
enableBeta?.addEventListener("click", () => {
39-
chrome.permissions.request({
40-
origins: ["https://*.zoom.us/*", "https://teams.live.com/*", "https://teams.microsoft.com/*"],
41-
permissions: ["notifications"]
42-
}).then((granted) => {
43-
if (granted) {
44-
/** @type {ExtensionMessage} */
45-
const message = {
46-
type: "register_content_scripts",
39+
40+
/** @type {ExtensionMessage} */
41+
const message = {
42+
type: "enable_beta_with_notification",
43+
}
44+
chrome.runtime.sendMessage(message, function (responseUntyped) {
45+
const response = /** @type {ExtensionResponse} */ (responseUntyped)
46+
if (response.success) {
47+
if (response.message === "Teams and Zoom content scripts registered") {
48+
alert("Enabled! Join Teams/Zoom meetings on the browser. Refresh any existing Zoom/Teams pages")
49+
}
50+
else {
51+
alert("Already enabled! Go ahead, enjoy your day!")
4752
}
48-
chrome.runtime.sendMessage(message, (responseUntyped) => {
49-
const response = /** @type {ExtensionResponse} */ (responseUntyped)
50-
// Prevent alert as well as notification from background script
51-
if (response.success) {
52-
if (response.message !== "Teams and Zoom content scripts registered") {
53-
alert("Already enabled! Go ahead, enjoy your day!")
54-
}
55-
}
56-
else {
57-
console.error(response.message)
58-
alert("Failed to enable. Please try again.")
59-
}
60-
})
6153
}
6254
else {
63-
alert("Permission denied")
55+
alert(response.message)
6456
}
65-
}).catch((error) => {
66-
console.error(error)
67-
alert("Could not enable Teams and Zoom transcripts")
6857
})
6958
})
7059

types/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108

109109
/**
110110
* @typedef {Object} ExtensionMessage Message sent by the calling script
111-
* @property {"new_meeting_started" | "meeting_ended" | "download_transcript_at_index" | "retry_webhook_at_index" | "recover_last_meeting" | "register_content_scripts" | "enable_beta"} type type of message
111+
* @property {"new_meeting_started" | "meeting_ended" | "download_transcript_at_index" | "retry_webhook_at_index" | "recover_last_meeting" | "register_content_scripts" | "enable_beta" | "enable_beta_with_notification"} type type of message
112112
* @property {number} [index] index of the meeting to process
113113
*/
114114

0 commit comments

Comments
 (0)