|
@@ -18,12 +18,12 @@ function twitterPinLogin() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-function getDiscordAuthCode(port) {
|
|
|
|
|
|
+function getDiscordAuthCode() {
|
|
if (window.location.href.indexOf(discordAuthRedirectUri) > -1) {
|
|
if (window.location.href.indexOf(discordAuthRedirectUri) > -1) {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const code = urlParams.get('code');
|
|
const code = urlParams.get('code');
|
|
if (code) {
|
|
if (code) {
|
|
- port.postMessage({ state: 'CONTENT_SEND_DISCORD_AUTH_CODE', code })
|
|
|
|
|
|
+ chrome.runtime.sendMessage({ actionType: "CONTENT_SEND_DISCORD_AUTH_CODE", code}, () => { })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -576,6 +576,7 @@ export function initExecuteScript(changes) {
|
|
}
|
|
}
|
|
// 初始化
|
|
// 初始化
|
|
export function init() {
|
|
export function init() {
|
|
|
|
+ getDiscordAuthCode();
|
|
if (window.location.href.indexOf('twitter.com') < 0) {
|
|
if (window.location.href.indexOf('twitter.com') < 0) {
|
|
return
|
|
return
|
|
}
|
|
}
|