mirror of
https://github.com/tlsnotary/tlsn-extension.git
synced 2026-01-09 21:18:02 -05:00
chore: update default twitter plugin and bump version (#132)
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "tlsn-extension",
|
||||
"version": "0.1.0.700",
|
||||
"version": "0.1.0.703",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tlsn-extension",
|
||||
"version": "0.1.0.700",
|
||||
"version": "0.1.0.703",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@extism/extism": "^1.0.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tlsn-extension",
|
||||
"version": "0.1.0.702",
|
||||
"version": "0.1.0.703",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Binary file not shown.
@@ -471,11 +471,13 @@ export async function getSessionStorageByHost(host: string) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
async function getDefaultPluginsInstalled(): Promise<boolean> {
|
||||
async function getDefaultPluginsInstalled(): Promise<string | boolean> {
|
||||
return appDb.get(AppDatabaseKey.DefaultPluginsInstalled).catch(() => false);
|
||||
}
|
||||
|
||||
export async function setDefaultPluginsInstalled(installed = false) {
|
||||
export async function setDefaultPluginsInstalled(
|
||||
installed: string | boolean = false,
|
||||
) {
|
||||
return mutex.runExclusive(async () => {
|
||||
await appDb.put(AppDatabaseKey.DefaultPluginsInstalled, installed);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { onBeforeRequest, onResponseStarted, onSendHeaders } from './handlers';
|
||||
import { deleteCacheByTabId } from './cache';
|
||||
import browser from 'webextension-polyfill';
|
||||
import { getAppState, setDefaultPluginsInstalled } from './db';
|
||||
import { getAppState, removePlugin, setDefaultPluginsInstalled } from './db';
|
||||
import { installPlugin } from './plugins/utils';
|
||||
|
||||
(async () => {
|
||||
@@ -35,15 +35,36 @@ import { installPlugin } from './plugins/utils';
|
||||
|
||||
const { defaultPluginsInstalled } = await getAppState();
|
||||
|
||||
if (!defaultPluginsInstalled) {
|
||||
try {
|
||||
const twitterProfileUrl = browser.runtime.getURL('twitter_profile.wasm');
|
||||
const discordDmUrl = browser.runtime.getURL('discord_dm.wasm');
|
||||
await installPlugin(twitterProfileUrl);
|
||||
await installPlugin(discordDmUrl);
|
||||
} finally {
|
||||
await setDefaultPluginsInstalled(true);
|
||||
switch (defaultPluginsInstalled) {
|
||||
case false: {
|
||||
try {
|
||||
const twitterProfileUrl = browser.runtime.getURL(
|
||||
'twitter_profile.wasm',
|
||||
);
|
||||
const discordDmUrl = browser.runtime.getURL('discord_dm.wasm');
|
||||
await installPlugin(twitterProfileUrl);
|
||||
await installPlugin(discordDmUrl);
|
||||
} finally {
|
||||
await setDefaultPluginsInstalled('0.1.0.703');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case true: {
|
||||
try {
|
||||
await removePlugin(
|
||||
'6931d2ad63340d3a1fb1a5c1e3f4454c5a518164d6de5ad272e744832355ee02',
|
||||
);
|
||||
const twitterProfileUrl = browser.runtime.getURL(
|
||||
'twitter_profile.wasm',
|
||||
);
|
||||
await installPlugin(twitterProfileUrl);
|
||||
} finally {
|
||||
await setDefaultPluginsInstalled('0.1.0.703');
|
||||
}
|
||||
break;
|
||||
}
|
||||
case '0.1.0.703':
|
||||
break;
|
||||
}
|
||||
|
||||
const { initRPC } = await import('./rpc');
|
||||
|
||||
Reference in New Issue
Block a user