first commit
This commit is contained in:
commit
db5762abd4
687 files changed
+171307
No files matched your search
@@ -0,0 +1,35 @@
|
||||
var e = `console.wechat-binding`;
|
||||
function t(t, n, r = Date.now()) {
|
||||
if (!t.ticket || !t.token) throw Error(`扫码会话无效,请重新扫码`);
|
||||
let i = Math.min(r + 3e5, t.expire_time ? t.expire_time * 1e3 : r + 3e5);
|
||||
if (i <= r) throw Error(`二维码已过期,请重新扫码`);
|
||||
n.setItem(
|
||||
e,
|
||||
JSON.stringify({
|
||||
ticket: t.ticket,
|
||||
token: t.token,
|
||||
expires: i,
|
||||
}),
|
||||
);
|
||||
}
|
||||
function n(t, n = Date.now()) {
|
||||
try {
|
||||
let r = JSON.parse(t.getItem(e) || `null`);
|
||||
if (
|
||||
r &&
|
||||
typeof r.ticket == `string` &&
|
||||
r.ticket &&
|
||||
typeof r.token == `string` &&
|
||||
r.token &&
|
||||
typeof r.expires == `number` &&
|
||||
r.expires > n &&
|
||||
r.expires <= n + 3e5
|
||||
)
|
||||
return r;
|
||||
} catch {}
|
||||
return (t.removeItem(e), null);
|
||||
}
|
||||
function r(t) {
|
||||
t.removeItem(e);
|
||||
}
|
||||
export { n, t as r, r as t };
|
||||
Reference in new issue
Block a user