授权没写完
This commit is contained in:
parent
46fc343e76
commit
9003b60c47
|
@ -8,13 +8,14 @@ let haveYouChecked=false;
|
|||
* 查看是否有权限运行
|
||||
* @param {*} google_mail 谷歌id
|
||||
*/
|
||||
//TODO 授权没写完
|
||||
async function viewPermission(google_mail){
|
||||
let data =await axios.get('https://api.giaogiao.uk/api.php?type=list');
|
||||
console.log(data)
|
||||
if(google_mail=='qq2392025971@gmail.com'){
|
||||
executionAuthority=true
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 监听消息
|
||||
|
@ -22,10 +23,17 @@ async function viewPermission(google_mail){
|
|||
* @param {*} sendResponse 返回消息
|
||||
*/
|
||||
chrome.runtime.onMessage.addListener(async (req, sender, sendResponse) => {
|
||||
if(executionAuthority){
|
||||
sendResponse(executionAuthority);
|
||||
return true
|
||||
}
|
||||
if(req.ty=="viewPermission"){
|
||||
const res = req.info
|
||||
let data=await viewPermission(res);
|
||||
console.log(data)
|
||||
sendResponse(data);
|
||||
console.log(res)
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
|
||||
|
|
14
js/popup.js
14
js/popup.js
|
@ -2,7 +2,7 @@
|
|||
* @Author: lingling 1077478963@qq.com
|
||||
* @Date: 2024-08-19 09:47:04
|
||||
* @LastEditors: lingling 1077478963@qq.com
|
||||
* @LastEditTime: 2024-08-26 14:50:09
|
||||
* @LastEditTime: 2024-09-25 10:55:38
|
||||
* @FilePath: \谷歌自动搜索邮箱自动点击v3\js\popup.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
|
@ -51,6 +51,7 @@ $(function () {
|
|||
sender,
|
||||
sendResponse
|
||||
) {
|
||||
console.log(request)
|
||||
// 判断是产生一个新页面是
|
||||
if (request.ty == "get") {
|
||||
sendResponse({ name, id });
|
||||
|
@ -62,10 +63,10 @@ $(function () {
|
|||
return true;
|
||||
});
|
||||
|
||||
// async function text() {
|
||||
// let a = await createTab("https://www.youtube.com/", "youtube");
|
||||
// return a;
|
||||
// }
|
||||
async function google() {
|
||||
let a = await createTab("https://www.google.com", "naver");
|
||||
return a;
|
||||
}
|
||||
async function youtube_shorts() {
|
||||
let a = await createTab(
|
||||
"https://www.youtube.com/shorts/",
|
||||
|
@ -103,6 +104,7 @@ $(function () {
|
|||
}
|
||||
//函数队列
|
||||
let queue = [];
|
||||
queue.push(google);
|
||||
// queue.push(play_finance);//好像js注入不进去
|
||||
queue.push(shopping);
|
||||
queue.push(calendar);
|
||||
|
@ -156,7 +158,7 @@ $(function () {
|
|||
}
|
||||
|
||||
chrome.tabs.onCreated.addListener((e) => {
|
||||
sed_cont(id);
|
||||
// sed_cont(id);
|
||||
console.log(e);
|
||||
console.log("创建了一个新的浏览器窗口");
|
||||
});
|
||||
|
|
|
@ -36,10 +36,15 @@ const naver = async (r, id) => {
|
|||
const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/;
|
||||
const match = googelid_str.match(emailRegex);
|
||||
const email = match ? match[0] : null;
|
||||
console.log(email)
|
||||
let res = await to_background(email);
|
||||
console.log(`res:${res} emall:${email}`);
|
||||
// send_close(id);
|
||||
console.log(`email:${email} r:${r} id${id}`)
|
||||
try {
|
||||
let res = await to_background(email);
|
||||
console.log(`res:${res} emall:${email}`);
|
||||
await delay(5)
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
send_close(id);
|
||||
};
|
||||
/**
|
||||
*
|
||||
|
@ -380,6 +385,7 @@ async function to_background(params) {
|
|||
chrome.runtime.sendMessage(
|
||||
{
|
||||
info: params,
|
||||
ty: "viewPermission",
|
||||
},
|
||||
(res) => {
|
||||
console.log(res);
|
||||
|
@ -438,7 +444,7 @@ chrome.runtime.sendMessage(
|
|||
}
|
||||
);
|
||||
|
||||
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
console.log(request);
|
||||
sendResponse("我收到了你的情书,popup~");
|
||||
});
|
||||
// chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
// console.log(request);
|
||||
// sendResponse("我收到了你的情书,popup~");
|
||||
// });
|
||||
|
|
Loading…
Reference in New Issue