userscript...

This commit is contained in:
Gabe Yuan
2023-08-05 15:32:51 +08:00
parent bec207a09f
commit 1e82c280ad
11 changed files with 323 additions and 202 deletions

View File

@@ -2,7 +2,14 @@ import storage from "./storage";
import { STOKEY_MSAUTH, URL_MICROSOFT_AUTH } from "../config";
import { fetchPolyfill } from "./fetch";
const parseMSToken = (token) => JSON.parse(atob(token.split(".")[1])).exp;
const parseMSToken = (token) => {
try {
return JSON.parse(atob(token.split(".")[1])).exp;
} catch (err) {
console.log("[parseMSToken]", err);
}
return 0;
};
/**
* 闭包缓存token减少对storage查询