init
This commit is contained in:
135
auth.eimsound自动登录.user.js
Normal file
135
auth.eimsound自动登录.user.js
Normal file
@@ -0,0 +1,135 @@
|
||||
// ==UserScript==
|
||||
// @name auth.eimsound自动登录
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.0.9
|
||||
// @description no desc
|
||||
// @author ClanEver
|
||||
// @match https://auth.eimsound.com/*
|
||||
// @match https://outline.eimsound.com
|
||||
// @match https://outline.eimsound.com/*
|
||||
// @match https://chat.eimsound.com
|
||||
// @match https://chat.eimsound.com/*
|
||||
// @match https://chat2.eimsound.com
|
||||
// @match https://chat2.eimsound.com/*
|
||||
// @icon https://auth.eimsound.com/static/dist/assets/icons/icon.png
|
||||
// @updateURL https://dev.eimsound.com/-/snippets/5/raw/main/auto.auth.eimsound.user.js
|
||||
// @downloadURL https://dev.eimsound.com/-/snippets/5/raw/main/auto.auth.eimsound.user.js
|
||||
// @grant GM_registerMenuCommand
|
||||
// @grant GM_unregisterMenuCommand
|
||||
// @grant GM_getValue
|
||||
// @grant GM_setValue
|
||||
// @grant GM_log
|
||||
// ==/UserScript==
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
// Your code here...
|
||||
let items = ["Github", "Google", "QQ", "None"];
|
||||
let menus = [];
|
||||
|
||||
function fresh_menu() {
|
||||
for (let i of menus) {
|
||||
GM_unregisterMenuCommand(i);
|
||||
}
|
||||
menus = [];
|
||||
|
||||
let login_target = GM_getValue('login_target', 'None');
|
||||
for (let i of items) {
|
||||
let name = i;
|
||||
if (login_target == name) name = `✅ ` + i;
|
||||
const menu_command = GM_registerMenuCommand(name, function (event) {
|
||||
GM_setValue("login_target", i);
|
||||
fresh_menu();
|
||||
});
|
||||
menus.push(menu_command);
|
||||
}
|
||||
}
|
||||
fresh_menu();
|
||||
|
||||
const value_map = {
|
||||
"Github": "Github",
|
||||
"Google": "google",
|
||||
"QQ": "qq",
|
||||
"None": "None",
|
||||
};
|
||||
|
||||
// auth 登录
|
||||
if (location.href.includes(`auth.eimsound.com/if/flow/default-authentication-flow`)) {
|
||||
const interval_1 = setInterval(() => {
|
||||
let login_target = value_map[GM_getValue('login_target', 'None')];
|
||||
if (login_target == 'None') return
|
||||
var btn = document.querySelector('ak-flow-executor').shadowRoot.
|
||||
querySelector("ak-locale-context").
|
||||
querySelector('ak-stage-identification').shadowRoot.
|
||||
querySelector(`img[alt="${login_target}"]`).parentNode.parentNode;
|
||||
if (btn) {
|
||||
btn.click();
|
||||
clearInterval(interval_1);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// auth 继续
|
||||
if (location.href.includes(`auth.eimsound.com/if/flow`)) {
|
||||
const interval_3 = setInterval(() => {
|
||||
var btns = document.querySelectorAll('ak-flow-executor').shadowRoot.
|
||||
querySelector("ak-locale-context").
|
||||
querySelector('ak-stage-consent').shadowRoot.
|
||||
querySelectors(`button`);
|
||||
for (let btn of btns) {
|
||||
if (btn.textContent.includes('继续') || btn.textContent.includes('Continue')) {
|
||||
btn.click();
|
||||
clearInterval(interval_3);
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// outline 登录
|
||||
if (location.href.includes(`outline.eimsound.com`)) {
|
||||
const interval_2 = setInterval(() => {
|
||||
try {
|
||||
var h2 = document.querySelector('h2');
|
||||
if (h2.textContent.includes('登录到 EIM Notes') || h2.textContent.includes('Login to EIM Notes')) {
|
||||
var btns = document.querySelectorAll('button');
|
||||
for (let btn of btns) {
|
||||
if (btn.textContent.includes('OpenID')) {
|
||||
btn.click();
|
||||
clearInterval(interval_2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) { }
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// LiberChat 登录
|
||||
if (location.href.includes(`chat.eimsound.com`)) {
|
||||
const interval_4 = setInterval(() => {
|
||||
if (location.href.includes(`login`)) {
|
||||
var btns = document.querySelectorAll('a');
|
||||
for (let btn of btns) {
|
||||
if (btn.textContent.includes('Authtik')) {
|
||||
btn.click();
|
||||
clearInterval(interval_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// Open Webui 登录
|
||||
if (location.href.includes(`chat2.eimsound.com`)) {
|
||||
const interval_5 = setInterval(() => {
|
||||
if (location.href.includes(`auth`)) {
|
||||
var btns = document.querySelectorAll('button');
|
||||
for (let btn of btns) {
|
||||
if (btn.textContent.includes('Authentik')) {
|
||||
btn.click();
|
||||
clearInterval(interval_5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user