6 changed files with 146 additions and 6 deletions
Binary file not shown.
@ -0,0 +1,28 @@ |
|||||
|
-----BEGIN PRIVATE KEY----- |
||||
|
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC1WOXpW/M8pE1s |
||||
|
IHSIrWmrZnS9X5ltvlxgix2O5M1SSBHhbR3tGXmmCJoBri2UHM7jgelTrvI7llXm |
||||
|
ebJ69sDnxMF54OO5D4f8E1YNaRzkSKoKv8Wlp8ae2h4JB3geedVqXHBEVINx9t0U |
||||
|
vDTeDK2k9/ICLqEtBqIwkYlMD3hRzJm4pEHaSAT29VhBAq+hQvHuVfMZn+6EFno8 |
||||
|
PNr5iICXHegl4cG1cXTDit8W6dh+t3vVBTHqQLbzB4PikdorzHwCuCRt+H88Ewjq |
||||
|
dz6jFizFhTFhQYiSBri179SQIl61sWMLZgw63fwnJstcfQ2greBDymJHfJpgIyf7 |
||||
|
lVzX9W/DAgMBAAECggEAQlZGKCKcLCs4LR0EM/knhe0BOELvx57SgPhytBJLb1Vw |
||||
|
wQMe5twiTVOpLoMuJheRsNSVayi8cIKyYpBS8zsvXrjxQ2m6M7iUOGhEWryANpvE |
||||
|
JBF5tfrVI8fLI+dpD9DmejVdVgmKWdaBkfO07SM7I/UVQKoZCHT8QIMEc9/W1ii/ |
||||
|
pSRmtREIi5tYuUnx97p18I1p7Ww/2+0EnHp7Bl3qE18SqXip8ru6UJGdust6jdc7 |
||||
|
Y+395ioAIoKzmGW3XgwO9SYNKgH6uQkkPLdrAfohjB5t1WMR7h7rWH+gv+Npa4Zj |
||||
|
AjnibT/T6sIWlxNTlnyYH6fqkoRl9aQz2oRx4dNGnQKBgQD+WHCRhz4PLs2JDZaJ |
||||
|
sFtk8t6oFruPV0ORjROado0uzU5ju6sOtLKMedKlKEZUOpeZRqCSOWDJ31nb+Bs0 |
||||
|
jr2FBNCyTxRaTGEnwmY0wPAWAfKk1g4NaBTbm7+ysM8/uf+QTAaD4S3wdFhzXiyG |
||||
|
d/PcW/N9EHt3++qZpEVnJ+skDQKBgQC2huUR+q1sukpqK6hMFoUm+0Ue2NErPREu |
||||
|
EUozSbrVOJe6L5Bo6VpKAjpkvNvfs8v7XE06p6/dT1yrW85+6tSYp/a5K02pNy2J |
||||
|
2dhe+HBG+XpBiky/kAsJ20luqTW7CfEWX34Q56/k+NyrpY5de6oMvqWYiJfvjmeJ |
||||
|
M88B+yPfDwKBgQCfY/D3YheEEEKBtuA13S0JMCJUmBpmE7umRRCZ5d1IDSUo3vyt |
||||
|
tJOH8PgOxBR+yFEkntwVhpufJrb7YJo774/ZAlF+zIvmoqLn9a1zNc2/HO1gWzxn |
||||
|
LmiTzyDs7FyUhQ0g8mPK1ZyiaWbctZGVmypZV85Y+7FEWbyFGCreIGf9KQKBgQCW |
||||
|
auQrxOFWUM8yX3f5/DUOwtNbcGIvt8uIo0b6rTACtviSvs/LJUL66oskqV6pI4pe |
||||
|
QtqCE96iCtzbenTZsrwwcXqpbj45zPcCOzxMR4B/fOh7SnWlCBeQr938DAXzdWXw |
||||
|
ghFp7QTPNSblbTG9aEPi7NmasjZDfJ9mOgPGJiiRkQKBgQCJ4yCbNgQFvTEjQUn+ |
||||
|
gJXWHjKGqNn7XTM4yWPbjvkYKuFYzUaa5V3XME8kyTc18zBZQuvcMIvkduq+jnow |
||||
|
o2NASeEjhdJgAaMyjqpz2Adesuym6YdUAURvrew3eZAqtvv7ZHAbqD0NTVaTwX1P |
||||
|
HmlLE6zIqcuhUMSuTkyrQe3lqQ== |
||||
|
-----END PRIVATE KEY----- |
||||
@ -1,24 +1,77 @@ |
|||||
|
var usernameInput = document.getElementById('username'); |
||||
|
var passwordInput = document.getElementById('password'); |
||||
|
|
||||
|
// 如果已经登录,提取local中信息
|
||||
|
chrome.storage.local.get(['loginStatus', 'loginInfo'], function(data) { |
||||
|
if (data.loginStatus) { |
||||
|
document.getElementById('userinfo').textContent = '已登录:' + data.loginInfo.uname; |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// DOM 载入完成
|
||||
document.addEventListener('DOMContentLoaded', function() { |
document.addEventListener('DOMContentLoaded', function() { |
||||
var openIncognitoButton = document.getElementById('openIncognito'); |
const openIncognitoButton = document.getElementById('openIncognito'); |
||||
var usernameInput = document.getElementById('username'); |
const openLiveButton = document.getElementById('openLive'); |
||||
var passwordInput = document.getElementById('password'); |
const loginButton = document.getElementById('login'); |
||||
|
|
||||
|
// 打开抖音
|
||||
openIncognitoButton.addEventListener('click', function() { |
openIncognitoButton.addEventListener('click', function() { |
||||
const username = usernameInput.value; |
const username = usernameInput.value; |
||||
const password = passwordInput.value; |
const password = passwordInput.value; |
||||
|
|
||||
|
// 发送消息到后台脚本以打开隐身窗口
|
||||
chrome.runtime.sendMessage({ |
chrome.runtime.sendMessage({ |
||||
action: 'openIncognitoDouyin', |
action: 'openIncognitoDouyin', |
||||
username: username, |
username: username, |
||||
password: password |
password: password |
||||
|
}, function(response) { |
||||
|
if (response && response.success) { |
||||
|
console.log('隐身窗口已打开,准备提交登录'); |
||||
|
// 向新打开的窗口发送消息,执行登录操作
|
||||
|
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { |
||||
|
chrome.tabs.sendMessage(tabs[0].id, { |
||||
|
action: 'submitLogin', |
||||
|
username: username, |
||||
|
password: password |
||||
|
}); |
||||
|
}); |
||||
|
} else { |
||||
|
console.error('打开隐身窗口失败'); |
||||
|
} |
||||
}); |
}); |
||||
}); |
}); |
||||
|
|
||||
document.getElementById('openLive').addEventListener('click', () => { |
// 打开直播间
|
||||
|
openLiveButton.addEventListener('click', () => { |
||||
const liveId = document.getElementById('liveId').value; |
const liveId = document.getElementById('liveId').value; |
||||
if (liveId) { |
if (liveId) { |
||||
const liveUrl = `https://live.douyin.com/${liveId}`; |
const liveUrl = `https://live.douyin.com/${liveId}`; |
||||
chrome.runtime.sendMessage({ action: 'openLiveIncognito', url: liveUrl }); |
chrome.runtime.sendMessage({ action: 'openLiveIncognito', url: liveUrl }); |
||||
} |
} |
||||
}); |
}); |
||||
}); |
|
||||
|
// 登录
|
||||
|
loginButton.addEventListener('click', function() { |
||||
|
const username = usernameInput.value; |
||||
|
const password = passwordInput.value; |
||||
|
|
||||
|
if (!username || !password) { |
||||
|
alert('请输入账号和密码!'); |
||||
|
return; |
||||
|
} else { |
||||
|
// 发送到后台打开
|
||||
|
chrome.runtime.sendMessage({ action: 'login', username: username, password: password }); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 监听登录结果
|
||||
|
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { |
||||
|
if (request.action === 'loginResult') { |
||||
|
if (request.status === 'success') { |
||||
|
document.getElementById('userinfo').textContent = '已登录:' + request.uname; |
||||
|
} else { |
||||
|
alert('登录失败:' + request.message); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|||||
Loading…
Reference in new issue