Skip to content

Commit

Permalink
TAB-481 wip
Browse files Browse the repository at this point in the history
  • Loading branch information
evandor committed Jan 20, 2024
1 parent 1d71442 commit df8a3ab
Show file tree
Hide file tree
Showing 34 changed files with 1,094 additions and 563 deletions.
2 changes: 1 addition & 1 deletion docs/authorization.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="drawio-plugin" modified="2024-01-15T18:15:51.551Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" etag="xoAP6v9OkBP8_Mj2FZv2" version="20.5.3" type="embed"><diagram id="23iRSUPoRavnBvh4doch" name="Page-1"><mxGraphModel dx="1465" dy="1174" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="3" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="190" y="130" width="120" height="360" as="geometry"/></mxCell><mxCell id="4" value="SidePanel" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="220" y="80" width="60" height="30" as="geometry"/></mxCell><mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="50" y="130" width="120" height="360" as="geometry"/></mxCell><mxCell id="7" value="Welcome Page (?)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="80" y="80" width="60" height="30" as="geometry"/></mxCell><mxCell id="10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="8" target="9"><mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="280" y="570"/></Array></mxGeometry></mxCell><mxCell id="8" value="Login" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="255" y="466" width="50" height="20" as="geometry"/></mxCell><mxCell id="9" value="Firebase" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1"><mxGeometry x="440" y="540" width="120" height="60" as="geometry"/></mxCell><mxCell id="11" value="sendSignInLinkToEmail" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="280" y="540" width="150" height="30" as="geometry"/></mxCell><mxCell id="12" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="321" y="130" width="380" height="360" as="geometry"/></mxCell><mxCell id="13" value="Main" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="480" y="80" width="60" height="30" as="geometry"/></mxCell><mxCell id="15" value="" style="html=1;verticalLabelPosition=bottom;align=center;labelBackgroundColor=#ffffff;verticalAlign=top;strokeWidth=2;strokeColor=#0080F0;shadow=0;dashed=0;shape=mxgraph.ios7.icons.mail;" vertex="1" parent="1"><mxGeometry x="460" y="510" width="30" height="16.5" as="geometry"/></mxCell><mxCell id="16" value="click on Link, redirecting to&amp;nbsp;&lt;br&gt;tabsets" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="520" y="503.25" width="210" height="30" as="geometry"/></mxCell><mxCell id="20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="17" target="19"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="17" value="&lt;b&gt;ChromeListener&lt;/b&gt;&lt;br&gt;checkOriginForEmailLink" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="385" y="410" width="230" height="40" as="geometry"/></mxCell><mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="9" target="17"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="18" value="Text" style="text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;" vertex="1" parent="1"><mxGeometry x="865" y="545" width="50" height="30" as="geometry"/></mxCell><mxCell id="19" value="&lt;b&gt;AuthStore&lt;/b&gt;&lt;br&gt;setAuthRequest(authRequest)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="385" y="330" width="230" height="40" as="geometry"/></mxCell><mxCell id="23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" edge="1" parent="1" source="21" target="19"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="21" target="24"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="21" value="Watch &lt;br&gt;AuthRequest" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;size=10;" vertex="1" parent="1"><mxGeometry x="200" y="330" width="100" height="40" as="geometry"/></mxCell><mxCell id="22" value="Watch &lt;br&gt;AuthRequest" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;size=10;" vertex="1" parent="1"><mxGeometry x="60" y="330" width="100" height="40" as="geometry"/></mxCell><mxCell id="28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="24" target="27"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="24" value="reload page with&lt;br&gt;authRequest Params" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="205" y="230" width="90" height="70" as="geometry"/></mxCell><mxCell id="27" value="&lt;b&gt;App.vue&lt;/b&gt;&lt;br&gt;isSignInWith&lt;br&gt;EmailLink?&lt;br&gt;sign in" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="195" y="140" width="110" height="67" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>
<mxfile host="drawio-plugin" modified="2024-01-15T18:27:22.843Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" etag="zVLa5IalWynmGP_QGqDB" version="20.5.3" type="embed"><diagram id="23iRSUPoRavnBvh4doch" name="Page-1"><mxGraphModel dx="1465" dy="1174" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="3" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="190" y="130" width="120" height="360" as="geometry"/></mxCell><mxCell id="4" value="SidePanel" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="220" y="80" width="60" height="30" as="geometry"/></mxCell><mxCell id="6" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="50" y="130" width="120" height="360" as="geometry"/></mxCell><mxCell id="7" value="Welcome Page (?)" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="80" y="80" width="60" height="30" as="geometry"/></mxCell><mxCell id="10" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="8" target="9"><mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="280" y="570"/></Array></mxGeometry></mxCell><mxCell id="31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.75;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="8" target="33"><mxGeometry relative="1" as="geometry"><mxPoint x="254.01" y="548" as="targetPoint"/></mxGeometry></mxCell><mxCell id="8" value="Login" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="255" y="466" width="50" height="20" as="geometry"/></mxCell><mxCell id="9" value="Firebase" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;" vertex="1" parent="1"><mxGeometry x="440" y="540" width="120" height="60" as="geometry"/></mxCell><mxCell id="11" value="sendSignInLinkToEmail" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="280" y="540" width="150" height="30" as="geometry"/></mxCell><mxCell id="12" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="321" y="130" width="380" height="360" as="geometry"/></mxCell><mxCell id="13" value="Main" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="480" y="80" width="60" height="30" as="geometry"/></mxCell><mxCell id="15" value="" style="html=1;verticalLabelPosition=bottom;align=center;labelBackgroundColor=#ffffff;verticalAlign=top;strokeWidth=2;strokeColor=#0080F0;shadow=0;dashed=0;shape=mxgraph.ios7.icons.mail;" vertex="1" parent="1"><mxGeometry x="460" y="510" width="30" height="16.5" as="geometry"/></mxCell><mxCell id="16" value="click on Link, redirecting to&amp;nbsp;&lt;br&gt;tabsets" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="520" y="503.25" width="210" height="30" as="geometry"/></mxCell><mxCell id="20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="17" target="19"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="17" value="&lt;b&gt;ChromeListener&lt;/b&gt;&lt;br&gt;checkOriginForEmailLink" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="385" y="410" width="230" height="40" as="geometry"/></mxCell><mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" edge="1" parent="1" source="9" target="17"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="19" value="&lt;b&gt;AuthStore&lt;/b&gt;&lt;br&gt;setAuthRequest(authRequest)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="385" y="330" width="230" height="40" as="geometry"/></mxCell><mxCell id="23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;dashed=1;" edge="1" parent="1" source="21" target="19"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="21" target="24"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="21" value="Watch &lt;br&gt;AuthRequest" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;size=10;" vertex="1" parent="1"><mxGeometry x="200" y="410" width="100" height="40" as="geometry"/></mxCell><mxCell id="22" value="Watch &lt;br&gt;AuthRequest" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;size=10;" vertex="1" parent="1"><mxGeometry x="60" y="410" width="100" height="40" as="geometry"/></mxCell><mxCell id="28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="24" target="27"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="24" value="reload page with&lt;br&gt;authRequest Params" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="205" y="330" width="90" height="65" as="geometry"/></mxCell><mxCell id="30" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="27" target="29"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="27" target="33"><mxGeometry relative="1" as="geometry"><mxPoint x="180" y="533" as="targetPoint"/><Array as="points"><mxPoint x="180" y="284"/></Array></mxGeometry></mxCell><mxCell id="27" value="&lt;b&gt;App.vue&lt;/b&gt;&lt;br&gt;is SignIn Link?&lt;br&gt;authStore: save User" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="195" y="253" width="110" height="62" as="geometry"/></mxCell><mxCell id="36" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="29" target="35"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="29" value="Watch &lt;br&gt;User" style="shape=hexagon;perimeter=hexagonPerimeter2;whiteSpace=wrap;html=1;fixedSize=1;size=10;" vertex="1" parent="1"><mxGeometry x="200" y="193" width="100" height="40" as="geometry"/></mxCell><mxCell id="33" value="&lt;span style=&quot;&quot;&gt;remember email&lt;/span&gt;" style="whiteSpace=wrap;html=1;" vertex="1" parent="1"><mxGeometry x="150" y="550" width="120" height="30" as="geometry"/></mxCell><mxCell id="34" value="check" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1"><mxGeometry x="130" y="503.25" width="60" height="30" as="geometry"/></mxCell><mxCell id="35" value="Account" style="strokeWidth=2;html=1;shape=mxgraph.flowchart.database;whiteSpace=wrap;" vertex="1" parent="1"><mxGeometry x="207" y="133" width="85" height="40" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>
2 changes: 1 addition & 1 deletion docs/authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const signin = () => {
sendSignInLinkToEmail(auth, email.value, actionCodeSettings)
.then(() => {
...
window.localStorage.setItem('emailForSignIn', email.value);
window.localStorage.setItem(CURRENT_USER_EMAIL, email.value);
sendMsg('SET_EMAIL_FOR_SIGN_IN', {"email": email.value})
})
}
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
"@types/pixelmatch": "^5.2.6",
"@types/uuid": "^9.0.1",
"@vitest/coverage-c8": "^0.33.0",
"@vitest/coverage-v8": "^1.1.3",
"@vitest/ui": "^1.1.3",
"@vitest/coverage-v8": "^0.34.3",
"@vitest/ui": "^0.34.3",
"@vue/test-utils": "^2.4.1",
"@wdio/cli": "^8.13.5",
"autoprefixer": "^10.4.2",
Expand All @@ -114,7 +114,7 @@
"electron-packager": "^17.1.1",
"fake-indexeddb": "^5.0.1",
"typescript": "^5.1.6",
"vitest": "^1.1.3",
"vitest": "^0.34.0",
"workbox-build": "^7.0.0",
"workbox-cacheable-response": "^7.0.0",
"workbox-core": "^7.0.0",
Expand Down
38 changes: 0 additions & 38 deletions src-bex/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,6 @@ addEventListener('unhandledrejection', async (event) => {
//Analytics.fireErrorEvent(event.reason);
});

// --- https://github.com/younessssssss/firebase-chrome-ext-auth/blob/main/src/background.js start
// chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
// console.log("***", message)
// if (message.type === "SET_EMAIL_FOR_SIGN_IN") {
// chrome.storage.local.set({ emailForSignIn: message.email });
// chrome.storage.local.set({ tabext: sender.tab });
// console.log("SET_EMAIL_FOR_SIGN_IN", message.email);
// }
// });

// chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
// console.log("** wrong here *!", changeInfo)
// if (changeInfo.url) {
// const emailLink = changeInfo.url;
// const urlOrigin = new URL(emailLink).origin;
// const extensionOrigin = "http://localhost"; // Replace with your extension's origin
//
// console.log("urlOrigin!!", urlOrigin, urlOrigin === "http://localhost:9000");
//
// if (urlOrigin === "http://localhost:9000") {
// // Get email from local storage
// //chrome.storage.local.get("emailForSignIn", (data) => {
// const email = "[email protected]" //data.emailForSignIn;
// // Send a message to the content script with emailLink and email
// chrome.storage.local.get("tabext", (data1) => {
// console.log("sending", data1)
// chrome.tabs.sendMessage(data1.tabext.id, {
// type: "emailLink",
// emailLink,
// email,
// });
// });
// // });
// }
// }
// });
// --- https://github.com/younessssssss/firebase-chrome-ext-auth/blob/main/src/background.js end

chrome.runtime.onInstalled.addListener((callback) => {
console.log("ga: fire event install", callback.reason, callback.previousVersion)
// getting error: "Service worker registration failed. Status code: 15"
Expand Down
3 changes: 2 additions & 1 deletion src-bex/content-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// More info: https://quasar.dev/quasar-cli/developing-browser-extensions/content-hooks
// @ts-ignore
import {bexContent} from 'quasar/wrappers'
import {CURRENT_USER_EMAIL} from "boot/constants";

export default bexContent((bridge: any) => {

Expand Down Expand Up @@ -47,7 +48,7 @@ export default bexContent((bridge: any) => {
// csIframe.style.top = "75px"
}
else if (request.type === "SET_EMAIL_FOR_SIGN_IN") {
chrome.storage.local.set({ emailForSignIn: request.email });
chrome.storage.local.set({ CURRENT_USER_EMAIL: request.email });
chrome.storage.local.set({ tabext: sender.tab });
console.log("SET_EMAIL_FOR_SIGN_IN", request.email);
}
Expand Down
3 changes: 2 additions & 1 deletion src-bex/tabsets-content-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// More info: https://quasar.dev/quasar-cli/developing-browser-extensions/content-hooks
// @ts-ignore
import {bexContent} from 'quasar/wrappers'
import {CURRENT_USER_EMAIL} from "boot/constants";


export default bexContent((bridge: any) => {
Expand All @@ -27,7 +28,7 @@ export default bexContent((bridge: any) => {
sendResponse()
}
else if (request.type === "SET_EMAIL_FOR_SIGN_IN") {
chrome.storage.local.set({ emailForSignIn: request.email });
chrome.storage.local.set({ CURRENT_USER_EMAIL: request.email });
chrome.storage.local.set({ tabext: sender.tab });
console.log("SET_EMAIL_FOR_SIGN_IN", request.email);
}
Expand Down
Loading

0 comments on commit df8a3ab

Please sign in to comment.