Updated Extension

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2024-08-18 20:08:50 -07:00
parent 7c9309ac75
commit 2f22acbfa0
5 changed files with 24 additions and 9 deletions

@ -1 +1 @@
Subproject commit ccc2c32bb16f2856ba6d52d503e9e0ff97708cac Subproject commit b4284e4001afc3062549a6faf0bdcc7b6d3b1b3c

View file

@ -3,7 +3,7 @@
"name": "SurfSense", "name": "SurfSense",
"description": "Extension to collect Browsing History for SurfSense.", "description": "Extension to collect Browsing History for SurfSense.",
"version": "0.0.1", "version": "0.0.2",
"action": { "action": {
"default_popup": "popup.html" "default_popup": "popup.html"

View file

@ -1,3 +0,0 @@
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
});

View file

@ -73,7 +73,7 @@ export const LoginForm = () => {
</h1> </h1>
<form className="space-y-4 md:space-y-6" onSubmit={handleSubmit}> <form className="space-y-4 md:space-y-6" onSubmit={handleSubmit}>
<div> <div>
<label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your email</label> <label className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Username</label>
<input type="text" value={username} onChange={(e) => setUsername(e.target.value)} name="email" id="email" className="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="name" /> <input type="text" value={username} onChange={(e) => setUsername(e.target.value)} name="email" id="email" className="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="name" />
</div> </div>
<div> <div>

View file

@ -22,9 +22,11 @@ import { API_SECRET_KEY, BACKEND_URL } from "./env";
export async function clearMem(): Promise<void> { export async function clearMem(): Promise<void> {
try { try {
let result = await chrome.storage.local.get(["webhistory"]); let webHistory = await chrome.storage.local.get(["webhistory"]);
let urlQueue = await chrome.storage.local.get(["urlQueueList"]);
let timeQueue = await chrome.storage.local.get(["timeQueueList"]);
if (!result.webhistory) { if (!webHistory.webhistory) {
return return
} }
@ -42,7 +44,21 @@ export async function clearMem(): Promise<void> {
//Only retain which is still active //Only retain which is still active
const newHistory = result.webhistory.map((element: any) => { const newHistory = webHistory.webhistory.map((element: any) => {
//@ts-ignore
if (actives.includes(element.tabsessionId)) {
return element
}
})
const newUrlQueue = urlQueue.urlQueueList.map((element: any) => {
//@ts-ignore
if (actives.includes(element.tabsessionId)) {
return element
}
})
const newTimeQueue = timeQueue.timeQueueList.map((element: any) => {
//@ts-ignore //@ts-ignore
if (actives.includes(element.tabsessionId)) { if (actives.includes(element.tabsessionId)) {
return element return element
@ -51,6 +67,8 @@ export async function clearMem(): Promise<void> {
await chrome.storage.local.set({ webhistory: newHistory.filter((item: any) => item) }); await chrome.storage.local.set({ webhistory: newHistory.filter((item: any) => item) });
await chrome.storage.local.set({ urlQueueList: newUrlQueue.filter((item: any) => item) });
await chrome.storage.local.set({ timeQueueList: newTimeQueue.filter((item: any) => item) });
toast.info("History Store Deleted!", { toast.info("History Store Deleted!", {
position: "bottom-center" position: "bottom-center"