mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 02:41:22 +01:00
Prepare 4.0.0.3 extension release
This commit is contained in:
1 parent
54ff493ea4
commit
d6cbaadf05
36 files changed
+846
-337
No files matched your search
@@ -99,6 +99,7 @@ function initPatreonAuth() {
|
||||
const loggedOutView = document.getElementById("patreon-logged-out");
|
||||
const loggedInView = document.getElementById("patreon-logged-in");
|
||||
const loginBtn = document.getElementById("patreon-login-btn");
|
||||
const githubLoginBtn = document.getElementById("github-login-btn");
|
||||
const logoutBtn = document.getElementById("patreon-logout-btn");
|
||||
const userAvatar = document.getElementById("patreon-user-avatar");
|
||||
const userName = document.getElementById("patreon-user-name");
|
||||
@@ -335,6 +336,33 @@ function initPatreonAuth() {
|
||||
});
|
||||
});
|
||||
|
||||
if (githubLoginBtn) {
|
||||
githubLoginBtn.addEventListener("click", () => {
|
||||
ensureIdentityPermission(async (granted) => {
|
||||
const identityNow = getIdentityApi();
|
||||
if (!granted || !identityNow || typeof identityNow.getRedirectURL !== "function") {
|
||||
alert(chrome.i18n.getMessage("patreonPermissionRequired"));
|
||||
return;
|
||||
}
|
||||
|
||||
chrome.runtime.sendMessage({ message: "github_oauth_login" }, (resp) => {
|
||||
if (chrome.runtime && chrome.runtime.lastError) {
|
||||
console.error("GitHub login failed:", chrome.runtime.lastError.message);
|
||||
alert(chrome.i18n.getMessage("githubLoginStartFailed"));
|
||||
return;
|
||||
}
|
||||
if (resp && resp.success) {
|
||||
const user = resp.user;
|
||||
showLoggedInView(user);
|
||||
} else {
|
||||
console.error("GitHub login failed:", resp && resp.error);
|
||||
alert(chrome.i18n.getMessage("githubLoginCompleteFailed"));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
logoutBtn.addEventListener("click", () => {
|
||||
chrome.storage.sync.remove(["patreonUser", "patreonSessionToken"], () => {
|
||||
showLoggedOutView();
|
||||
|
||||
Reference in new issue
Block a user