chore: add support for Content scripts (#182)

* chore: add support for Content scripts

* chore: run script bae on browser

* chore: content script supporting canva website

* chore: add 2 minutes debounce for onclik events

* chore: add debounce for keypress events
This commit is contained in:
Juan Sebastian velez Posada
2023-03-28 17:59:15 -05:00
committed by GitHub
parent c2ead5149d
commit 7d795f854f
14 changed files with 346 additions and 419 deletions

View File

@@ -1,3 +1,6 @@
import browser from 'webextension-polyfill';
import config from '../config/config';
export default function apiKeyInvalid(key?: string): string {
const err = 'Invalid api key... check https://wakatime.com/settings for your key';
if (!key) return err;
@@ -8,3 +11,11 @@ export default function apiKeyInvalid(key?: string): string {
if (!re.test(key)) return err;
return '';
}
export async function getApiKey(): Promise<string> {
const storage = await browser.storage.sync.get({
apiKey: config.apiKey,
});
const apiKey = storage.apiKey as string;
return apiKey;
}