// ==UserScript==
// @name 阿里云盘签到
// @namespace https://yiso.fun
// @version 0.0.3
// @author yiso
// @match https://www.aliyundrive.com/*
// @icon https://img.alicdn.com/imgextra/i1/O1CN01JDQCi21Dc8EfbRwvF_!!6000000000236-73-tps-64-64.ico
// @description 阿里云盘每天自动签到 本脚会提交你的token到服务端 作者承诺只做阿里云盘的签到使用 介意勿装
// @run-at document-body
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// @connect yiso.fun
// @antifeature tracking 阿里云盘每天自动签到 本脚会提交你的token到服务端 作者承诺只做阿里云盘的签到使用 介意勿装
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
unsafeWindow = unsafeWindow || window;
var $ = $ || window.$;
//当前浏览器的地址
let url = window.location.href
var visitorId;
if (url.includes('https://www.aliyundrive.com/drive', 0)) {
setTimeout(function() {
getVisitorId();
aliHomeButtonHeader();
},
1000)
}
/**
*alihome页导航栏按钮
*/
function aliHomeButtonHeader() {
let header = document.querySelector('.nav-menu--1wQUw');
if (header == null) {
setTimeout(function() {
aliHomeButtonHeader();
},
1000)
}
setAliYunSign(header);
}
/**
* 阿里云签到初始化
*/
function setAliYunSign(header) {
// Initialize the agent at application startup.
let div = document.createElement('div');
div.innerHTML = '
'
+'';
header.insertBefore(div, header.children[0]);
let sign = document.querySelector('.sign');
sign.addEventListener('click',() =>{
var RegEmail = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
let emailNotify = document.getElementById("emailInput").value;
if(!RegEmail.test(emailNotify)){
alert('邮箱不合法') ;
return;
}
let tokenInfo= localStorage.getItem('token');
let visitorId= localStorage.getItem('alising_visitorId');
if(visitorId==null||visitorId==undefined||visitorId == ''){
getVisitorId();
visitorId= localStorage.getItem('alising_visitorId');
}
let tokenInfoJson=JSON.parse(tokenInfo);
let user_id=tokenInfoJson.user_id;
let lastdata='aliUserId='+tokenInfoJson.user_id+'&token='+tokenInfoJson.access_token+'&userName='+tokenInfoJson.user_name+'&nickName='+tokenInfoJson.nick_name+'&email='+emailNotify+'&refreshToken='+tokenInfoJson.refresh_token;
GM_xmlhttpRequest({
method: "post",
url: 'https://yiso.fun/api/ali/sign',
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
data:lastdata,
onload: function(r) {
let resultJson = JSON.parse(r.response);
if (resultJson.code != null) {
if (resultJson.msg != "SUCCESS") {
alert(resultJson.msg);
return;
}else{
alert('自动签到提交成功');
}
} else {
alert('系统异常,请稍微再试');
}
}
});
});
}
/**
* 获取浏览器唯一标识
*/
function getVisitorId(){
// Initialize the agent at application startup.
const fpPromise = import('https://openfpcdn.io/fingerprintjs/v3')
.then(FingerprintJS => FingerprintJS.load())
// Get the visitor identifier when you need it.
fpPromise
.then(fp => fp.get())
.then(result => {
// This is the visitor identifier:
const visitorId = result.visitorId;
localStorage.setItem('alising_visitorId',visitorId);
})
}
// Your code here...
})();