feat: init

This commit is contained in:
eric
2023-08-12 15:56:22 +08:00
parent 8524c97618
commit 2f333d962f
51 changed files with 443840 additions and 79 deletions

11
background/index.ts Normal file
View File

@@ -0,0 +1,11 @@
export {}
console.log(
"111111ous time. Now will never come again."
)
const res = fetch('http://192.168.31.245:8080?a=1', { method: "GET"});

View File

@@ -0,0 +1,9 @@
import type { PlasmoMessaging } from "@plasmohq/messaging"
const handler: PlasmoMessaging.MessageHandler = async (_, res) => {
const manifest = chrome.runtime.getManifest()
res.send(manifest)
}
export default handler

View File

@@ -0,0 +1,25 @@
import type { PlasmoMessaging } from "@plasmohq/messaging"
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const url = "http://192.168.31.245:8080?a=1"
console.log('getmessage')
const customHeaders = {
"Content-Type": "application/json"
}
const data = {
id: req.body.id
}
const message = await fetch(url, {
method: "POST",
headers: customHeaders,
body: JSON.stringify(data)
})
res.send({
message:'1112'
})
}
export default handler

11
background/ports/mail.ts Normal file
View File

@@ -0,0 +1,11 @@
import type { PlasmoMessaging } from "@plasmohq/messaging"
const handler: PlasmoMessaging.PortHandler = async (req, res) => {
console.log(req)
res.send({
message: "Hello from port handler"
})
}
export default handler