feat: remove all console.x
This commit is contained in:
parent
c8c69add9c
commit
9caee299f5
|
|
@ -3,10 +3,8 @@ import { initSchedule } from "./rules"
|
|||
import { initUpdateNotifications } from "./update-notifications"
|
||||
|
||||
export {}
|
||||
console.log("HELLO WORLD FROM BGSCRIPTS")
|
||||
|
||||
chrome.tabs.onActivated.addListener((tab) => {
|
||||
console.debug("Tab activated", tab)
|
||||
chrome.tabs.get(tab.tabId, (info) => {
|
||||
if (info.url) {
|
||||
getRSS(tab.tabId, info.url);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
|||
import { getRSS } from "~/background/rss"
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = (req) => {
|
||||
console.debug("content ready", req)
|
||||
|
||||
getRSS(req.sender.tab.id, req.sender.tab.url)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
|||
import { getCachedRSS } from "~/background/rss"
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = (req, res) => {
|
||||
console.debug("popup ready", req)
|
||||
|
||||
chrome.tabs.query({
|
||||
active: true,
|
||||
lastFocusedWindow: true
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
|||
import { refreshRules } from "~/background/rules"
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
console.debug("refresh rules", req)
|
||||
|
||||
res.send(await refreshRules())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
|||
import { getDisplayedRules } from "~/background/rules"
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
console.debug("request displayed rules", req)
|
||||
|
||||
res.send(await getDisplayedRules())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
|||
import { setDisplayedRules } from "~/background/rules"
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = (req, res) => {
|
||||
console.debug("response displayed rules", req)
|
||||
|
||||
setDisplayedRules(req.body.displayedRules)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"
|
|||
import { setRSS } from "~/background/rss"
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
console.debug("response RSS", req)
|
||||
|
||||
setRSS(req.body.tabId, req.body.rss)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,25 +20,18 @@ const savedRSS: {
|
|||
|
||||
const lock = new AsyncLock();
|
||||
export const getRSS = async (tabId, url) => {
|
||||
console.debug("Get RSS", tabId, url)
|
||||
|
||||
if (savedRSS[tabId]) {
|
||||
console.debug("Already have RSS", savedRSS[tabId])
|
||||
setRSS(tabId, savedRSS[tabId])
|
||||
return
|
||||
} else {
|
||||
await lock.acquire(tabId, async () => {
|
||||
console.debug("Send to content script requestHTML")
|
||||
const html = await sendToContentScript({
|
||||
name: "requestHTML",
|
||||
tabId,
|
||||
})
|
||||
|
||||
console.debug("Get html", html)
|
||||
|
||||
if (chrome.offscreen) {
|
||||
await setupOffscreenDocument("tabs/offscreen.html")
|
||||
console.debug("Send to offscreen")
|
||||
chrome.runtime.sendMessage({
|
||||
target: "offscreen",
|
||||
data: {
|
||||
|
|
@ -72,8 +65,6 @@ export const setRSS = (tabId, data: {
|
|||
pageRSSHub: RSSData[],
|
||||
websiteRSSHub: RSSData[],
|
||||
}) => {
|
||||
console.debug("Set RSS", tabId, data)
|
||||
|
||||
savedRSS[tabId] = data
|
||||
|
||||
let text = ''
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ function ruleHandler(rule: Rule, params, url, html, success, fail) {
|
|||
try {
|
||||
resultWithParams = rule.target(params, url, document);
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
resultWithParams = '';
|
||||
}
|
||||
} else if (typeof rule.target === 'string') {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,10 @@ export function parseRules(rules: string, forceJSON?: boolean) {
|
|||
if (typeof rules === 'string') {
|
||||
if (defaultConfig.enableFullRemoteRules && !forceJSON) {
|
||||
incomeRules = window['lave'.split('').reverse().join('')](rules);
|
||||
console.warn('lave');
|
||||
} else {
|
||||
try {
|
||||
incomeRules = JSON.parse(rules);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import { removeFunctionFields } from "~/lib/utils"
|
|||
|
||||
export { }
|
||||
|
||||
console.log("HELLO WORLD FROM SANDBOXES")
|
||||
|
||||
export const getRSS = async ({
|
||||
html,
|
||||
url,
|
||||
|
|
@ -46,7 +44,6 @@ export const getRSS = async ({
|
|||
export const getDisplayedRules = (rules: string) => {
|
||||
const displayedRules = parseRules(rules)
|
||||
removeFunctionFields(displayedRules)
|
||||
console.debug("requestDisplayedRules", displayedRules)
|
||||
return displayedRules
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import { useRef } from "react";
|
||||
import { sendToBackground } from "@plasmohq/messaging"
|
||||
|
||||
console.log("HELLO WORLD FROM OFFSCREEN")
|
||||
|
||||
window.addEventListener('message', (event) => {
|
||||
if (event.data?.name.startsWith("response")) {
|
||||
chrome.runtime.sendMessage(event.data)
|
||||
|
|
@ -14,7 +12,6 @@ function OffscreenPage() {
|
|||
const iframeRef = useRef<HTMLIFrameElement>(null);
|
||||
|
||||
chrome.runtime.onMessage.addListener((msg) => {
|
||||
console.debug("Received message from background", msg);
|
||||
iframeRef.current?.contentWindow?.postMessage(msg.data, "*");
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ function PreviewPage() {
|
|||
setError(e)
|
||||
})
|
||||
}, [])
|
||||
console.log("error", error)
|
||||
|
||||
return (
|
||||
<div className="max-w-screen-lg mx-auto py-16 text-base space-y-8">
|
||||
|
|
|
|||
Loading…
Reference in New Issue