1
0
mirror of https://gitlab.com/ceda_ei/google-meet-captions-regex synced 2025-07-09 10:16:52 +02:00

Compare commits

..

1 Commits
master ... v1.2

Author SHA1 Message Date
bc15bc411c Add build.sh. Version bump. 2020-09-15 18:32:12 +05:30
4 changed files with 7 additions and 26 deletions

View File

@ -1,13 +0,0 @@
function handleMatch(match) {
new Notification("Match found", {body: match});
const audio = new Audio(browser.runtime.getURL("static/notif.mp3"));
audio.play();
}
function handleMessage(request) {
if (request.type == "match")
return handleMatch(request.match);
}
browser.runtime.onMessage.addListener(handleMessage);

View File

@ -5,7 +5,6 @@ yarn install
yarn build
cd ..
[[ -d web-ext-artifacts ]] || mkdir web-ext-artifacts
FILENAME="$(basename "$PWD")-$(jq -r .version manifest.json).zip"
zip -r "web-ext-artifacts/$FILENAME" LICENSE gmcr.js manifest.json background.js popup/build/ icons/
zip -r "web-ext-artifacts/$FILENAME" LICENSE gmcr.js manifest.json popup/build/ icons/
zip -r "web-ext-artifacts/source-$FILENAME" $(git ls-files)

View File

@ -13,6 +13,7 @@ function surroundText(haystack, wordList, padding) {
surroundingText += "...";
surroundingText += "<br>";
console.log(start, end, surroundingText);
});
return surroundingText.trim();
}
@ -51,15 +52,15 @@ function captionUpdate() {
} else {
[ matched, surroundingText ] = simpleMatch(captions, storage.words);
}
console.log(matched, surroundingText);
/* The lastNotification prevents repetitive notifications because
* of constant updates.
*/
if (matched && surroundingText !== lastNotification) {
browser.runtime.sendMessage({
type: "match",
match: surroundingText
});
new Notification("Match found", {body: surroundingText});
lastNotification = surroundingText;
const audio = new Audio(browser.runtime.getURL("static/notif.mp3"));
audio.play();
}
})
}

View File

@ -1,13 +1,12 @@
{
"manifest_version": 2,
"name": "Google Meet Caption Regex",
"version": "1.4",
"version": "1.2",
"description": "Send a notification when a caption in Google Meet matches a certain regex.",
"homepage_url": "https://gitlab.com/ceda_ei/google-meet-captions-regex",
"permissions": [
"background",
"notifications",
"storage"
],
@ -23,16 +22,11 @@
"default_popup": "popup/build/index.html"
},
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches": ["https://meet.google.com/*"],
"js": ["gmcr.js"]
}
],
"web_accessible_resources": ["static/*"]
}