Skip to content

Commit 0072fca

Browse files
committed
.
1 parent 92de214 commit 0072fca

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed

scripts/backup/fb-proxy.js

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
function uuidv4() {
2+
let h = new Date().getTime();
3+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (i) {
4+
let F = (h + 16 * Math.random()) % 16 | 0;
5+
h = Math.floor(h / 16);
6+
return (i == "x" ? F : (3 & F) | 8).toString(16);
7+
});
8+
}
9+
110
(function () {
211
"use strict";
312
(function () {
@@ -17,25 +26,11 @@
1726
return code.slice(code.indexOf("{") + 1, code.lastIndexOf("}")) || "";
1827
})(code),
1928
fnParams = (function (code) {
20-
let i = code.replace(b, ""),
29+
let i = code.replace(commentRegex, ""),
2130
F = i.slice(i.indexOf("(") + 1, i.indexOf(")")).match(s);
2231
return F === null && (F = []), F;
2332
})(code),
24-
uuid =
25-
"id_" +
26-
(function () {
27-
let h = new Date().getTime();
28-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
29-
/[xy]/g,
30-
function (i) {
31-
var F = (h + 16 * Math.random()) % 16 | 0;
32-
return (
33-
(h = Math.floor(h / 16)),
34-
(i == "x" ? F : (3 & F) | 8).toString(16)
35-
);
36-
}
37-
);
38-
})();
33+
uuid = "id_" + uuidv4();
3934
let y = `window['__fnCache']["${uuid}"]= function(${fnParams}){${fnBody}}`,
4035
c = document.createElement("script");
4136
try {
@@ -48,7 +43,7 @@
4843
return v.appendChild(c), v.removeChild(c), window.__fnCache[`${uuid}`];
4944
}
5045
window.__fnCache = window.__fnCache || {};
51-
let b = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,
46+
let commentRegex = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,
5247
s = /([^\s,]+)/g;
5348
function m(r, f, u = !1) {
5449
const w = f.split(/\.|\[(\d+)\]/).filter(Boolean);
@@ -66,19 +61,19 @@
6661
w = {},
6762
y = {},
6863
c = {};
69-
let v = window.__d;
64+
let modified__d = window.__d;
7065
window.__d &&
71-
(~v.toString().indexOf("__d_stub")
66+
(~modified__d.toString().indexOf("__d_stub")
7267
? delete window.__d
73-
: (v = new Proxy(window.__d, {
68+
: (modified__d = new Proxy(window.__d, {
7469
apply: (e, t, d) => ((d = i(d)), e.apply(t, d)),
7570
}))),
7671
Object.defineProperty(window, "__d", {
7772
get: function () {
78-
return v;
73+
return modified__d;
7974
},
8075
set: function (e) {
81-
v = new Proxy(e, {
76+
modified__d = new Proxy(e, {
8277
apply: (t, d, p) => ((p = i(p)), t.apply(d, p)),
8378
});
8479
},

0 commit comments

Comments
 (0)