mirror of
https://github.com/tlsnotary/tlsn-extension.git
synced 2026-01-09 21:18:02 -05:00
fix: webpack config and return data when handling rpc requests (#38)
* upgrade tlsn-js and fix webpack config * fix: return data when handling rpc request * fix: fetch history and requests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tlsn-extension",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.13",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -35,7 +35,7 @@
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-thunk": "^2.4.2",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"tlsn-js": "^0.0.2"
|
||||
"tlsn-js": "0.1.0-alpha.3-rc1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.20.12",
|
||||
|
||||
@@ -103,7 +103,7 @@ function handleGetRequests(
|
||||
const cache = getCacheByTabId(request.data);
|
||||
const keys = cache.keys() || [];
|
||||
const data = keys.map((key) => cache.get(key));
|
||||
return sendResponse(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
async function handleGetProveRequests(
|
||||
|
||||
@@ -18,6 +18,7 @@ import Notarize from '../../pages/Notarize';
|
||||
import ProofViewer from '../../pages/ProofViewer';
|
||||
import History from '../../pages/History';
|
||||
import ProofUploader from '../../pages/ProofUploader';
|
||||
import browser from 'webextension-polyfill';
|
||||
|
||||
const Popup = () => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -27,21 +28,21 @@ const Popup = () => {
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const [tab] = await chrome.tabs.query({
|
||||
const [tab] = await browser.tabs.query({
|
||||
active: true,
|
||||
lastFocusedWindow: true,
|
||||
});
|
||||
|
||||
dispatch(setActiveTab(tab || null));
|
||||
|
||||
const logs = await chrome.runtime.sendMessage({
|
||||
const logs = await browser.runtime.sendMessage({
|
||||
type: BackgroundActiontype.get_requests,
|
||||
data: tab?.id,
|
||||
});
|
||||
|
||||
dispatch(setRequests(logs));
|
||||
|
||||
const history = await chrome.runtime.sendMessage({
|
||||
await browser.runtime.sendMessage({
|
||||
type: BackgroundActiontype.get_prove_requests,
|
||||
data: tab?.id,
|
||||
});
|
||||
|
||||
@@ -7,6 +7,7 @@ import { AppRootState } from './index';
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import { get, NOTARY_API_LS_KEY, PROXY_API_LS_KEY } from '../utils/storage';
|
||||
import { BackgroundActiontype } from '../entries/Background/rpc';
|
||||
import browser from 'webextension-polyfill';
|
||||
|
||||
enum ActionType {
|
||||
'/requests/setRequests' = '/requests/setRequests',
|
||||
@@ -59,8 +60,8 @@ export const notarizeRequest = (options: RequestHistory) => async () => {
|
||||
};
|
||||
|
||||
export const setActiveTab = (
|
||||
activeTab: chrome.tabs.Tab | null,
|
||||
): Action<chrome.tabs.Tab | null> => ({
|
||||
activeTab: browser.Tabs.Tab | null,
|
||||
): Action<browser.Tabs.Tab | null> => ({
|
||||
type: ActionType['/requests/setActiveTab'],
|
||||
payload: activeTab,
|
||||
});
|
||||
@@ -79,7 +80,7 @@ export default function requests(
|
||||
return {
|
||||
...state,
|
||||
map: {
|
||||
...(action.payload || []).reduce(
|
||||
...(action?.payload || []).reduce(
|
||||
(acc: { [requestId: string]: RequestLog }, req: RequestLog) => {
|
||||
if (req) {
|
||||
acc[req.requestId] = req;
|
||||
|
||||
@@ -193,23 +193,28 @@ var options = {
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
// {
|
||||
// from: "node_modules/tlsn-js/build/7.js",
|
||||
// to: path.join(__dirname, "build"),
|
||||
// force: true,
|
||||
// },
|
||||
// {
|
||||
// from: "node_modules/tlsn-js/build/250.js",
|
||||
// to: path.join(__dirname, "build"),
|
||||
// force: true,
|
||||
// },
|
||||
// {
|
||||
// from: "node_modules/tlsn-js/build/278.js",
|
||||
// to: path.join(__dirname, "build"),
|
||||
// force: true,
|
||||
// },
|
||||
// {
|
||||
// from: "node_modules/tlsn-js/build/349.js",
|
||||
// to: path.join(__dirname, "build"),
|
||||
// force: true,
|
||||
// },
|
||||
{
|
||||
from: "node_modules/tlsn-js/build/7.js",
|
||||
to: path.join(__dirname, "build"),
|
||||
force: true,
|
||||
},
|
||||
{
|
||||
from: "node_modules/tlsn-js/build/278.js",
|
||||
to: path.join(__dirname, "build"),
|
||||
force: true,
|
||||
},
|
||||
{
|
||||
from: "node_modules/tlsn-js/build/349.js",
|
||||
to: path.join(__dirname, "build"),
|
||||
force: true,
|
||||
},
|
||||
{
|
||||
from: "node_modules/tlsn-js/build/*.wasm",
|
||||
from: "node_modules/tlsn-js/build",
|
||||
to: path.join(__dirname, "build"),
|
||||
force: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user