client for blocking

This commit is contained in:
2020-09-20 22:24:57 +02:00
parent c078f3150e
commit 77564060e2
12 changed files with 81 additions and 22 deletions

View File

@@ -1,7 +1,8 @@
import browser from 'webextension-polyfill'
import { dashboard } from '../shared/utils'
import { insertLog, normalizeTimestamp } from '../shared/db'
import { insertLog, normalizeTimestamp, Limits } from '../shared/db'
import { getUsageForHost, percentagesToBool } from '../shared/lib'
browser.browserAction.onClicked.addListener(() => browser.tabs.create({ url: dashboard, active: true }))
@@ -37,3 +38,8 @@ async function getAllTabs() {
setInterval(() => {
getAllTabs()
}, frequency)
browser.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
// await Limits.
return getUsageForHost(message).then((percentages) => percentagesToBool(percentages))
})