Skip to content

Commit

Permalink
Add status JSON, bug link and refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-nexus committed Feb 7, 2024
1 parent 18b6f5f commit 91b6823
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 26 deletions.
46 changes: 24 additions & 22 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,28 +151,6 @@ const commonCSS = `background: rgb(255 255 255 / 25%);
font-family: 'Google Sans',Roboto,Arial,sans-serif;
box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;`;

async function checkExtensionStatus() {
// Set default value as 200
chrome.storage.local.set({
extensionStatusJSON: { status: 200, message: "<strong>Transcripto is running</strong> <br /> Do not turn off captions" },
});

// https://stackoverflow.com/a/42518434
// await fetch(
// "https://ejnana.github.io/gmeet-slack-integration-status/status-prod.json",
// { cache: "no-store" }
// )
// .then((response) => response.json())
// .then((result) => {
// // Write status to chrome local storage
// chrome.storage.local.set({ extensionStatusJSON: result }, function () {
// console.log("Extension status fetched and saved")
// });
// })
// .catch((err) => {
// console.log(err);
// });
}


function downloadTranscript() {
Expand Down Expand Up @@ -261,3 +239,27 @@ function transcriber(mutationsList, observer) {
}, 500);
}

async function checkExtensionStatus() {
// Set default value as 200
chrome.storage.local.set({
extensionStatusJSON: { status: 200, message: "<strong>Transcripto is running</strong> <br /> Do not turn off captions" },
});

// https://stackoverflow.com/a/42518434
await fetch(
"https://vivek-nexus.github.io/transcripto/status/status-prod.json",
{ cache: "no-store" }
)
.then((response) => response.json())
.then((result) => {
// Write status to chrome local storage
chrome.storage.local.set({ extensionStatusJSON: result }, function () {
console.log("Extension status fetched and saved")
});
})
.catch((err) => {
console.log(err);
});
}


5 changes: 4 additions & 1 deletion extension/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
background: #071f29;
color: #2A9ACA;
font-family: "Outfit", sans-serif;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2000 1500'%3E%3Cdefs%3E%3Ccircle stroke='%231F6F92' vector-effect='non-scaling-stroke' id='a' fill='none' stroke-width='4.1' r='315'/%3E%3Cuse id='f' href='%23a' stroke-dasharray='100 100 100 9999'/%3E%3Cuse id='b' href='%23a' stroke-dasharray='250 250 250 250 250 9999'/%3E%3Cuse id='e' href='%23a' stroke-dasharray='1000 500 1000 500 9999'/%3E%3Cuse id='g' href='%23a' stroke-dasharray='1500 9999'/%3E%3Cuse id='h' href='%23a' stroke-dasharray='2000 500 500 9999'/%3E%3Cuse id='j' href='%23a' stroke-dasharray='800 800 800 800 800 9999'/%3E%3Cuse id='k' href='%23a' stroke-dasharray='1200 1200 1200 1200 1200 9999'/%3E%3Cuse id='l' href='%23a' stroke-dasharray='1600 1600 1600 1600 1600 9999'/%3E%3C/defs%3E%3Cg transform='translate(1000 750)' stroke-opacity='0.06'%3E%3Cg %3E%3Ccircle fill='%231F6F92' fill-opacity='0.06' r='10'/%3E%3Cg%3E%3Cuse href='%23f' transform='scale(.1) rotate(50 0 0)' /%3E%3Cuse href='%23f' transform='scale(.2) rotate(100 0 0)' /%3E%3Cuse href='%23f' transform='scale(.3) rotate(150 0 0)' /%3E%3C/g%3E%3Cg transform=''%3E%3Cuse href='%23b' transform='scale(.4) rotate(200 0 0)' /%3E%3Cuse href='%23z' transform='scale(.5) rotate(250 0 0)' /%3E%3C/g%3E%3Cg id='z' transform=''%3E%3Cg transform=''%3E%3Cuse href='%23b'/%3E%3Cuse href='%23b' transform='scale(1.2) rotate(90 0 0)' /%3E%3Cuse href='%23b' transform='scale(1.4) rotate(60 0 0)' /%3E%3Cuse href='%23e' transform='scale(1.6) rotate(120 0 0)' /%3E%3Cuse href='%23e' transform='scale(1.8) rotate(30 0 0)' /%3E%3C/g%3E%3C/g%3E%3Cg id='y' transform=''%3E%3Cg transform=''%3E%3Cuse href='%23e' transform='scale(1.1) rotate(20 0 0)' /%3E%3Cuse href='%23g' transform='scale(1.3) rotate(-40 0 0)' /%3E%3Cuse href='%23g' transform='scale(1.5) rotate(60 0 0)' /%3E%3Cuse href='%23h' transform='scale(1.7) rotate(-80 0 0)' /%3E%3Cuse href='%23j' transform='scale(1.9) rotate(100 0 0)' /%3E%3C/g%3E%3C/g%3E%3Cg transform=''%3E%3Cg transform=''%3E%3Cg transform=''%3E%3Cuse href='%23h' transform='scale(2) rotate(60 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.1) rotate(120 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.3) rotate(180 0 0)'/%3E%3Cuse href='%23h' transform='scale(2.4) rotate(240 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.5) rotate(300 0 0)'/%3E%3C/g%3E%3Cuse href='%23y' transform='scale(2) rotate(180 0 0)' /%3E%3Cuse href='%23j' transform='scale(2.7)'/%3E%3Cuse href='%23j' transform='scale(2.8) rotate(45 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.9) rotate(90 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.1) rotate(135 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.2) rotate(180 0 0)'/%3E%3C/g%3E%3Cuse href='%23k' transform='scale(3.3) rotate(225 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.5) rotate(270 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.6) rotate(315 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.7)'/%3E%3Cuse href='%23k' transform='scale(3.9) rotate(75 0 0)'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2000 1500'%3E%3Cdefs%3E%3Ccircle stroke='%231F6F92' vector-effect='non-scaling-stroke' id='a' fill='none' stroke-width='4.1' r='315'/%3E%3Cuse id='f' href='%23a' stroke-dasharray='100 100 100 9999'/%3E%3Cuse id='b' href='%23a' stroke-dasharray='250 250 250 250 250 9999'/%3E%3Cuse id='e' href='%23a' stroke-dasharray='1000 500 1000 500 9999'/%3E%3Cuse id='g' href='%23a' stroke-dasharray='1500 9999'/%3E%3Cuse id='h' href='%23a' stroke-dasharray='2000 500 500 9999'/%3E%3Cuse id='j' href='%23a' stroke-dasharray='800 800 800 800 800 9999'/%3E%3Cuse id='k' href='%23a' stroke-dasharray='1200 1200 1200 1200 1200 9999'/%3E%3Cuse id='l' href='%23a' stroke-dasharray='1600 1600 1600 1600 1600 9999'/%3E%3C/defs%3E%3Cg transform='translate(1000 750)' stroke-opacity='0.1'%3E%3Cg %3E%3Ccircle fill='%231F6F92' fill-opacity='0.1' r='10'/%3E%3Cg%3E%3Cuse href='%23f' transform='scale(.1) rotate(50 0 0)' /%3E%3Cuse href='%23f' transform='scale(.2) rotate(100 0 0)' /%3E%3Cuse href='%23f' transform='scale(.3) rotate(150 0 0)' /%3E%3C/g%3E%3Cg transform=''%3E%3Cuse href='%23b' transform='scale(.4) rotate(200 0 0)' /%3E%3Cuse href='%23z' transform='scale(.5) rotate(250 0 0)' /%3E%3C/g%3E%3Cg id='z' transform=''%3E%3Cg transform=''%3E%3Cuse href='%23b'/%3E%3Cuse href='%23b' transform='scale(1.2) rotate(90 0 0)' /%3E%3Cuse href='%23b' transform='scale(1.4) rotate(60 0 0)' /%3E%3Cuse href='%23e' transform='scale(1.6) rotate(120 0 0)' /%3E%3Cuse href='%23e' transform='scale(1.8) rotate(30 0 0)' /%3E%3C/g%3E%3C/g%3E%3Cg id='y' transform=''%3E%3Cg transform=''%3E%3Cuse href='%23e' transform='scale(1.1) rotate(20 0 0)' /%3E%3Cuse href='%23g' transform='scale(1.3) rotate(-40 0 0)' /%3E%3Cuse href='%23g' transform='scale(1.5) rotate(60 0 0)' /%3E%3Cuse href='%23h' transform='scale(1.7) rotate(-80 0 0)' /%3E%3Cuse href='%23j' transform='scale(1.9) rotate(100 0 0)' /%3E%3C/g%3E%3C/g%3E%3Cg transform=''%3E%3Cg transform=''%3E%3Cg transform=''%3E%3Cuse href='%23h' transform='scale(2) rotate(60 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.1) rotate(120 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.3) rotate(180 0 0)'/%3E%3Cuse href='%23h' transform='scale(2.4) rotate(240 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.5) rotate(300 0 0)'/%3E%3C/g%3E%3Cuse href='%23y' transform='scale(2) rotate(180 0 0)' /%3E%3Cuse href='%23j' transform='scale(2.7)'/%3E%3Cuse href='%23j' transform='scale(2.8) rotate(45 0 0)'/%3E%3Cuse href='%23j' transform='scale(2.9) rotate(90 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.1) rotate(135 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.2) rotate(180 0 0)'/%3E%3C/g%3E%3Cuse href='%23k' transform='scale(3.3) rotate(225 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.5) rotate(270 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.6) rotate(315 0 0)'/%3E%3Cuse href='%23k' transform='scale(3.7)'/%3E%3Cuse href='%23k' transform='scale(3.9) rotate(75 0 0)'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
Expand Down Expand Up @@ -60,6 +60,7 @@
color: #2A9ACA;
font-weight: bold;
font-size: 1rem;
text-underline-offset: 4px;
}
</style>
</head>
Expand Down Expand Up @@ -102,6 +103,8 @@ <h2>How to use Transcripto?</h2>
<a href="" id="last-meeting-transcript">Download last meeting transcript</a>
&nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;
<a href="https://github.com/vivek-nexus/transcripto#readme" target="_blank">Get more help</a>
&nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp;
<a href="https://github.com/vivek-nexus/transcripto/issues" target="_blank">Report a bug</a>
</div>
<p style="font-size: small;">Another
project by <span><a href="https://vivek-nexus.github.io" target="_blank"
Expand Down
9 changes: 6 additions & 3 deletions extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ window.onload = function () {
manualModeRadio.addEventListener('change', function () {
chrome.storage.sync.set({ operationMode: "manual" }, function () { })
})

lastMeetingTranscriptLink.addEventListener("click", () => {
chrome.storage.local.get(["transcript"], function (result) {
if (!result.transcript)
alert("Couldn't find the last meeting's transcript. May be attend one?")
})
})
}

downloadTranscript()
Expand Down Expand Up @@ -48,7 +53,5 @@ function downloadTranscript() {
lastMeetingTranscriptLink.href = URL.createObjectURL(blob);
lastMeetingTranscriptLink.download = `Transcript.txt`;
}
else
alert("Couldn't find the last meeting's transcript. May be attend one?")
})
}
4 changes: 4 additions & 0 deletions status/status-prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": 200,
"message": "<strong>Transcripto is running</strong> <br /> Do not turn off captions"
}
4 changes: 4 additions & 0 deletions status/status-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"status": 400,
"message": "<strong>Transcripto is down for bug fix</strong> <br /> It will resume automatically once the bug is fixed. Check status <a href='https://github.com/vivek-nexus/transcripto#readme' target='_blank'>here</a>."
}

0 comments on commit 91b6823

Please sign in to comment.