@overlayed/app 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -61
- package/dist/index.js +938 -648
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { type as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { createHash as
|
|
11
|
-
import
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
return { all:
|
|
15
|
-
var r =
|
|
16
|
-
r ? r.push(t) :
|
|
1
|
+
var tt = Object.defineProperty;
|
|
2
|
+
var rt = (s, e, t) => e in s ? tt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var l = (s, e, t) => rt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { type as L } from "arktype";
|
|
5
|
+
import P, { mkdirSync as ce, existsSync as he, writeFileSync as ue, createWriteStream as Oe, readdirSync as Me, unlinkSync as $e, readFileSync as Ae, copyFileSync as st } from "node:fs";
|
|
6
|
+
import f, { join as D, resolve as nt } from "node:path";
|
|
7
|
+
import { createRequire as ee } from "node:module";
|
|
8
|
+
import w from "node:fs/promises";
|
|
9
|
+
import Re from "jszip";
|
|
10
|
+
import { createHash as it } from "node:crypto";
|
|
11
|
+
import at, { app as xe } from "electron";
|
|
12
|
+
var ot = Object.defineProperty, lt = (s, e, t) => e in s ? ot(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, b = (s, e, t) => lt(s, typeof e != "symbol" ? e + "" : e, t);
|
|
13
|
+
function ct(s) {
|
|
14
|
+
return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
|
|
15
|
+
var r = s.get(e);
|
|
16
|
+
r ? r.push(t) : s.set(e, [t]);
|
|
17
17
|
}, off: function(e, t) {
|
|
18
|
-
var r =
|
|
19
|
-
r && (t ? r.splice(r.indexOf(t) >>> 0, 1) :
|
|
18
|
+
var r = s.get(e);
|
|
19
|
+
r && (t ? r.splice(r.indexOf(t) >>> 0, 1) : s.set(e, []));
|
|
20
20
|
}, emit: function(e, t) {
|
|
21
|
-
var r =
|
|
22
|
-
r && r.slice().map(function(
|
|
23
|
-
|
|
24
|
-
}), (r =
|
|
25
|
-
|
|
21
|
+
var r = s.get(e);
|
|
22
|
+
r && r.slice().map(function(n) {
|
|
23
|
+
n(t);
|
|
24
|
+
}), (r = s.get("*")) && r.slice().map(function(n) {
|
|
25
|
+
n(e, t);
|
|
26
26
|
});
|
|
27
27
|
} };
|
|
28
28
|
}
|
|
29
|
-
let
|
|
29
|
+
let de = class {
|
|
30
30
|
constructor() {
|
|
31
|
-
|
|
31
|
+
b(this, "emitter"), this.emitter = ct();
|
|
32
32
|
}
|
|
33
33
|
on(e, t) {
|
|
34
34
|
this.emitter.on(e, t);
|
|
@@ -44,14 +44,14 @@ let Ce = class {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
function
|
|
47
|
+
function ge(s, ...e) {
|
|
48
48
|
var t;
|
|
49
|
-
return t = class extends
|
|
49
|
+
return t = class extends s {
|
|
50
50
|
/**
|
|
51
51
|
* Lazy get the static instance
|
|
52
52
|
*/
|
|
53
53
|
static getInstance() {
|
|
54
|
-
return this._instance || (this._instance = new
|
|
54
|
+
return this._instance || (this._instance = new s(...e)), this._instance;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Release the instance (most of the time you won't need this)
|
|
@@ -59,9 +59,9 @@ function Ke(n, ...e) {
|
|
|
59
59
|
static clearInstance() {
|
|
60
60
|
this._instance = void 0;
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, b(t, "_instance"), t;
|
|
63
63
|
}
|
|
64
|
-
class
|
|
64
|
+
let ht = class extends de {
|
|
65
65
|
destroy() {
|
|
66
66
|
this.removeAllListeners();
|
|
67
67
|
}
|
|
@@ -89,21 +89,200 @@ class rt extends Ce {
|
|
|
89
89
|
timestamp: Date.now()
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
92
|
+
};
|
|
93
|
+
ge(ht);
|
|
94
|
+
let ut = class Te extends de {
|
|
95
|
+
constructor(e, t, r = "") {
|
|
96
|
+
super(), b(this, "stream"), b(this, "logPath"), b(this, "baseFileName"), b(this, "currentDate"), b(this, "rotationCheckInterval"), b(this, "isRotating", !1), this.logPath = e, this.baseFileName = t.replace(".log", ""), this.currentDate = this.getDateString(/* @__PURE__ */ new Date()), this.ensureLogDirectory(), this.ensureLogFile(), this.stream = this.createStream(), this.rotationCheckInterval = this.startRotationCheck(), this.cleanupOldLogs();
|
|
97
|
+
}
|
|
98
|
+
static scope(e, t, r) {
|
|
99
|
+
return new Te(e, t, r);
|
|
100
|
+
}
|
|
101
|
+
log(...e) {
|
|
102
|
+
this.write("log", ...e);
|
|
103
|
+
}
|
|
104
|
+
error(...e) {
|
|
105
|
+
this.write("error", ...e);
|
|
106
|
+
}
|
|
107
|
+
warn(...e) {
|
|
108
|
+
this.write("warn", ...e);
|
|
109
|
+
}
|
|
110
|
+
info(...e) {
|
|
111
|
+
this.write("info", ...e);
|
|
112
|
+
}
|
|
113
|
+
debug(...e) {
|
|
114
|
+
this.write("debug", ...e);
|
|
115
|
+
}
|
|
116
|
+
async close() {
|
|
117
|
+
clearInterval(this.rotationCheckInterval), await new Promise((e) => {
|
|
118
|
+
this.stream.end(() => e());
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
getCurrentFileName() {
|
|
122
|
+
return this.getFileName(this.currentDate);
|
|
123
|
+
}
|
|
124
|
+
getFileName(e) {
|
|
125
|
+
return `${this.baseFileName}-${e}.log`;
|
|
126
|
+
}
|
|
127
|
+
ensureLogDirectory() {
|
|
128
|
+
try {
|
|
129
|
+
ce(this.logPath, { recursive: !0 });
|
|
130
|
+
} catch (e) {
|
|
131
|
+
throw console.error(`Failed to create log directory ${this.logPath}:`, e), e;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
ensureLogFile() {
|
|
135
|
+
const e = D(this.logPath, this.getFileName(this.currentDate));
|
|
136
|
+
if (!he(e))
|
|
137
|
+
try {
|
|
138
|
+
ue(e, "", "utf8");
|
|
139
|
+
} catch (t) {
|
|
140
|
+
throw console.error(`Failed to create log file ${e}:`, t), t;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
getDateString(e) {
|
|
144
|
+
return e.toISOString().split("T")[0];
|
|
145
|
+
}
|
|
146
|
+
createStream() {
|
|
147
|
+
const e = D(this.logPath, this.getFileName(this.currentDate));
|
|
148
|
+
return Oe(e, {
|
|
149
|
+
flags: "a",
|
|
150
|
+
encoding: "utf8"
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async rotateLogs() {
|
|
154
|
+
if (this.isRotating) return;
|
|
155
|
+
this.isRotating = !0;
|
|
156
|
+
const e = this.getDateString(/* @__PURE__ */ new Date());
|
|
157
|
+
e !== this.currentDate && await new Promise((t) => {
|
|
158
|
+
this.stream.end(() => {
|
|
159
|
+
this.currentDate = e, this.stream = this.createStream(), this.cleanupOldLogs(), t();
|
|
160
|
+
});
|
|
161
|
+
}), this.isRotating = !1;
|
|
162
|
+
}
|
|
163
|
+
startRotationCheck() {
|
|
164
|
+
return setInterval(() => this.rotateLogs(), 6e4);
|
|
165
|
+
}
|
|
166
|
+
cleanupOldLogs() {
|
|
167
|
+
const e = Me(this.logPath), t = /* @__PURE__ */ new Date();
|
|
168
|
+
t.setDate(t.getDate() - 3), e.filter((r) => r.startsWith(this.baseFileName) && r.endsWith(".log")).filter((r) => {
|
|
169
|
+
const n = r.replace(`${this.baseFileName}-`, "").replace(".log", "");
|
|
170
|
+
return new Date(n) < t;
|
|
171
|
+
}).forEach((r) => {
|
|
172
|
+
try {
|
|
173
|
+
$e(D(this.logPath, r));
|
|
174
|
+
} catch (n) {
|
|
175
|
+
console.error(`Failed to delete old log file ${r}:`, n);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
write(e, ...t) {
|
|
180
|
+
const r = /* @__PURE__ */ new Date(), n = r.toISOString().replace("T", " ").replace(/\.\d+Z$/, "") + `.${r.getMilliseconds().toString().padStart(3, "0")}`, i = t.map((o) => typeof o == "object" ? JSON.stringify(o, void 0, 2) : String(o)).join(" "), a = `[${n}] [${e}] ${i}
|
|
181
|
+
`;
|
|
182
|
+
this.stream.write(a, (o) => {
|
|
183
|
+
o ? this.emit("error", o) : this.emit("write", a);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const dt = () => f.join(process.env.APPDATA ?? "", "overlayed"), gt = (s) => f.join(dt(), "apps", s), ft = (s) => f.join(gt(s), "logs");
|
|
188
|
+
let pt = class {
|
|
189
|
+
constructor() {
|
|
190
|
+
b(this, "data", []);
|
|
191
|
+
}
|
|
192
|
+
get size() {
|
|
193
|
+
return this.data.length;
|
|
194
|
+
}
|
|
195
|
+
add(e) {
|
|
196
|
+
this.data.push(e);
|
|
197
|
+
}
|
|
198
|
+
next() {
|
|
199
|
+
return this.data.shift();
|
|
200
|
+
}
|
|
201
|
+
clear() {
|
|
202
|
+
this.data.length = 0;
|
|
203
|
+
}
|
|
204
|
+
*flush() {
|
|
205
|
+
for (; this.size > 0; ) {
|
|
206
|
+
const e = this.next();
|
|
207
|
+
e && (yield e);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, yt = class {
|
|
211
|
+
constructor() {
|
|
212
|
+
b(this, "fileName", "app.log"), b(this, "fileLogger"), b(this, "path"), b(this, "appId"), b(this, "messageQueue", new pt());
|
|
213
|
+
}
|
|
214
|
+
init(e) {
|
|
215
|
+
this.appId = e, this.path = ft(e), this.fileLogger = new ut(this.path, this.fileName), this.messageQueue.flush().forEach((t) => {
|
|
216
|
+
var r;
|
|
217
|
+
(r = this.fileLogger) == null || r[t.type](...t.args);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
scope(e) {
|
|
221
|
+
if (!this.appId || !this.path)
|
|
222
|
+
throw new Error("Logger not initialized");
|
|
223
|
+
const t = `[${e}]`;
|
|
224
|
+
return {
|
|
225
|
+
scope: (r) => this.scope(r),
|
|
226
|
+
error: (...r) => this.error(t, ...r),
|
|
227
|
+
warn: (...r) => this.warn(t, ...r),
|
|
228
|
+
info: (...r) => this.info(t, ...r),
|
|
229
|
+
log: (...r) => this.log(t, ...r),
|
|
230
|
+
debug: (...r) => this.debug(t, ...r),
|
|
231
|
+
captureSentryException: (...r) => this.captureSentryException(t, ...r),
|
|
232
|
+
sentryError: (...r) => this.sentryError(t, ...r),
|
|
233
|
+
sentryLog: (...r) => this.sentryLog(t, ...r),
|
|
234
|
+
sentryWarn: (...r) => this.sentryWarn(t, ...r)
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
error(...e) {
|
|
238
|
+
this.handle("error", ...e);
|
|
239
|
+
}
|
|
240
|
+
warn(...e) {
|
|
241
|
+
this.handle("warn", ...e);
|
|
242
|
+
}
|
|
243
|
+
info(...e) {
|
|
244
|
+
this.handle("log", ...e);
|
|
245
|
+
}
|
|
246
|
+
debug(...e) {
|
|
247
|
+
this.handle("debug", ...e);
|
|
248
|
+
}
|
|
249
|
+
log(...e) {
|
|
250
|
+
this.handle("log", ...e);
|
|
251
|
+
}
|
|
252
|
+
captureSentryException(...e) {
|
|
253
|
+
this.handle("error", ...e);
|
|
254
|
+
}
|
|
255
|
+
sentryError(...e) {
|
|
256
|
+
this.handle("error", ...e);
|
|
257
|
+
}
|
|
258
|
+
sentryLog(...e) {
|
|
259
|
+
this.handle("log", ...e);
|
|
260
|
+
}
|
|
261
|
+
sentryWarn(...e) {
|
|
262
|
+
this.handle("warn", ...e);
|
|
263
|
+
}
|
|
264
|
+
sentryInfo(...e) {
|
|
265
|
+
this.handle("log", ...e);
|
|
266
|
+
}
|
|
267
|
+
handle(e, ...t) {
|
|
268
|
+
var r;
|
|
269
|
+
console[e](...t), ((r = this.fileLogger) == null ? void 0 : r[e](...t)) ?? this.messageQueue.add({ type: e, args: t });
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
ge(yt);
|
|
273
|
+
const mt = ee(import.meta.url), {
|
|
274
|
+
PipeEventServer: bt,
|
|
275
|
+
PipeEventClient: Yr,
|
|
276
|
+
PipeEventBase: Zr,
|
|
277
|
+
ProcessMonitor: es,
|
|
278
|
+
Process: ts,
|
|
279
|
+
InjectionMethod: rs,
|
|
280
|
+
AccessLevel: ss,
|
|
281
|
+
HardwareInterface: ns
|
|
282
|
+
} = mt("@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node");
|
|
283
|
+
let vt = class extends de {
|
|
105
284
|
constructor(e) {
|
|
106
|
-
super(),
|
|
285
|
+
super(), b(this, "server", null), b(this, "_hasConnection", !1), b(this, "pipeId"), this.pipeId = e, this.init();
|
|
107
286
|
}
|
|
108
287
|
get hasConnection() {
|
|
109
288
|
return this._hasConnection;
|
|
@@ -115,7 +294,7 @@ let at = class extends Ce {
|
|
|
115
294
|
// TODO make sure that new events and new event keys do not stop the app from working
|
|
116
295
|
// this is because we may have new events/event keys from a DLL but the types/validations might not be up to date
|
|
117
296
|
init() {
|
|
118
|
-
this.server = new
|
|
297
|
+
this.server = new bt(this.pipeId, { clientCount: 1, access: 1 }), this.server.on("event", (e) => {
|
|
119
298
|
try {
|
|
120
299
|
const t = JSON.parse(e);
|
|
121
300
|
this.emit("data", [t]);
|
|
@@ -129,27 +308,27 @@ let at = class extends Ce {
|
|
|
129
308
|
});
|
|
130
309
|
}
|
|
131
310
|
};
|
|
132
|
-
const
|
|
133
|
-
function
|
|
134
|
-
return { all:
|
|
135
|
-
var r =
|
|
136
|
-
r ? r.push(t) :
|
|
311
|
+
const fe = ge(vt, "stats-cc");
|
|
312
|
+
function wt(s) {
|
|
313
|
+
return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {
|
|
314
|
+
var r = s.get(e);
|
|
315
|
+
r ? r.push(t) : s.set(e, [t]);
|
|
137
316
|
}, off: function(e, t) {
|
|
138
|
-
var r =
|
|
139
|
-
r && (t ? r.splice(r.indexOf(t) >>> 0, 1) :
|
|
317
|
+
var r = s.get(e);
|
|
318
|
+
r && (t ? r.splice(r.indexOf(t) >>> 0, 1) : s.set(e, []));
|
|
140
319
|
}, emit: function(e, t) {
|
|
141
|
-
var r =
|
|
142
|
-
r && r.slice().map(function(
|
|
143
|
-
|
|
144
|
-
}), (r =
|
|
145
|
-
|
|
320
|
+
var r = s.get(e);
|
|
321
|
+
r && r.slice().map(function(n) {
|
|
322
|
+
n(t);
|
|
323
|
+
}), (r = s.get("*")) && r.slice().map(function(n) {
|
|
324
|
+
n(e, t);
|
|
146
325
|
});
|
|
147
326
|
} };
|
|
148
327
|
}
|
|
149
|
-
class
|
|
328
|
+
class pe {
|
|
150
329
|
constructor() {
|
|
151
|
-
|
|
152
|
-
this.emitter =
|
|
330
|
+
l(this, "emitter");
|
|
331
|
+
this.emitter = wt();
|
|
153
332
|
}
|
|
154
333
|
on(e, t) {
|
|
155
334
|
this.emitter.on(e, t);
|
|
@@ -165,14 +344,14 @@ class Se {
|
|
|
165
344
|
});
|
|
166
345
|
}
|
|
167
346
|
}
|
|
168
|
-
function
|
|
347
|
+
function E(s, ...e) {
|
|
169
348
|
var r;
|
|
170
|
-
return r = class extends
|
|
349
|
+
return r = class extends s {
|
|
171
350
|
/**
|
|
172
351
|
* Lazy get the static instance
|
|
173
352
|
*/
|
|
174
353
|
static getInstance() {
|
|
175
|
-
return this._instance || (this._instance = new
|
|
354
|
+
return this._instance || (this._instance = new s(...e)), this._instance;
|
|
176
355
|
}
|
|
177
356
|
/**
|
|
178
357
|
* Release the instance (most of the time you won't need this)
|
|
@@ -180,9 +359,9 @@ function _(n, ...e) {
|
|
|
180
359
|
static clearInstance() {
|
|
181
360
|
this._instance = void 0;
|
|
182
361
|
}
|
|
183
|
-
},
|
|
362
|
+
}, l(r, "_instance"), r;
|
|
184
363
|
}
|
|
185
|
-
class
|
|
364
|
+
class It extends pe {
|
|
186
365
|
destroy() {
|
|
187
366
|
this.removeAllListeners();
|
|
188
367
|
}
|
|
@@ -211,15 +390,15 @@ class lt extends Se {
|
|
|
211
390
|
});
|
|
212
391
|
}
|
|
213
392
|
}
|
|
214
|
-
const I =
|
|
215
|
-
class
|
|
393
|
+
const I = E(It);
|
|
394
|
+
class Et {
|
|
216
395
|
constructor(e) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const { schema: t, default: r, path:
|
|
222
|
-
this._schema = t, this._defaultValue = r, this._path =
|
|
396
|
+
l(this, "data");
|
|
397
|
+
l(this, "_schema");
|
|
398
|
+
l(this, "_defaultValue");
|
|
399
|
+
l(this, "_path");
|
|
400
|
+
const { schema: t, default: r, path: n } = e;
|
|
401
|
+
this._schema = t, this._defaultValue = r, this._path = n;
|
|
223
402
|
}
|
|
224
403
|
set(e) {
|
|
225
404
|
const t = this._schema["~standard"].validate(e);
|
|
@@ -240,7 +419,7 @@ class ct {
|
|
|
240
419
|
save(e) {
|
|
241
420
|
const t = this.onBeforeSave(e);
|
|
242
421
|
try {
|
|
243
|
-
|
|
422
|
+
P.writeFileSync(this.getFilePath(), JSON.stringify(t, void 0, 2));
|
|
244
423
|
} catch {
|
|
245
424
|
return;
|
|
246
425
|
}
|
|
@@ -253,7 +432,7 @@ class ct {
|
|
|
253
432
|
return this.data = e, e;
|
|
254
433
|
}
|
|
255
434
|
try {
|
|
256
|
-
const e =
|
|
435
|
+
const e = P.readFileSync(this.getFilePath(), "utf8"), t = this.onAfterLoad(this.parseStoredData(e));
|
|
257
436
|
return this.data = t, t;
|
|
258
437
|
} catch {
|
|
259
438
|
return this.data = this._defaultValue;
|
|
@@ -270,35 +449,35 @@ class ct {
|
|
|
270
449
|
}
|
|
271
450
|
parseStoredData(e) {
|
|
272
451
|
try {
|
|
273
|
-
const r =
|
|
274
|
-
if (r instanceof
|
|
452
|
+
const r = L("string.json.parse").to("object")(e);
|
|
453
|
+
if (r instanceof L.errors)
|
|
275
454
|
return this._defaultValue;
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
455
|
+
const n = this._schema["~standard"].validate(r);
|
|
456
|
+
if (n instanceof Promise)
|
|
278
457
|
throw new Error("StructuredConfigFile does not support async validation");
|
|
279
|
-
return
|
|
458
|
+
return n.issues ? this.migrate(r, this._defaultValue) : this.migrate(n.value, this._defaultValue);
|
|
280
459
|
} catch {
|
|
281
460
|
return this._defaultValue;
|
|
282
461
|
}
|
|
283
462
|
}
|
|
284
463
|
canReadWriteFile(e) {
|
|
285
464
|
try {
|
|
286
|
-
return
|
|
465
|
+
return P.accessSync(e, P.constants.R_OK | P.constants.W_OK), !0;
|
|
287
466
|
} catch {
|
|
288
467
|
return !1;
|
|
289
468
|
}
|
|
290
469
|
}
|
|
291
470
|
fileExists(e) {
|
|
292
471
|
try {
|
|
293
|
-
return
|
|
472
|
+
return P.accessSync(e, P.constants.F_OK), !0;
|
|
294
473
|
} catch {
|
|
295
474
|
return !1;
|
|
296
475
|
}
|
|
297
476
|
}
|
|
298
477
|
migrate(e, t) {
|
|
299
478
|
const r = { ...e };
|
|
300
|
-
for (const
|
|
301
|
-
Object.prototype.hasOwnProperty.call(t,
|
|
479
|
+
for (const n in t)
|
|
480
|
+
Object.prototype.hasOwnProperty.call(t, n) && (n in e ? e[n] !== null && t[n] !== null && typeof e[n] == "object" && typeof t[n] == "object" && !Array.isArray(e[n]) && !Array.isArray(t[n]) ? r[n] = this.migrate(e[n], t[n]) : Array.isArray(t[n]) && (r[n] = e[n]) : r[n] = t[n]);
|
|
302
481
|
return r;
|
|
303
482
|
}
|
|
304
483
|
reportInvalidConfigFile(e) {
|
|
@@ -309,77 +488,210 @@ class ct {
|
|
|
309
488
|
});
|
|
310
489
|
}
|
|
311
490
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
491
|
+
class ye extends pe {
|
|
492
|
+
constructor(t, r, n = "") {
|
|
493
|
+
super();
|
|
494
|
+
l(this, "stream");
|
|
495
|
+
l(this, "logPath");
|
|
496
|
+
l(this, "baseFileName");
|
|
497
|
+
l(this, "currentDate");
|
|
498
|
+
l(this, "rotationCheckInterval");
|
|
499
|
+
l(this, "isRotating", !1);
|
|
500
|
+
this.logPath = t, this.baseFileName = r.replace(".log", ""), this.currentDate = this.getDateString(/* @__PURE__ */ new Date()), this.ensureLogDirectory(), this.ensureLogFile(), this.stream = this.createStream(), this.rotationCheckInterval = this.startRotationCheck(), this.cleanupOldLogs();
|
|
501
|
+
}
|
|
502
|
+
static scope(t, r, n) {
|
|
503
|
+
return new ye(t, r, n);
|
|
504
|
+
}
|
|
505
|
+
log(...t) {
|
|
506
|
+
this.write("log", ...t);
|
|
507
|
+
}
|
|
508
|
+
error(...t) {
|
|
509
|
+
this.write("error", ...t);
|
|
510
|
+
}
|
|
511
|
+
warn(...t) {
|
|
512
|
+
this.write("warn", ...t);
|
|
513
|
+
}
|
|
514
|
+
info(...t) {
|
|
515
|
+
this.write("info", ...t);
|
|
516
|
+
}
|
|
517
|
+
debug(...t) {
|
|
518
|
+
this.write("debug", ...t);
|
|
519
|
+
}
|
|
520
|
+
async close() {
|
|
521
|
+
clearInterval(this.rotationCheckInterval), await new Promise((t) => {
|
|
522
|
+
this.stream.end(() => t());
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
getCurrentFileName() {
|
|
526
|
+
return this.getFileName(this.currentDate);
|
|
527
|
+
}
|
|
528
|
+
getFileName(t) {
|
|
529
|
+
return `${this.baseFileName}-${t}.log`;
|
|
530
|
+
}
|
|
531
|
+
ensureLogDirectory() {
|
|
532
|
+
try {
|
|
533
|
+
ce(this.logPath, { recursive: !0 });
|
|
534
|
+
} catch (t) {
|
|
535
|
+
throw console.error(`Failed to create log directory ${this.logPath}:`, t), t;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
ensureLogFile() {
|
|
539
|
+
const t = D(this.logPath, this.getFileName(this.currentDate));
|
|
540
|
+
if (!he(t))
|
|
541
|
+
try {
|
|
542
|
+
ue(t, "", "utf8");
|
|
543
|
+
} catch (r) {
|
|
544
|
+
throw console.error(`Failed to create log file ${t}:`, r), r;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
getDateString(t) {
|
|
548
|
+
return t.toISOString().split("T")[0];
|
|
549
|
+
}
|
|
550
|
+
createStream() {
|
|
551
|
+
const t = D(this.logPath, this.getFileName(this.currentDate));
|
|
552
|
+
return Oe(t, {
|
|
553
|
+
flags: "a",
|
|
554
|
+
encoding: "utf8"
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
async rotateLogs() {
|
|
558
|
+
if (this.isRotating) return;
|
|
559
|
+
this.isRotating = !0;
|
|
560
|
+
const t = this.getDateString(/* @__PURE__ */ new Date());
|
|
561
|
+
t !== this.currentDate && await new Promise((r) => {
|
|
562
|
+
this.stream.end(() => {
|
|
563
|
+
this.currentDate = t, this.stream = this.createStream(), this.cleanupOldLogs(), r();
|
|
564
|
+
});
|
|
565
|
+
}), this.isRotating = !1;
|
|
566
|
+
}
|
|
567
|
+
startRotationCheck() {
|
|
568
|
+
return setInterval(() => this.rotateLogs(), 6e4);
|
|
569
|
+
}
|
|
570
|
+
cleanupOldLogs() {
|
|
571
|
+
const t = Me(this.logPath), r = /* @__PURE__ */ new Date();
|
|
572
|
+
r.setDate(r.getDate() - 3), t.filter((n) => n.startsWith(this.baseFileName) && n.endsWith(".log")).filter((n) => {
|
|
573
|
+
const i = n.replace(`${this.baseFileName}-`, "").replace(".log", "");
|
|
574
|
+
return new Date(i) < r;
|
|
575
|
+
}).forEach((n) => {
|
|
576
|
+
try {
|
|
577
|
+
$e(D(this.logPath, n));
|
|
578
|
+
} catch (i) {
|
|
579
|
+
console.error(`Failed to delete old log file ${n}:`, i);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
write(t, ...r) {
|
|
584
|
+
const n = /* @__PURE__ */ new Date(), i = n.toISOString().replace("T", " ").replace(/\.\d+Z$/, "") + `.${n.getMilliseconds().toString().padStart(3, "0")}`, a = r.map((c) => typeof c == "object" ? JSON.stringify(c, void 0, 2) : String(c)).join(" "), o = `[${i}] [${t}] ${a}
|
|
585
|
+
`;
|
|
586
|
+
this.stream.write(o, (c) => {
|
|
587
|
+
c ? this.emit("error", c) : this.emit("write", o);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
const te = () => f.join(process.env.APPDATA ?? "", "overlayed"), _t = (s) => f.join(te(), "apps", s), kt = (s) => f.join(_t(s), "logs");
|
|
592
|
+
class Be {
|
|
593
|
+
constructor() {
|
|
594
|
+
l(this, "data", []);
|
|
595
|
+
}
|
|
596
|
+
get size() {
|
|
597
|
+
return this.data.length;
|
|
598
|
+
}
|
|
599
|
+
add(e) {
|
|
600
|
+
this.data.push(e);
|
|
601
|
+
}
|
|
602
|
+
next() {
|
|
603
|
+
return this.data.shift();
|
|
604
|
+
}
|
|
605
|
+
clear() {
|
|
606
|
+
this.data.length = 0;
|
|
607
|
+
}
|
|
608
|
+
*flush() {
|
|
609
|
+
for (; this.size > 0; ) {
|
|
610
|
+
const e = this.next();
|
|
611
|
+
e && (yield e);
|
|
340
612
|
}
|
|
341
|
-
}
|
|
342
|
-
error: (...n) => {
|
|
343
|
-
console.error(name, ...n);
|
|
344
|
-
},
|
|
345
|
-
warn: (...n) => {
|
|
346
|
-
console.warn(name, ...n);
|
|
347
|
-
},
|
|
348
|
-
info: (...n) => {
|
|
349
|
-
console.info(name, ...n);
|
|
350
|
-
},
|
|
351
|
-
debug: (...n) => {
|
|
352
|
-
console.debug(name, ...n);
|
|
353
|
-
},
|
|
354
|
-
captureSentryException: (...n) => {
|
|
355
|
-
console.error(name, ...n);
|
|
356
|
-
},
|
|
357
|
-
sentryError: (...n) => {
|
|
358
|
-
console.error(name, ...n);
|
|
359
|
-
},
|
|
360
|
-
sentryLog: (...n) => {
|
|
361
|
-
console.log(name, ...n);
|
|
362
|
-
},
|
|
363
|
-
sentryWarn: (...n) => {
|
|
364
|
-
console.warn(name, ...n);
|
|
365
|
-
},
|
|
366
|
-
sentryInfo: (...n) => {
|
|
367
|
-
console.info(name, ...n);
|
|
368
|
-
}
|
|
369
|
-
}, le = () => m.join(process.env.APPDATA ?? "", "overlayed");
|
|
370
|
-
function ut(n = []) {
|
|
371
|
-
return m.normalize(m.join(le(), global.OVERLAYED.APP_NAME, ...n));
|
|
613
|
+
}
|
|
372
614
|
}
|
|
373
|
-
|
|
615
|
+
class Pt {
|
|
616
|
+
constructor() {
|
|
617
|
+
l(this, "fileName", "app.log");
|
|
618
|
+
l(this, "fileLogger");
|
|
619
|
+
l(this, "path");
|
|
620
|
+
l(this, "appId");
|
|
621
|
+
l(this, "messageQueue", new Be());
|
|
622
|
+
}
|
|
623
|
+
init(e) {
|
|
624
|
+
this.appId = e, this.path = kt(e), this.fileLogger = new ye(this.path, this.fileName), this.messageQueue.flush().forEach((t) => {
|
|
625
|
+
var r;
|
|
626
|
+
(r = this.fileLogger) == null || r[t.type](...t.args);
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
scope(e) {
|
|
630
|
+
if (!this.appId || !this.path)
|
|
631
|
+
throw new Error("Logger not initialized");
|
|
632
|
+
const t = `[${e}]`;
|
|
633
|
+
return {
|
|
634
|
+
scope: (r) => this.scope(r),
|
|
635
|
+
error: (...r) => this.error(t, ...r),
|
|
636
|
+
warn: (...r) => this.warn(t, ...r),
|
|
637
|
+
info: (...r) => this.info(t, ...r),
|
|
638
|
+
log: (...r) => this.log(t, ...r),
|
|
639
|
+
debug: (...r) => this.debug(t, ...r),
|
|
640
|
+
captureSentryException: (...r) => this.captureSentryException(t, ...r),
|
|
641
|
+
sentryError: (...r) => this.sentryError(t, ...r),
|
|
642
|
+
sentryLog: (...r) => this.sentryLog(t, ...r),
|
|
643
|
+
sentryWarn: (...r) => this.sentryWarn(t, ...r)
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
error(...e) {
|
|
647
|
+
this.handle("error", ...e);
|
|
648
|
+
}
|
|
649
|
+
warn(...e) {
|
|
650
|
+
this.handle("warn", ...e);
|
|
651
|
+
}
|
|
652
|
+
info(...e) {
|
|
653
|
+
this.handle("log", ...e);
|
|
654
|
+
}
|
|
655
|
+
debug(...e) {
|
|
656
|
+
this.handle("debug", ...e);
|
|
657
|
+
}
|
|
658
|
+
log(...e) {
|
|
659
|
+
this.handle("log", ...e);
|
|
660
|
+
}
|
|
661
|
+
captureSentryException(...e) {
|
|
662
|
+
this.handle("error", ...e);
|
|
663
|
+
}
|
|
664
|
+
sentryError(...e) {
|
|
665
|
+
this.handle("error", ...e);
|
|
666
|
+
}
|
|
667
|
+
sentryLog(...e) {
|
|
668
|
+
this.handle("log", ...e);
|
|
669
|
+
}
|
|
670
|
+
sentryWarn(...e) {
|
|
671
|
+
this.handle("warn", ...e);
|
|
672
|
+
}
|
|
673
|
+
sentryInfo(...e) {
|
|
674
|
+
this.handle("log", ...e);
|
|
675
|
+
}
|
|
676
|
+
handle(e, ...t) {
|
|
677
|
+
var r;
|
|
678
|
+
console[e](...t), ((r = this.fileLogger) == null ? void 0 : r[e](...t)) ?? this.messageQueue.add({ type: e, args: t });
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
const me = E(Pt);
|
|
682
|
+
function St(s = []) {
|
|
683
|
+
return f.normalize(f.join(te(), global.OVERLAYED.APP_NAME, ...s));
|
|
684
|
+
}
|
|
685
|
+
const Ct = L({
|
|
374
686
|
game: "string",
|
|
375
687
|
type: "string",
|
|
376
688
|
creation_time: "number"
|
|
377
689
|
});
|
|
378
|
-
class
|
|
690
|
+
class Ne {
|
|
379
691
|
constructor(e) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
this.logger =
|
|
692
|
+
l(this, "logger");
|
|
693
|
+
l(this, "initialized", !1);
|
|
694
|
+
this.logger = me.getInstance().scope(e);
|
|
383
695
|
}
|
|
384
696
|
init() {
|
|
385
697
|
this.logger.log("Initializing"), this.initialized = !0;
|
|
@@ -388,12 +700,12 @@ class Ae {
|
|
|
388
700
|
this.logger.log("Destroying"), this.initialized = !1;
|
|
389
701
|
}
|
|
390
702
|
}
|
|
391
|
-
class
|
|
703
|
+
class N extends pe {
|
|
392
704
|
constructor(t) {
|
|
393
705
|
super();
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
this.logger =
|
|
706
|
+
l(this, "logger");
|
|
707
|
+
l(this, "initialized", !1);
|
|
708
|
+
this.logger = me.getInstance().scope(t);
|
|
397
709
|
}
|
|
398
710
|
init() {
|
|
399
711
|
this.logger.log("Initializing"), this.initialized = !0;
|
|
@@ -402,157 +714,157 @@ class G extends Se {
|
|
|
402
714
|
this.logger.log("Destroying"), this.initialized = !1, this.removeAllListeners();
|
|
403
715
|
}
|
|
404
716
|
}
|
|
405
|
-
var
|
|
406
|
-
function
|
|
717
|
+
var M = "object", Ge = "function", je = "prototype", se = "text", be = "json", Pe = "abort", ne = "paramsSerializer", Se = "addEventListener", V = "status", k = "headers", re = Object, K = void 0, J = null, ie = re[je], X = re.keys, A = Array.isArray, Ce = "method", Ve = "HEAD", ae = "GET", He = "OPTIONS", Lt = "POST", Kt = "PUT", Ft = "PATCH", Dt = "DELETE";
|
|
718
|
+
function Ot(s, e) {
|
|
407
719
|
let t = new AbortController();
|
|
408
720
|
function r(o) {
|
|
409
|
-
t.abort(o),
|
|
721
|
+
t.abort(o), i();
|
|
410
722
|
}
|
|
411
|
-
let
|
|
412
|
-
for (let o of
|
|
723
|
+
let n = [];
|
|
724
|
+
for (let o of s) {
|
|
413
725
|
if ((o == null ? void 0 : o.aborted) === !0) {
|
|
414
726
|
r(o.reason);
|
|
415
727
|
break;
|
|
416
728
|
}
|
|
417
|
-
if (o != null && o[
|
|
418
|
-
let
|
|
729
|
+
if (o != null && o[Se]) {
|
|
730
|
+
let c = () => {
|
|
419
731
|
r(o.reason);
|
|
420
732
|
};
|
|
421
|
-
|
|
422
|
-
var
|
|
423
|
-
(
|
|
424
|
-
}), o[
|
|
733
|
+
n.push(() => {
|
|
734
|
+
var u;
|
|
735
|
+
(u = o.removeEventListener) == null || u.call(o, Pe, c);
|
|
736
|
+
}), o[Se](Pe, c);
|
|
425
737
|
}
|
|
426
738
|
}
|
|
427
|
-
function
|
|
428
|
-
|
|
739
|
+
function i() {
|
|
740
|
+
n.forEach((o) => o()), e == null || e();
|
|
429
741
|
}
|
|
430
|
-
let
|
|
431
|
-
return
|
|
742
|
+
let a = t.signal;
|
|
743
|
+
return a.clear = i, a;
|
|
432
744
|
}
|
|
433
|
-
var
|
|
434
|
-
if (
|
|
435
|
-
if (typeof
|
|
436
|
-
let e =
|
|
437
|
-
return e ===
|
|
745
|
+
var Le = re.getPrototypeOf, Ke = (s) => {
|
|
746
|
+
if (s !== J && typeof s === M) {
|
|
747
|
+
if (typeof Le === Ge) {
|
|
748
|
+
let e = Le(s);
|
|
749
|
+
return e === ie || e === J;
|
|
438
750
|
}
|
|
439
|
-
return
|
|
751
|
+
return ie.toString.call(s) === `[${M} Object]`;
|
|
440
752
|
}
|
|
441
753
|
return !1;
|
|
442
|
-
},
|
|
443
|
-
if (
|
|
444
|
-
return
|
|
445
|
-
["__proto__", "constructor",
|
|
754
|
+
}, ve = (...s) => s.reduce((e, t) => {
|
|
755
|
+
if (A(t)) throw new TypeError(`Arguments must be ${M}s, not arrays.`);
|
|
756
|
+
return X(t).forEach((r) => {
|
|
757
|
+
["__proto__", "constructor", je].includes(r) || (A(e[r]) && A(t[r]) ? e[r] = Array.from(new Set(e[r].concat(t[r]))) : Ke(e[r]) && Ke(t[r]) ? e[r] = ve(e[r], t[r]) : e[r] = t[r]);
|
|
446
758
|
}), e;
|
|
447
759
|
}, {});
|
|
448
|
-
function
|
|
449
|
-
if (
|
|
450
|
-
let
|
|
451
|
-
if (
|
|
452
|
-
if (
|
|
760
|
+
function we(s, e = !0, t = J, r) {
|
|
761
|
+
if (s === K || s === J) return "";
|
|
762
|
+
let n = [], i = e ? encodeURIComponent : (g) => g, a = A(s), { arrayFormat: o, allowDots: c, serializeDate: u } = r || {}, d = (g) => {
|
|
763
|
+
if (c && !a) return `.${g}`;
|
|
764
|
+
if (a) {
|
|
453
765
|
if (o === "brackets") return "[]";
|
|
454
766
|
if (o === "repeat") return "";
|
|
455
767
|
}
|
|
456
768
|
return `[${g}]`;
|
|
457
769
|
};
|
|
458
|
-
for (let g in
|
|
459
|
-
let
|
|
460
|
-
if (
|
|
461
|
-
let
|
|
462
|
-
if (!isNaN(
|
|
463
|
-
let
|
|
464
|
-
|
|
465
|
-
} else
|
|
770
|
+
for (let g in s) if (ie.hasOwnProperty.call(s, g)) {
|
|
771
|
+
let h = s[g];
|
|
772
|
+
if (h !== K) {
|
|
773
|
+
let y = t ? `${t}${d(g)}` : i(g);
|
|
774
|
+
if (!isNaN(h) && h instanceof Date && (h = u ? u(h) : h.toISOString()), typeof h === M) {
|
|
775
|
+
let p = we(h, e, y, r);
|
|
776
|
+
p !== "" && n.push(p);
|
|
777
|
+
} else n.push(`${i(y)}=${i(h)}`);
|
|
466
778
|
}
|
|
467
779
|
}
|
|
468
|
-
return
|
|
780
|
+
return n.join("&");
|
|
469
781
|
}
|
|
470
|
-
function
|
|
471
|
-
return
|
|
472
|
-
let t =
|
|
473
|
-
t ===
|
|
474
|
-
}),
|
|
782
|
+
function oe(s) {
|
|
783
|
+
return A(s) ? s.map(oe) : (s && typeof s === M && X(s).forEach((e) => {
|
|
784
|
+
let t = s[e];
|
|
785
|
+
t === K ? delete s[e] : oe(t);
|
|
786
|
+
}), s);
|
|
475
787
|
}
|
|
476
|
-
function
|
|
477
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(
|
|
788
|
+
function Mt(s) {
|
|
789
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(s);
|
|
478
790
|
}
|
|
479
|
-
function
|
|
480
|
-
return
|
|
791
|
+
function $t(s, e) {
|
|
792
|
+
return s ? e ? (s.endsWith("/") ? s : s + "/") + (e[0] === "/" ? e.slice(1) : e) : s : e || "";
|
|
481
793
|
}
|
|
482
|
-
var
|
|
483
|
-
constructor(
|
|
484
|
-
super(
|
|
794
|
+
var At = "XiorError", Rt = "XiorTimeoutError", Ue = class extends Error {
|
|
795
|
+
constructor(s, e, t) {
|
|
796
|
+
super(s), this.name = At, this.request = e, this.config = e, this.response = t;
|
|
485
797
|
}
|
|
486
|
-
},
|
|
798
|
+
}, xt = class extends Ue {
|
|
487
799
|
constructor(e, t, r) {
|
|
488
|
-
super(e, t, r), this.name =
|
|
800
|
+
super(e, t, r), this.name = Rt;
|
|
489
801
|
}
|
|
490
|
-
},
|
|
491
|
-
for (var t in e || (e = {}))
|
|
492
|
-
if (
|
|
493
|
-
return
|
|
494
|
-
},
|
|
802
|
+
}, Tt = Object.defineProperty, Bt = Object.defineProperties, Nt = Object.getOwnPropertyDescriptors, Y = Object.getOwnPropertySymbols, ze = Object.prototype.hasOwnProperty, We = Object.prototype.propertyIsEnumerable, Fe = (s, e, t) => e in s ? Tt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, R = (s, e) => {
|
|
803
|
+
for (var t in e || (e = {})) ze.call(e, t) && Fe(s, t, e[t]);
|
|
804
|
+
if (Y) for (var t of Y(e)) We.call(e, t) && Fe(s, t, e[t]);
|
|
805
|
+
return s;
|
|
806
|
+
}, q = (s, e) => Bt(s, Nt(e)), Gt = (s, e) => {
|
|
495
807
|
var t = {};
|
|
496
|
-
for (var r in
|
|
497
|
-
if (
|
|
808
|
+
for (var r in s) ze.call(s, r) && e.indexOf(r) < 0 && (t[r] = s[r]);
|
|
809
|
+
if (s != null && Y) for (var r of Y(s)) e.indexOf(r) < 0 && We.call(s, r) && (t[r] = s[r]);
|
|
498
810
|
return t;
|
|
499
|
-
},
|
|
500
|
-
var
|
|
811
|
+
}, x = (s, e, t) => new Promise((r, n) => {
|
|
812
|
+
var i = (c) => {
|
|
501
813
|
try {
|
|
502
|
-
o(t.next(
|
|
503
|
-
} catch (
|
|
504
|
-
|
|
814
|
+
o(t.next(c));
|
|
815
|
+
} catch (u) {
|
|
816
|
+
n(u);
|
|
505
817
|
}
|
|
506
|
-
},
|
|
818
|
+
}, a = (c) => {
|
|
507
819
|
try {
|
|
508
|
-
o(t.throw(
|
|
509
|
-
} catch (
|
|
510
|
-
|
|
820
|
+
o(t.throw(c));
|
|
821
|
+
} catch (u) {
|
|
822
|
+
n(u);
|
|
511
823
|
}
|
|
512
|
-
}, o = (
|
|
513
|
-
o((t = t.apply(
|
|
514
|
-
}),
|
|
515
|
-
function
|
|
516
|
-
return [
|
|
824
|
+
}, o = (c) => c.done ? r(c.value) : Promise.resolve(c.value).then(i, a);
|
|
825
|
+
o((t = t.apply(s, e)).next());
|
|
826
|
+
}), Ie = "application/", qe = `${Ie}x-www-form-urlencoded`, Qe = RegExp, jt = new Qe(`^${qe}`, "i"), Vt = `${Ie}${be}`, Ht = new Qe(`^${Ie}.*${be}.*`, "i");
|
|
827
|
+
function Ut(s = ae) {
|
|
828
|
+
return [Ve, ae, He].includes(s);
|
|
517
829
|
}
|
|
518
|
-
var
|
|
519
|
-
function
|
|
520
|
-
return
|
|
521
|
-
let e =
|
|
522
|
-
if (o && typeof o.append !==
|
|
523
|
-
let
|
|
524
|
-
if (
|
|
525
|
-
let
|
|
526
|
-
|
|
830
|
+
var zt = typeof URLSearchParams != `${K}`;
|
|
831
|
+
function Wt(s) {
|
|
832
|
+
return x(this, null, function* () {
|
|
833
|
+
let e = s[ne] || we, t = s.encodeURI !== !1, r = s[Ce] && s[Ce].toUpperCase(), n = s.url, i = n, a = zt && s.data instanceof URLSearchParams, o = a ? re.fromEntries(s.data.entries()) : s.data, c = o, u = s != null && s[k] ? R({}, s[k]) : {}, d = s.params, g = Ut(r);
|
|
834
|
+
if (o && typeof o.append !== Ge) {
|
|
835
|
+
let h = "", y = "content-type";
|
|
836
|
+
if (s != null && s[k]) {
|
|
837
|
+
let p = X(s[k]).find((_) => _.toLowerCase() === y);
|
|
838
|
+
p && (y = p, h = s[k][p]);
|
|
527
839
|
}
|
|
528
|
-
(!
|
|
840
|
+
(!h || a) && (h = g || a ? qe : Vt, u[y] = h), typeof o === M && (g && d && (d = ve(o, d)), Ht.test(h) ? c = JSON.stringify(oe(o)) : !g && jt.test(h) && (c = e(o)));
|
|
529
841
|
}
|
|
530
|
-
if (
|
|
531
|
-
let
|
|
532
|
-
|
|
842
|
+
if (d && X(d).length > 0) {
|
|
843
|
+
let h = e(d, t);
|
|
844
|
+
n += n.includes("?") ? `&${h}` : `?${h}`;
|
|
533
845
|
}
|
|
534
|
-
return
|
|
846
|
+
return q(R({}, s), { _data: c, _url: n, data: o, url: i, method: r, [k]: u, isGet: g });
|
|
535
847
|
});
|
|
536
848
|
}
|
|
537
|
-
var
|
|
538
|
-
function
|
|
539
|
-
return
|
|
849
|
+
var qt = typeof AbortController != `${K}`;
|
|
850
|
+
function Qt(s, e) {
|
|
851
|
+
return x(this, null, function* () {
|
|
540
852
|
let t;
|
|
541
|
-
if (!e || !
|
|
542
|
-
if (t = yield
|
|
853
|
+
if (!e || !s.ok || [se, be].includes(e)) {
|
|
854
|
+
if (t = yield s[se](), t && e !== se) try {
|
|
543
855
|
t = JSON.parse(t);
|
|
544
856
|
} catch {
|
|
545
857
|
}
|
|
546
858
|
} else {
|
|
547
|
-
if (e === "blob") return
|
|
548
|
-
if (e === "arraybuffer") return
|
|
859
|
+
if (e === "blob") return s.blob();
|
|
860
|
+
if (e === "arraybuffer") return s.arrayBuffer();
|
|
549
861
|
}
|
|
550
862
|
return t;
|
|
551
863
|
});
|
|
552
864
|
}
|
|
553
|
-
var
|
|
865
|
+
var Jt = (s) => new O(s), O = class {
|
|
554
866
|
constructor(e) {
|
|
555
|
-
this.REQI = [], this.RESI = [], this.P = [], this.config = e, this.defaults = { params: {}, [
|
|
867
|
+
this.REQI = [], this.RESI = [], this.P = [], this.config = e, this.defaults = { params: {}, [k]: {} };
|
|
556
868
|
}
|
|
557
869
|
get interceptors() {
|
|
558
870
|
return { request: { use: (e, t, r) => (this.REQI.push(e), e), eject: (e) => {
|
|
@@ -573,209 +885,209 @@ var Rt = (n) => new A(n), A = class {
|
|
|
573
885
|
} };
|
|
574
886
|
}
|
|
575
887
|
request(e) {
|
|
576
|
-
return
|
|
577
|
-
let t =
|
|
578
|
-
t.withCredentials && !t[r] && (t[r] = "include"), t[ne] || (t[ne] =
|
|
579
|
-
for (let
|
|
580
|
-
let
|
|
581
|
-
this.P.forEach((
|
|
582
|
-
|
|
888
|
+
return x(this, null, function* () {
|
|
889
|
+
let t = ve(this.config || {}, this.defaults, typeof e == "string" ? { url: e } : e), r = "credentials";
|
|
890
|
+
t.withCredentials && !t[r] && (t[r] = "include"), t[ne] || (t[ne] = we);
|
|
891
|
+
for (let a of this.REQI) t = yield a(t);
|
|
892
|
+
let n = this._.bind(this);
|
|
893
|
+
this.P.forEach((a) => {
|
|
894
|
+
n = a(n, this);
|
|
583
895
|
});
|
|
584
|
-
let
|
|
896
|
+
let i = n(t);
|
|
585
897
|
if (!t._did) {
|
|
586
|
-
let
|
|
587
|
-
for (this.RESI.forEach(function(
|
|
588
|
-
o.push(
|
|
589
|
-
}); o.length >
|
|
898
|
+
let a = 0, o = [];
|
|
899
|
+
for (this.RESI.forEach(function(c) {
|
|
900
|
+
o.push(c.fn, c.onRejected);
|
|
901
|
+
}); o.length > a; ) i = i.then(o[a++], o[a++]);
|
|
590
902
|
}
|
|
591
|
-
return
|
|
903
|
+
return i;
|
|
592
904
|
});
|
|
593
905
|
}
|
|
594
906
|
_(e) {
|
|
595
|
-
return
|
|
596
|
-
let t = yield
|
|
597
|
-
e._url =
|
|
598
|
-
let
|
|
599
|
-
if (
|
|
600
|
-
let
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
},
|
|
907
|
+
return x(this, null, function* () {
|
|
908
|
+
let t = yield Wt(e), { url: r, method: n, headers: i, timeout: a, signal: o, data: c, _data: u, _url: d, isGet: g, fetch: h } = t, y = Gt(t, ["url", "method", "headers", "timeout", "signal", "data", "_data", "_url", "isGet", "fetch"]);
|
|
909
|
+
e._url = d;
|
|
910
|
+
let p, _ = [], G = K;
|
|
911
|
+
if (a && qt) {
|
|
912
|
+
let v = new AbortController();
|
|
913
|
+
G = setTimeout(() => {
|
|
914
|
+
v.abort(new xt(`timeout of ${a}ms exceeded`, e));
|
|
915
|
+
}, a), _.push(v.signal);
|
|
604
916
|
}
|
|
605
|
-
o &&
|
|
606
|
-
clearTimeout(
|
|
917
|
+
o && _.push(o), p = _[0], _.length > 1 && (p = Ot(_, () => {
|
|
918
|
+
clearTimeout(G);
|
|
607
919
|
}));
|
|
608
|
-
let
|
|
609
|
-
return e[
|
|
610
|
-
let { responseType:
|
|
611
|
-
if (!
|
|
612
|
-
let
|
|
613
|
-
return Promise.reject(
|
|
920
|
+
let j = d || r, _e = "baseURL";
|
|
921
|
+
return e[_e] && !Mt(j) && (j = $t(e[_e], j)), (h || fetch)(j, q(R({ body: g ? K : u }, y), { signal: p, method: n, headers: i })).then((v) => x(this, null, function* () {
|
|
922
|
+
let { responseType: Ze } = e, ke = { data: yield Qt(v, Ze), response: v, config: e, request: e, [V]: v[V], statusText: v.statusText, [k]: v[k] };
|
|
923
|
+
if (!v.ok) {
|
|
924
|
+
let et = new Ue(v[V] ? `Request failed with status code ${v[V]}` : "Network error", e, ke);
|
|
925
|
+
return Promise.reject(et);
|
|
614
926
|
}
|
|
615
|
-
return
|
|
927
|
+
return ke;
|
|
616
928
|
})).finally(() => {
|
|
617
|
-
var
|
|
618
|
-
|
|
929
|
+
var v;
|
|
930
|
+
G && clearTimeout(G), (v = p == null ? void 0 : p.clear) == null || v.call(p);
|
|
619
931
|
});
|
|
620
932
|
});
|
|
621
933
|
}
|
|
622
934
|
cG(e) {
|
|
623
|
-
return (t, r) => this.request(r ?
|
|
935
|
+
return (t, r) => this.request(r ? q(R({}, r), { method: e, url: t }) : { method: e, url: t });
|
|
624
936
|
}
|
|
625
937
|
cP(e) {
|
|
626
|
-
return (t, r,
|
|
938
|
+
return (t, r, n) => this.request(n ? q(R({}, n), { method: e, url: t, data: r }) : { method: e, url: t, data: r });
|
|
627
939
|
}
|
|
628
940
|
get(e, t) {
|
|
629
|
-
return this.cG(
|
|
941
|
+
return this.cG(ae)(e, t);
|
|
630
942
|
}
|
|
631
943
|
head(e, t) {
|
|
632
|
-
return this.cG(
|
|
944
|
+
return this.cG(Ve)(e, t);
|
|
633
945
|
}
|
|
634
946
|
post(e, t, r) {
|
|
635
|
-
return this.cP(
|
|
947
|
+
return this.cP(Lt)(e, t, r);
|
|
636
948
|
}
|
|
637
949
|
put(e, t, r) {
|
|
638
|
-
return this.cP(
|
|
950
|
+
return this.cP(Kt)(e, t, r);
|
|
639
951
|
}
|
|
640
952
|
patch(e, t, r) {
|
|
641
|
-
return this.cP(
|
|
953
|
+
return this.cP(Ft)(e, t, r);
|
|
642
954
|
}
|
|
643
955
|
delete(e, t) {
|
|
644
|
-
return this.cG(
|
|
956
|
+
return this.cG(Dt)(e, t);
|
|
645
957
|
}
|
|
646
958
|
options(e, t) {
|
|
647
|
-
return this.cG(
|
|
959
|
+
return this.cG(He)(e, t);
|
|
648
960
|
}
|
|
649
961
|
};
|
|
650
|
-
|
|
651
|
-
var
|
|
652
|
-
const
|
|
962
|
+
O.create = Jt, O.VERSION = "0.7.7";
|
|
963
|
+
var Xt = Object.assign(O.create(), { create: O.create, VERSION: O.VERSION }), Je = Xt;
|
|
964
|
+
const Xe = Je.create({
|
|
653
965
|
baseURL: "https://updater.stats.cc",
|
|
654
966
|
headers: {
|
|
655
967
|
Accept: "application/json",
|
|
656
968
|
"Accept-Encoding": "gzip, deflate, br"
|
|
657
969
|
}
|
|
658
|
-
}),
|
|
970
|
+
}), Ee = Je.create({
|
|
659
971
|
baseURL: "https://api.stats.cc",
|
|
660
972
|
headers: {
|
|
661
973
|
Accept: "application/json",
|
|
662
974
|
"Accept-Encoding": "gzip, deflate, br"
|
|
663
975
|
}
|
|
664
976
|
});
|
|
665
|
-
function
|
|
666
|
-
return
|
|
977
|
+
function Yt(s, e) {
|
|
978
|
+
return Xe.get(`/v1/native/${s}/version.txt`, {
|
|
667
979
|
params: { channel: e },
|
|
668
980
|
responseType: "text"
|
|
669
981
|
});
|
|
670
982
|
}
|
|
671
|
-
function
|
|
672
|
-
return
|
|
983
|
+
function Zt(s, e) {
|
|
984
|
+
return Xe.get(`/v1/native/${s}/files`, {
|
|
673
985
|
params: { channel: e },
|
|
674
986
|
responseType: "arraybuffer"
|
|
675
987
|
});
|
|
676
988
|
}
|
|
677
|
-
function
|
|
678
|
-
return
|
|
989
|
+
function er() {
|
|
990
|
+
return Ee.get("/v1/raven/config");
|
|
679
991
|
}
|
|
680
|
-
function
|
|
681
|
-
return
|
|
992
|
+
function tr(s, e) {
|
|
993
|
+
return Ee.get(`/v1/raven/games/${s}/builds/${e}/check`);
|
|
682
994
|
}
|
|
683
|
-
function
|
|
995
|
+
function rr(s, e) {
|
|
684
996
|
const t = new FormData();
|
|
685
|
-
return t.append("file", e),
|
|
997
|
+
return t.append("file", e), Ee.post(`/v1/raven/games/${s}/builds/upload`, t, {});
|
|
686
998
|
}
|
|
687
|
-
function
|
|
688
|
-
return
|
|
999
|
+
function sr(s) {
|
|
1000
|
+
return s instanceof Error && (s.name === "XiorError" || s.name === "XiorTimeoutError");
|
|
689
1001
|
}
|
|
690
|
-
function
|
|
691
|
-
return !!(
|
|
1002
|
+
function nr(s) {
|
|
1003
|
+
return !!(s && "kind" in s.data && "message" in s.data);
|
|
692
1004
|
}
|
|
693
|
-
const
|
|
1005
|
+
const ir = {
|
|
694
1006
|
buildChannel: "alpha"
|
|
695
1007
|
};
|
|
696
|
-
class
|
|
1008
|
+
class ar extends N {
|
|
697
1009
|
constructor() {
|
|
698
1010
|
super("NativeDllManager");
|
|
699
|
-
|
|
1011
|
+
l(this, "UPDATE_CHECK_INTERVAL_MS", 1e3 * 60 * 5);
|
|
700
1012
|
// 5 minutes
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
this.targetDir =
|
|
1013
|
+
l(this, "targetDir");
|
|
1014
|
+
l(this, "updateInterval");
|
|
1015
|
+
this.targetDir = f.join(te(), "resources"), this.logger.log("Target directory", this.targetDir);
|
|
704
1016
|
}
|
|
705
1017
|
async initWithDlls(t) {
|
|
706
|
-
super.init(), await
|
|
1018
|
+
super.init(), await w.mkdir(this.targetDir, { recursive: !0 }), await this.checkForUpdates(t), clearInterval(this.updateInterval), this.updateInterval = setInterval(() => this.checkForUpdates(t), this.UPDATE_CHECK_INTERVAL_MS);
|
|
707
1019
|
}
|
|
708
1020
|
destroy() {
|
|
709
1021
|
this.updateInterval && (clearInterval(this.updateInterval), this.updateInterval = void 0), super.destroy();
|
|
710
1022
|
}
|
|
711
1023
|
async getCurrentVersion(t) {
|
|
712
1024
|
try {
|
|
713
|
-
const r =
|
|
714
|
-
return await
|
|
1025
|
+
const r = f.join(this.targetDir, t, "version.txt");
|
|
1026
|
+
return await w.readFile(r, "utf-8");
|
|
715
1027
|
} catch {
|
|
716
1028
|
return null;
|
|
717
1029
|
}
|
|
718
1030
|
}
|
|
719
1031
|
getTargetPath(t) {
|
|
720
|
-
return
|
|
1032
|
+
return f.join(this.targetDir, t);
|
|
721
1033
|
}
|
|
722
1034
|
getTargetVersionPath(t, r) {
|
|
723
|
-
return
|
|
1035
|
+
return f.join(this.getTargetPath(t), r);
|
|
724
1036
|
}
|
|
725
1037
|
async checkForUpdates(t) {
|
|
726
|
-
const r =
|
|
1038
|
+
const r = ir.buildChannel;
|
|
727
1039
|
this.logger.log("Checking for updates");
|
|
728
|
-
for (const
|
|
1040
|
+
for (const n of t)
|
|
729
1041
|
try {
|
|
730
|
-
const { data:
|
|
731
|
-
this.logger.log(`${
|
|
732
|
-
const o =
|
|
733
|
-
this.logger.log(`${
|
|
734
|
-
} catch (
|
|
735
|
-
this.logger.captureSentryException(`${
|
|
1042
|
+
const { data: i } = await Yt(n, r), a = await this.getCurrentVersion(n);
|
|
1043
|
+
this.logger.log(`${n} > Update Check. current: ${a}, latest: ${i}`);
|
|
1044
|
+
const o = i !== a;
|
|
1045
|
+
this.logger.log(`${n} > Update found: ${a} -> ${i}`), await this.downloadAndExtractDll(n, i, r, o), this.logger.log(`${n} > Downloaded and extracted`), o && (this.logger.log(`${n} > Cleaning up versions older than ${i}`), await this.cleanupOldVersions(n, i)), this.emit("dllUpdated", { identifier: n, version: i });
|
|
1046
|
+
} catch (i) {
|
|
1047
|
+
this.logger.captureSentryException(`${n} > Error checking/updating`, i);
|
|
736
1048
|
}
|
|
737
1049
|
}
|
|
738
|
-
async downloadAndExtractDll(t, r,
|
|
739
|
-
const { data:
|
|
740
|
-
await
|
|
741
|
-
const
|
|
742
|
-
await
|
|
743
|
-
const
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
746
|
-
const
|
|
747
|
-
if (!
|
|
1050
|
+
async downloadAndExtractDll(t, r, n, i) {
|
|
1051
|
+
const { data: a } = await Zt(t, n), o = this.getTargetPath(t), c = this.getTargetVersionPath(t, r);
|
|
1052
|
+
await w.mkdir(c, { recursive: !0 });
|
|
1053
|
+
const u = new Re();
|
|
1054
|
+
await u.loadAsync(a);
|
|
1055
|
+
const d = Object.keys(u.files).map(async (h) => {
|
|
1056
|
+
const y = u.files[h];
|
|
1057
|
+
if (y && !y.dir) {
|
|
1058
|
+
const p = f.join(c, h);
|
|
1059
|
+
if (!i)
|
|
748
1060
|
try {
|
|
749
|
-
await
|
|
1061
|
+
await w.access(p, w.constants.F_OK);
|
|
750
1062
|
return;
|
|
751
1063
|
} catch {
|
|
752
|
-
this.logger.warn(`${t} > File missing, re-downloading: ${
|
|
1064
|
+
this.logger.warn(`${t} > File missing, re-downloading: ${p}`);
|
|
753
1065
|
}
|
|
754
|
-
const
|
|
755
|
-
await
|
|
1066
|
+
const _ = await y.async("nodebuffer");
|
|
1067
|
+
await w.writeFile(p, _);
|
|
756
1068
|
}
|
|
757
1069
|
});
|
|
758
|
-
await Promise.all(
|
|
759
|
-
const g =
|
|
760
|
-
this.logger.log("Saving version file", g), await
|
|
1070
|
+
await Promise.all(d);
|
|
1071
|
+
const g = f.join(o, "version.txt");
|
|
1072
|
+
this.logger.log("Saving version file", g), await w.writeFile(g, r);
|
|
761
1073
|
}
|
|
762
1074
|
async cleanupOldVersions(t, r) {
|
|
763
|
-
const
|
|
764
|
-
for (const
|
|
765
|
-
|
|
1075
|
+
const n = f.join(this.targetDir, t), i = await w.readdir(n, { withFileTypes: !0 });
|
|
1076
|
+
for (const a of i)
|
|
1077
|
+
a.isDirectory() && a.name !== r && await w.rm(f.join(n, a.name), { recursive: !0, force: !0 });
|
|
766
1078
|
}
|
|
767
1079
|
}
|
|
768
|
-
const
|
|
769
|
-
class
|
|
1080
|
+
const Z = E(ar);
|
|
1081
|
+
class or extends N {
|
|
770
1082
|
constructor() {
|
|
771
1083
|
super("RavenManager");
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
1084
|
+
l(this, "REFETCH_INTERVAL", 1e3 * 60 * 5);
|
|
1085
|
+
l(this, "FAILED_REFETCH_INTERVAL", 1e3 * 30);
|
|
1086
|
+
l(this, "_ravenConfig");
|
|
1087
|
+
l(this, "_executableToGameMap", /* @__PURE__ */ new Map());
|
|
1088
|
+
l(this, "_executablesArray", []);
|
|
1089
|
+
l(this, "_refetchIntervalHandler", null);
|
|
1090
|
+
l(this, "_failedRefetchTimeoutHandler", null);
|
|
779
1091
|
}
|
|
780
1092
|
init() {
|
|
781
1093
|
super.init(), this.fetchRavenConfig(), this._refetchIntervalHandler = setInterval(() => {
|
|
@@ -792,21 +1104,21 @@ class Ht extends G {
|
|
|
792
1104
|
return this._executableToGameMap;
|
|
793
1105
|
}
|
|
794
1106
|
destroy() {
|
|
795
|
-
this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler),
|
|
1107
|
+
this._refetchIntervalHandler && clearInterval(this._refetchIntervalHandler), this._failedRefetchTimeoutHandler && clearTimeout(this._failedRefetchTimeoutHandler), Z.getInstance().destroy(), super.destroy();
|
|
796
1108
|
}
|
|
797
1109
|
async fetchRavenConfig() {
|
|
798
1110
|
try {
|
|
799
|
-
const t = await
|
|
1111
|
+
const t = await er();
|
|
800
1112
|
this._ravenConfig = t.data, this.resetState();
|
|
801
1113
|
const r = /* @__PURE__ */ new Set();
|
|
802
|
-
for (const
|
|
803
|
-
for (const
|
|
804
|
-
const
|
|
805
|
-
this._executableToGameMap.set(
|
|
1114
|
+
for (const n of this._ravenConfig.games) {
|
|
1115
|
+
for (const i of n.executables) {
|
|
1116
|
+
const a = i.toLowerCase();
|
|
1117
|
+
this._executableToGameMap.set(a, n), this._executablesArray.push(a);
|
|
806
1118
|
}
|
|
807
|
-
|
|
1119
|
+
n.dlls_to_inject.forEach((i) => r.add(i));
|
|
808
1120
|
}
|
|
809
|
-
await
|
|
1121
|
+
await Z.getInstance().initWithDlls(Array.from(r)), this.logger.log("Raven updated", this._ravenConfig), this.emit("executablesUpdated", { executables: this.executables, map: this._executableToGameMap });
|
|
810
1122
|
} catch (t) {
|
|
811
1123
|
this.logger.captureSentryException("Failed to fetch Raven config", t), this._failedRefetchTimeoutHandler = setTimeout(() => this.fetchRavenConfig(), this.FAILED_REFETCH_INTERVAL);
|
|
812
1124
|
}
|
|
@@ -815,23 +1127,23 @@ class Ht extends G {
|
|
|
815
1127
|
this._executableToGameMap.clear(), this._executablesArray = [];
|
|
816
1128
|
}
|
|
817
1129
|
}
|
|
818
|
-
const T =
|
|
819
|
-
PipeEventServer:
|
|
820
|
-
PipeEventClient:
|
|
821
|
-
PipeEventBase:
|
|
822
|
-
ProcessMonitor:
|
|
823
|
-
Process:
|
|
824
|
-
InjectionMethod:
|
|
825
|
-
AccessLevel:
|
|
826
|
-
HardwareInterface:
|
|
827
|
-
} =
|
|
828
|
-
class
|
|
1130
|
+
const T = E(or), lr = ee(import.meta.url), {
|
|
1131
|
+
PipeEventServer: ls,
|
|
1132
|
+
PipeEventClient: cs,
|
|
1133
|
+
PipeEventBase: hs,
|
|
1134
|
+
ProcessMonitor: cr,
|
|
1135
|
+
Process: H,
|
|
1136
|
+
InjectionMethod: us,
|
|
1137
|
+
AccessLevel: ds,
|
|
1138
|
+
HardwareInterface: hr
|
|
1139
|
+
} = lr("@overlayed/app/dist/native-interface/build/overlayed_native_interface_x64.node");
|
|
1140
|
+
class ur extends N {
|
|
829
1141
|
constructor() {
|
|
830
1142
|
super("ProcessManager");
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
this._processMonitor = new
|
|
1143
|
+
l(this, "_processMonitor");
|
|
1144
|
+
l(this, "_processes", /* @__PURE__ */ new Map());
|
|
1145
|
+
l(this, "boundOnRavenManagerExecutablesUpdated", this.onRavenManagerExecutablesUpdated.bind(this));
|
|
1146
|
+
this._processMonitor = new cr();
|
|
835
1147
|
}
|
|
836
1148
|
get hasAnyActiveProcesses() {
|
|
837
1149
|
return this.activeProcesses.length > 0;
|
|
@@ -851,7 +1163,7 @@ class Qt extends G {
|
|
|
851
1163
|
}
|
|
852
1164
|
isProcessRunning(t) {
|
|
853
1165
|
const r = this._processes.get(t);
|
|
854
|
-
return (r == null ? void 0 : r.some((
|
|
1166
|
+
return (r == null ? void 0 : r.some((n) => !n.destroyedAt)) ?? !1;
|
|
855
1167
|
}
|
|
856
1168
|
onRavenManagerExecutablesUpdated(t) {
|
|
857
1169
|
t.executables.forEach((r) => {
|
|
@@ -871,15 +1183,15 @@ class Qt extends G {
|
|
|
871
1183
|
deleteProcess(t) {
|
|
872
1184
|
if (!t.name)
|
|
873
1185
|
return;
|
|
874
|
-
const r = this._processes.get(t.name),
|
|
875
|
-
|
|
1186
|
+
const r = this._processes.get(t.name), n = (r == null ? void 0 : r.filter((i) => i.id !== t.id)) ?? [];
|
|
1187
|
+
n.length === 0 ? this._processes.delete(t.name) : this._processes.set(t.name, n);
|
|
876
1188
|
}
|
|
877
1189
|
}
|
|
878
|
-
const C =
|
|
879
|
-
var
|
|
880
|
-
class
|
|
1190
|
+
const C = E(ur), dr = ee(import.meta.url), { RenderInterface: gr, renderHookPath: gs } = dr("@overlayed/app/dist/render-interface/build/overlayed_render_interface_x64.node");
|
|
1191
|
+
var fr = Object.defineProperty, pr = (s, e, t) => e in s ? fr(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, Q = (s, e, t) => pr(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1192
|
+
let yr = class {
|
|
881
1193
|
constructor(e) {
|
|
882
|
-
|
|
1194
|
+
Q(this, "_instance"), Q(this, "_resolution"), Q(this, "boundOnResolutionChanged", this.onResolutionChanged.bind(this)), this._instance = e, this._resolution = { width: 0, height: 0 }, this._instance.on("resolution", this.boundOnResolutionChanged);
|
|
883
1195
|
}
|
|
884
1196
|
destroy() {
|
|
885
1197
|
this._instance.off("resolution", this.boundOnResolutionChanged);
|
|
@@ -893,46 +1205,23 @@ class en {
|
|
|
893
1205
|
onResolutionChanged(e, t) {
|
|
894
1206
|
this._resolution = { width: e, height: t };
|
|
895
1207
|
}
|
|
896
|
-
}
|
|
897
|
-
|
|
1208
|
+
};
|
|
1209
|
+
class mr {
|
|
898
1210
|
constructor() {
|
|
899
|
-
|
|
1211
|
+
Q(this, "interfaces", {});
|
|
900
1212
|
}
|
|
901
1213
|
createInterface(e) {
|
|
902
|
-
return this.interfaces[e] ? this.interfaces[e] : (this.interfaces[e] = new
|
|
1214
|
+
return this.interfaces[e] ? this.interfaces[e] : (this.interfaces[e] = new yr(new gr(e, { access: 1 })), this.interfaces[e]);
|
|
903
1215
|
}
|
|
904
1216
|
getInterface(e) {
|
|
905
1217
|
return this.interfaces[e] ? this.interfaces[e] : this.createInterface(e);
|
|
906
1218
|
}
|
|
907
|
-
};
|
|
908
|
-
const O = _(tn);
|
|
909
|
-
var nn = Object.defineProperty, rn = (n, e, t) => e in n ? nn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, F = (n, e, t) => rn(n, typeof e != "symbol" ? e + "" : e, t);
|
|
910
|
-
class sn {
|
|
911
|
-
constructor() {
|
|
912
|
-
F(this, "data", []);
|
|
913
|
-
}
|
|
914
|
-
get size() {
|
|
915
|
-
return this.data.length;
|
|
916
|
-
}
|
|
917
|
-
add(e) {
|
|
918
|
-
this.data.push(e);
|
|
919
|
-
}
|
|
920
|
-
next() {
|
|
921
|
-
return this.data.shift();
|
|
922
|
-
}
|
|
923
|
-
clear() {
|
|
924
|
-
this.data.length = 0;
|
|
925
|
-
}
|
|
926
|
-
*flush() {
|
|
927
|
-
for (; this.size > 0; ) {
|
|
928
|
-
const e = this.next();
|
|
929
|
-
e && (yield e);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
1219
|
}
|
|
933
|
-
|
|
1220
|
+
const $ = E(mr);
|
|
1221
|
+
var br = Object.defineProperty, vr = (s, e, t) => e in s ? br(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, U = (s, e, t) => vr(s, typeof e != "symbol" ? e + "" : e, t);
|
|
1222
|
+
class wr {
|
|
934
1223
|
constructor(e) {
|
|
935
|
-
|
|
1224
|
+
U(this, "_clientId", null), U(this, "_userId", null), U(this, "options"), U(this, "eventQueue"), this.options = this.resolveOptions(e), this.eventQueue = new Be(), this.setupFlushInterval();
|
|
936
1225
|
}
|
|
937
1226
|
set clientId(e) {
|
|
938
1227
|
this._clientId = e;
|
|
@@ -957,15 +1246,15 @@ class an {
|
|
|
957
1246
|
};
|
|
958
1247
|
}
|
|
959
1248
|
}
|
|
960
|
-
const
|
|
961
|
-
class
|
|
1249
|
+
const S = E(wr), Ir = ee(import.meta.url), Er = Ir.resolve("@overlayed/app/dist/render-interface/build/overlayed_render_hook_x64.dll");
|
|
1250
|
+
class _r extends N {
|
|
962
1251
|
constructor() {
|
|
963
1252
|
super("GameLaunchManager");
|
|
964
|
-
|
|
965
|
-
|
|
1253
|
+
l(this, "boundOnProcessCreate", this.onProcessCreate.bind(this));
|
|
1254
|
+
l(this, "boundOnProcessDestroy", this.onProcessDestroy.bind(this));
|
|
966
1255
|
}
|
|
967
1256
|
init() {
|
|
968
|
-
super.init(),
|
|
1257
|
+
super.init(), $.getInstance().createInterface("OGG_SIEGE"), C.getInstance().on("create", this.boundOnProcessCreate), C.getInstance().on("destroy", this.boundOnProcessDestroy);
|
|
969
1258
|
}
|
|
970
1259
|
destroy() {
|
|
971
1260
|
C.getInstance().off("create", this.boundOnProcessCreate), C.getInstance().off("destroy", this.boundOnProcessDestroy), super.destroy();
|
|
@@ -974,76 +1263,76 @@ class cn extends G {
|
|
|
974
1263
|
const r = this.getRavenGame(t);
|
|
975
1264
|
if (!r)
|
|
976
1265
|
return;
|
|
977
|
-
if (this.logger.log("Game Launched", r), this.logger.log("Process is elevated: ", t.isElevated), this.logger.log("Current process is elevated: ",
|
|
1266
|
+
if (this.logger.log("Game Launched", r), this.logger.log("Process is elevated: ", t.isElevated), this.logger.log("Current process is elevated: ", H.currentProcess.isElevated), t.isElevated && !H.currentProcess.isElevated) {
|
|
978
1267
|
I.getInstance().fatal("Game is elevated but the App is not", "ELEVATION_MISMATCH", {
|
|
979
|
-
appElevated: !!
|
|
1268
|
+
appElevated: !!H.currentProcess.isElevated,
|
|
980
1269
|
gameElevated: !!t.isElevated
|
|
981
1270
|
}), this.logger.sentryLog("Game elevated but App is not", {
|
|
982
|
-
appElevated:
|
|
1271
|
+
appElevated: H.currentProcess.isElevated,
|
|
983
1272
|
gameElevated: t.isElevated
|
|
984
1273
|
});
|
|
985
1274
|
return;
|
|
986
1275
|
}
|
|
987
|
-
const
|
|
988
|
-
if (
|
|
1276
|
+
const n = this.copyDll(Er);
|
|
1277
|
+
if (n)
|
|
989
1278
|
try {
|
|
990
|
-
await t.injectDll(
|
|
991
|
-
} catch (
|
|
992
|
-
this.logger.captureSentryException("Render Interface Injection Failed",
|
|
993
|
-
renderInterfacePath:
|
|
1279
|
+
await t.injectDll(n), this.logger.log("Render Interface Injection Successful", n);
|
|
1280
|
+
} catch (a) {
|
|
1281
|
+
this.logger.captureSentryException("Render Interface Injection Failed", a), this.logger.sentryError("Render Interface Injection Failed", {
|
|
1282
|
+
renderInterfacePath: n
|
|
994
1283
|
});
|
|
995
1284
|
}
|
|
996
|
-
const
|
|
997
|
-
const o = await
|
|
1285
|
+
const i = r == null ? void 0 : r.dlls_to_inject.map(async (a) => {
|
|
1286
|
+
const o = await Z.getInstance().getCurrentVersion(a);
|
|
998
1287
|
if (!o)
|
|
999
|
-
return this.logger.sentryError("No version found for DLL", { identifier:
|
|
1000
|
-
const
|
|
1001
|
-
this.logger.log("DLL Path",
|
|
1002
|
-
const
|
|
1003
|
-
return this.logger.log("DLL Files",
|
|
1004
|
-
|
|
1005
|
-
const g =
|
|
1006
|
-
if (!
|
|
1288
|
+
return this.logger.sentryError("No version found for DLL", { identifier: a }), Promise.resolve();
|
|
1289
|
+
const c = Z.getInstance().getTargetVersionPath(a, o);
|
|
1290
|
+
this.logger.log("DLL Path", c);
|
|
1291
|
+
const u = await this.getDllFiles(c);
|
|
1292
|
+
return this.logger.log("DLL Files", u), Promise.all(
|
|
1293
|
+
u.map(async (d) => {
|
|
1294
|
+
const g = f.basename(d), h = f.join(c, g);
|
|
1295
|
+
if (!h)
|
|
1007
1296
|
return Promise.resolve();
|
|
1008
|
-
this.logger.log("Injecting: ",
|
|
1297
|
+
this.logger.log("Injecting: ", h);
|
|
1009
1298
|
try {
|
|
1010
|
-
return t.injectDll(
|
|
1011
|
-
this.logger.log("Injection Successful",
|
|
1012
|
-
}).catch((
|
|
1013
|
-
this.logger.sentryError("Injection Failed [1]", { targetPath:
|
|
1299
|
+
return t.injectDll(h).then(() => {
|
|
1300
|
+
this.logger.log("Injection Successful", h);
|
|
1301
|
+
}).catch((y) => {
|
|
1302
|
+
this.logger.sentryError("Injection Failed [1]", { targetPath: h }, y);
|
|
1014
1303
|
});
|
|
1015
|
-
} catch (
|
|
1016
|
-
return this.logger.sentryError("Injection Failed [2]", { targetPath:
|
|
1304
|
+
} catch (y) {
|
|
1305
|
+
return this.logger.sentryError("Injection Failed [2]", { targetPath: h }, y), Promise.reject(y);
|
|
1017
1306
|
}
|
|
1018
1307
|
})
|
|
1019
1308
|
);
|
|
1020
1309
|
});
|
|
1021
|
-
await Promise.allSettled(
|
|
1310
|
+
await Promise.allSettled(i), this.emit("gameLaunchInternal", { ravenGame: r, process: t }), this.emit("gameLaunch", { game: r.identifier }), S.getInstance().track("game_launch", {
|
|
1022
1311
|
game: r.identifier
|
|
1023
1312
|
});
|
|
1024
1313
|
}
|
|
1025
1314
|
copyDll(t) {
|
|
1026
|
-
const r =
|
|
1027
|
-
this.logger.debug("Copying",
|
|
1315
|
+
const r = f.basename(t), n = nt(t), i = f.join(te(), "resources"), a = f.join(i, r);
|
|
1316
|
+
this.logger.debug("Copying", n, "to", a);
|
|
1028
1317
|
try {
|
|
1029
|
-
|
|
1030
|
-
const o =
|
|
1031
|
-
|
|
1318
|
+
he(i) || ce(i, { recursive: !0 });
|
|
1319
|
+
const o = Ae(n);
|
|
1320
|
+
ue(a, o), st(n, a);
|
|
1032
1321
|
} catch (o) {
|
|
1033
|
-
return o.code === "EBUSY" ?
|
|
1322
|
+
return o.code === "EBUSY" ? a : (this.logger.captureSentryException("Failed to copy", o), this.logger.sentryError("Failed to copy", { originalPath: n, targetPath: a }), !1);
|
|
1034
1323
|
}
|
|
1035
|
-
return
|
|
1324
|
+
return a;
|
|
1036
1325
|
}
|
|
1037
1326
|
async getDllFiles(t) {
|
|
1038
1327
|
try {
|
|
1039
|
-
return (await
|
|
1328
|
+
return (await w.readdir(t)).filter((n) => n.endsWith(".dll")).map((n) => f.join(t, n));
|
|
1040
1329
|
} catch (r) {
|
|
1041
1330
|
return this.logger.captureSentryException("Failed to read DLL directory", r), this.logger.sentryError("Failed to read DLL directory", { dllPath: t }), [];
|
|
1042
1331
|
}
|
|
1043
1332
|
}
|
|
1044
1333
|
onProcessDestroy({ process: t }) {
|
|
1045
1334
|
const r = this.getRavenGame(t);
|
|
1046
|
-
r && (this.emit("gameCloseInternal", { ravenGame: r, process: t }), this.emit("gameClose", { game: r.identifier }),
|
|
1335
|
+
r && (this.emit("gameCloseInternal", { ravenGame: r, process: t }), this.emit("gameClose", { game: r.identifier }), S.getInstance().track("game_close", {
|
|
1047
1336
|
game: r.identifier
|
|
1048
1337
|
}));
|
|
1049
1338
|
}
|
|
@@ -1058,11 +1347,11 @@ class cn extends G {
|
|
|
1058
1347
|
return r;
|
|
1059
1348
|
}
|
|
1060
1349
|
}
|
|
1061
|
-
const B =
|
|
1062
|
-
class
|
|
1350
|
+
const B = E(_r);
|
|
1351
|
+
class kr extends Ne {
|
|
1063
1352
|
constructor() {
|
|
1064
1353
|
super("GameBuildManager");
|
|
1065
|
-
|
|
1354
|
+
l(this, "boundOnGameLaunch", this.onGameLaunch.bind(this));
|
|
1066
1355
|
}
|
|
1067
1356
|
init() {
|
|
1068
1357
|
super.init(), B.getInstance().on("gameLaunchInternal", this.boundOnGameLaunch);
|
|
@@ -1071,39 +1360,39 @@ class un extends Ae {
|
|
|
1071
1360
|
B.getInstance().off("gameLaunchInternal", this.boundOnGameLaunch), super.destroy();
|
|
1072
1361
|
}
|
|
1073
1362
|
async onGameLaunch(t) {
|
|
1074
|
-
const { ravenGame: r, process:
|
|
1075
|
-
if (!
|
|
1363
|
+
const { ravenGame: r, process: n } = t;
|
|
1364
|
+
if (!n.path || !n.name) {
|
|
1076
1365
|
this.logger.sentryError(
|
|
1077
1366
|
"Process path or name not found, could not check for build hash",
|
|
1078
1367
|
void 0,
|
|
1079
|
-
|
|
1368
|
+
n
|
|
1080
1369
|
);
|
|
1081
1370
|
return;
|
|
1082
1371
|
}
|
|
1083
|
-
const
|
|
1084
|
-
this.logger.log("Process Path",
|
|
1372
|
+
const i = Ae(n.path), a = it("sha256").update(i).digest("hex");
|
|
1373
|
+
this.logger.log("Process Path", n.path), this.logger.log("Process Name", n.name), this.logger.log("Build Hash", a);
|
|
1085
1374
|
let o = !1;
|
|
1086
1375
|
try {
|
|
1087
|
-
o = (await
|
|
1088
|
-
} catch (
|
|
1089
|
-
this.logger.captureSentryException("Error checking game build hash",
|
|
1376
|
+
o = (await tr(r.identifier, a)).data.upload;
|
|
1377
|
+
} catch (d) {
|
|
1378
|
+
this.logger.captureSentryException("Error checking game build hash", d);
|
|
1090
1379
|
return;
|
|
1091
1380
|
}
|
|
1092
1381
|
if (!o) {
|
|
1093
1382
|
this.logger.log("Build hash already exists, skipping upload");
|
|
1094
1383
|
return;
|
|
1095
1384
|
}
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1098
|
-
const
|
|
1385
|
+
const c = new Re();
|
|
1386
|
+
c.file(n.name, i);
|
|
1387
|
+
const u = await c.generateAsync({ type: "blob" });
|
|
1099
1388
|
try {
|
|
1100
|
-
this.logger.log("Uploading build (size: ",
|
|
1101
|
-
} catch (
|
|
1102
|
-
|
|
1389
|
+
this.logger.log("Uploading build (size: ", u.size, " bytes)"), await rr(r.identifier, u), this.logger.log("Build uploaded successfully");
|
|
1390
|
+
} catch (d) {
|
|
1391
|
+
sr(d) ? nr(d.response) ? this.logger.captureSentryException("Error uploading build hash, api error", d) : this.logger.captureSentryException("Error uploading build hash, request error", d) : this.logger.captureSentryException("Error uploading build hash, unknown error", d);
|
|
1103
1392
|
}
|
|
1104
1393
|
}
|
|
1105
1394
|
}
|
|
1106
|
-
const
|
|
1395
|
+
const Ye = E(kr), le = /* @__PURE__ */ new Map([
|
|
1107
1396
|
[1, "LeftButton"],
|
|
1108
1397
|
[2, "RightButton"],
|
|
1109
1398
|
[3, "Cancel"],
|
|
@@ -1296,48 +1585,48 @@ const Ne = _(un), ae = /* @__PURE__ */ new Map([
|
|
|
1296
1585
|
[252, "Noname"],
|
|
1297
1586
|
[253, "PA1"],
|
|
1298
1587
|
[254, "OEM_Clear"]
|
|
1299
|
-
]),
|
|
1588
|
+
]), De = new Map(le.entries().map(([s, e]) => [e, s])), Pr = L({
|
|
1300
1589
|
"[string]": {
|
|
1301
1590
|
keys: "string[]",
|
|
1302
|
-
mode:
|
|
1591
|
+
mode: L("'toggle' | 'hold'").pipe((s) => s ?? "toggle")
|
|
1303
1592
|
}
|
|
1304
1593
|
});
|
|
1305
|
-
class
|
|
1594
|
+
class Sr extends N {
|
|
1306
1595
|
constructor(t) {
|
|
1307
1596
|
super("KeybindManager");
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1597
|
+
l(this, "preferencesKeybindToCallbacks", /* @__PURE__ */ new Map());
|
|
1598
|
+
l(this, "pressedKeys", /* @__PURE__ */ new Set());
|
|
1599
|
+
l(this, "activeKeybinds", /* @__PURE__ */ new Set());
|
|
1600
|
+
l(this, "triggeredToggleKeybinds", /* @__PURE__ */ new Set());
|
|
1601
|
+
l(this, "boundHandleKeyboardFocus", this.handleKeyboardFocus.bind(this));
|
|
1602
|
+
l(this, "boundHandleKeyDown", this.handleKeyDown.bind(this));
|
|
1603
|
+
l(this, "boundHandleKeyUp", this.handleKeyUp.bind(this));
|
|
1604
|
+
l(this, "keybindsFile");
|
|
1316
1605
|
// TODO try to figure out a better way to handle this
|
|
1317
|
-
|
|
1318
|
-
this.keybindsFile = new
|
|
1319
|
-
path:
|
|
1320
|
-
schema:
|
|
1606
|
+
l(this, "keybindListeningPaused", !1);
|
|
1607
|
+
this.keybindsFile = new Et({
|
|
1608
|
+
path: St(["keybinds.json"]),
|
|
1609
|
+
schema: Pr,
|
|
1321
1610
|
default: t
|
|
1322
1611
|
});
|
|
1323
1612
|
}
|
|
1324
1613
|
init() {
|
|
1325
1614
|
super.init();
|
|
1326
|
-
const t =
|
|
1615
|
+
const t = $.getInstance().getInterface("OGG_SIEGE");
|
|
1327
1616
|
t.instance.on("keyboardFocus", this.boundHandleKeyboardFocus), t.instance.on("keyDown", this.boundHandleKeyDown), t.instance.on("keyUp", this.boundHandleKeyUp);
|
|
1328
1617
|
}
|
|
1329
1618
|
// TODO support multiple callbacks
|
|
1330
1619
|
async onKeybindToggled(t, r) {
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1620
|
+
const n = this.preferencesKeybindToCallbacks.get(t) || {};
|
|
1621
|
+
n.toggle = r, this.preferencesKeybindToCallbacks.set(t, n);
|
|
1333
1622
|
}
|
|
1334
1623
|
async onKeybindDown(t, r) {
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1624
|
+
const n = this.preferencesKeybindToCallbacks.get(t) || {};
|
|
1625
|
+
n.down = r, this.preferencesKeybindToCallbacks.set(t, n);
|
|
1337
1626
|
}
|
|
1338
1627
|
async onKeybindUp(t, r) {
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1628
|
+
const n = this.preferencesKeybindToCallbacks.get(t) || {};
|
|
1629
|
+
n.up = r, this.preferencesKeybindToCallbacks.set(t, n);
|
|
1341
1630
|
}
|
|
1342
1631
|
async updateKeybind(t, r) {
|
|
1343
1632
|
this.keybindsFile.set({
|
|
@@ -1346,7 +1635,7 @@ class hn extends G {
|
|
|
1346
1635
|
}
|
|
1347
1636
|
async updateKeybinds(t) {
|
|
1348
1637
|
const r = Object.fromEntries(
|
|
1349
|
-
Object.entries(t).filter(([
|
|
1638
|
+
Object.entries(t).filter(([n, i]) => i !== void 0)
|
|
1350
1639
|
);
|
|
1351
1640
|
this.keybindsFile.set({
|
|
1352
1641
|
...this.keybindsFile.get(),
|
|
@@ -1357,13 +1646,13 @@ class hn extends G {
|
|
|
1357
1646
|
return this.keybindsFile.get();
|
|
1358
1647
|
}
|
|
1359
1648
|
destroy() {
|
|
1360
|
-
const t =
|
|
1649
|
+
const t = $.getInstance().getInterface("OGG_SIEGE");
|
|
1361
1650
|
t.instance.off("keyboardFocus", this.boundHandleKeyboardFocus), t.instance.off("keyDown", this.boundHandleKeyDown), t.instance.off("keyUp", this.boundHandleKeyUp), super.destroy();
|
|
1362
1651
|
}
|
|
1363
1652
|
handleKeyDown(t) {
|
|
1364
1653
|
if (this.keybindListeningPaused)
|
|
1365
1654
|
return;
|
|
1366
|
-
const r =
|
|
1655
|
+
const r = le.get(t.key);
|
|
1367
1656
|
if (!r) {
|
|
1368
1657
|
this.logger.error("Unknown key down", t);
|
|
1369
1658
|
return;
|
|
@@ -1376,71 +1665,71 @@ class hn extends G {
|
|
|
1376
1665
|
async handleKeyUp(t) {
|
|
1377
1666
|
if (this.keybindListeningPaused)
|
|
1378
1667
|
return;
|
|
1379
|
-
const r =
|
|
1668
|
+
const r = le.get(t.key);
|
|
1380
1669
|
if (!r)
|
|
1381
1670
|
return;
|
|
1382
1671
|
this.pressedKeys.delete(r);
|
|
1383
|
-
const
|
|
1384
|
-
for (const [
|
|
1385
|
-
|
|
1672
|
+
const n = this.keybindsFile.get();
|
|
1673
|
+
for (const [i] of this.preferencesKeybindToCallbacks.entries())
|
|
1674
|
+
n[i].keys.includes(r) && this.triggeredToggleKeybinds.delete(i);
|
|
1386
1675
|
this.checkKeybindUps();
|
|
1387
1676
|
}
|
|
1388
1677
|
async checkKeybindUps() {
|
|
1389
1678
|
const t = this.keybindsFile.get();
|
|
1390
|
-
for (const [r,
|
|
1391
|
-
if (!
|
|
1392
|
-
const
|
|
1393
|
-
this.activeKeybinds.has(r) &&
|
|
1679
|
+
for (const [r, n] of this.preferencesKeybindToCallbacks.entries()) {
|
|
1680
|
+
if (!n.up) continue;
|
|
1681
|
+
const i = t[r];
|
|
1682
|
+
this.activeKeybinds.has(r) && i.keys.some((a) => !this.pressedKeys.has(a)) && (this.activeKeybinds.delete(r), n.up(), this.logger.log("Keybind up triggered", this.getKeybindToString(i)));
|
|
1394
1683
|
}
|
|
1395
1684
|
}
|
|
1396
1685
|
async checkKeybindings() {
|
|
1397
1686
|
const t = this.keybindsFile.get();
|
|
1398
|
-
for (const [r,
|
|
1399
|
-
const
|
|
1400
|
-
if (
|
|
1401
|
-
this.triggerKeybind(
|
|
1687
|
+
for (const [r, n] of this.preferencesKeybindToCallbacks.entries()) {
|
|
1688
|
+
const i = t[r];
|
|
1689
|
+
if (i.keys.length === this.pressedKeys.size && i.keys.every((o) => De.has(o) ? this.pressedKeys.has(o) : !1)) {
|
|
1690
|
+
this.triggerKeybind(i, n, r);
|
|
1402
1691
|
return;
|
|
1403
1692
|
}
|
|
1404
1693
|
}
|
|
1405
|
-
for (const [r,
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1694
|
+
for (const [r, n] of this.preferencesKeybindToCallbacks.entries()) {
|
|
1695
|
+
const i = t[r];
|
|
1696
|
+
i.keys.every((o) => De.has(o) ? this.pressedKeys.has(o) : (this.logger.error("Unknown key", o, i), !1)) && this.triggerKeybind(i, n, r);
|
|
1408
1697
|
}
|
|
1409
1698
|
}
|
|
1410
|
-
triggerKeybind(t, r,
|
|
1411
|
-
const
|
|
1412
|
-
if (
|
|
1413
|
-
const
|
|
1414
|
-
this.triggeredToggleKeybinds.add(
|
|
1415
|
-
|
|
1699
|
+
triggerKeybind(t, r, n) {
|
|
1700
|
+
const i = t.mode;
|
|
1701
|
+
if (i === "toggle" && r.toggle && !this.triggeredToggleKeybinds.has(n)) {
|
|
1702
|
+
const a = r.toggle();
|
|
1703
|
+
this.triggeredToggleKeybinds.add(n), this.logger.log(
|
|
1704
|
+
a ? `Keybind pressed rejected: ${a}` : "Keybind pressed accepted",
|
|
1416
1705
|
this.getKeybindToString(t)
|
|
1417
1706
|
);
|
|
1418
1707
|
}
|
|
1419
|
-
if (
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1708
|
+
if (i === "hold" && r.down && !this.activeKeybinds.has(n)) {
|
|
1709
|
+
const a = r.down();
|
|
1710
|
+
a ? this.logger.log(`Keybind down rejected: ${a}`, this.getKeybindToString(t)) : (this.activeKeybinds.add(n), this.logger.log("Keybind down accepted", this.getKeybindToString(t)));
|
|
1422
1711
|
}
|
|
1423
1712
|
}
|
|
1424
1713
|
getKeybindToString(t) {
|
|
1425
1714
|
return `(${t.keys.join("+")}${t.mode ? ` ${t.mode}` : ""})`;
|
|
1426
1715
|
}
|
|
1427
1716
|
}
|
|
1428
|
-
class
|
|
1717
|
+
class Cr extends Ne {
|
|
1429
1718
|
constructor(t) {
|
|
1430
1719
|
super("OverridesManager");
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
this.renderInterface =
|
|
1720
|
+
l(this, "renderInterface");
|
|
1721
|
+
l(this, "globalCursorOverrideCount", /* @__PURE__ */ new Set());
|
|
1722
|
+
l(this, "globalMouseBlockCount", /* @__PURE__ */ new Set());
|
|
1723
|
+
l(this, "globalKeyboardBlockCount", /* @__PURE__ */ new Set());
|
|
1724
|
+
l(this, "keyInputBlocks", {});
|
|
1725
|
+
this.renderInterface = $.getInstance().getInterface(t);
|
|
1437
1726
|
}
|
|
1438
1727
|
scope(t) {
|
|
1439
1728
|
return {
|
|
1440
1729
|
setGlobalCursorOverride: (r) => this.setGlobalCursorOverride(t, r),
|
|
1441
1730
|
setGlobalMouseBlock: (r) => this.setGlobalMouseBlock(t, r),
|
|
1442
1731
|
setGlobalKeyboardBlock: (r) => this.setGlobalKeyboardBlock(t, r),
|
|
1443
|
-
setKeyInputBlock: (r,
|
|
1732
|
+
setKeyInputBlock: (r, n) => this.setKeyInputBlock(t, r, n)
|
|
1444
1733
|
};
|
|
1445
1734
|
}
|
|
1446
1735
|
setGlobalCursorOverride(t, r) {
|
|
@@ -1452,38 +1741,39 @@ class gn extends Ae {
|
|
|
1452
1741
|
setGlobalKeyboardBlock(t, r) {
|
|
1453
1742
|
r ? this.globalKeyboardBlockCount.add(t) : this.globalKeyboardBlockCount.delete(t), r && this.globalKeyboardBlockCount.size === 1 ? this.renderInterface.instance.setGlobalKeyboardBlock(!0) : !r && this.globalKeyboardBlockCount.size === 0 && this.renderInterface.instance.setGlobalKeyboardBlock(!1);
|
|
1454
1743
|
}
|
|
1455
|
-
setKeyInputBlock(t, r,
|
|
1456
|
-
this.keyInputBlocks[r] || (this.keyInputBlocks[r] = /* @__PURE__ */ new Set()),
|
|
1744
|
+
setKeyInputBlock(t, r, n) {
|
|
1745
|
+
this.keyInputBlocks[r] || (this.keyInputBlocks[r] = /* @__PURE__ */ new Set()), n ? this.keyInputBlocks[r].add(t) : this.keyInputBlocks[r].delete(t), n && this.keyInputBlocks[r].size === 1 ? this.renderInterface.instance.setKeyInputBlock(r, !0) : !n && this.keyInputBlocks[r].size === 0 && this.renderInterface.instance.setKeyInputBlock(r, !1);
|
|
1457
1746
|
}
|
|
1458
1747
|
}
|
|
1459
|
-
const
|
|
1460
|
-
let
|
|
1461
|
-
function
|
|
1462
|
-
const { init: e = !0 } =
|
|
1463
|
-
if (
|
|
1464
|
-
return
|
|
1748
|
+
const Lr = E(Cr, "OGG_SIEGE");
|
|
1749
|
+
let z = !1, W;
|
|
1750
|
+
function ps(s) {
|
|
1751
|
+
const { init: e = !0 } = s;
|
|
1752
|
+
if (Kr(s), me.getInstance().init(s.appName), z)
|
|
1753
|
+
return W;
|
|
1465
1754
|
function t() {
|
|
1466
|
-
|
|
1467
|
-
const r = /* @__PURE__ */ new Map(),
|
|
1468
|
-
|
|
1469
|
-
...
|
|
1470
|
-
...
|
|
1471
|
-
keybinds:
|
|
1755
|
+
Tr(s);
|
|
1756
|
+
const r = /* @__PURE__ */ new Map(), n = Or(s.modules, r), i = Mr(), a = Ar(s.keybinds), o = Rr(), c = xr();
|
|
1757
|
+
Fr(), $r(s, r), z = !0, W = {
|
|
1758
|
+
...n,
|
|
1759
|
+
...i,
|
|
1760
|
+
keybinds: a,
|
|
1472
1761
|
windows: o,
|
|
1473
|
-
input:
|
|
1762
|
+
input: c,
|
|
1474
1763
|
hasAnyActiveProcesses: () => C.getInstance().hasAnyActiveProcesses,
|
|
1475
|
-
init: t
|
|
1764
|
+
init: t,
|
|
1765
|
+
initialized: z
|
|
1476
1766
|
};
|
|
1477
1767
|
}
|
|
1478
|
-
return e ? (t(),
|
|
1768
|
+
return e ? (t(), W) : new Proxy(
|
|
1479
1769
|
{
|
|
1480
1770
|
init: t
|
|
1481
1771
|
},
|
|
1482
1772
|
{
|
|
1483
|
-
get: (r,
|
|
1484
|
-
if (
|
|
1485
|
-
throw new Error(
|
|
1486
|
-
return
|
|
1773
|
+
get: (r, n) => {
|
|
1774
|
+
if (n !== "init" && !z)
|
|
1775
|
+
throw new Error(`overlayed was called before initialized: ${n}`);
|
|
1776
|
+
return n === "init" ? r[n] : W[n];
|
|
1487
1777
|
}
|
|
1488
1778
|
}
|
|
1489
1779
|
);
|
|
@@ -1493,58 +1783,58 @@ global.OVERLAYED = new Proxy({}, {
|
|
|
1493
1783
|
throw new Error("function overlayed was not called");
|
|
1494
1784
|
}
|
|
1495
1785
|
});
|
|
1496
|
-
function
|
|
1786
|
+
function Kr(s) {
|
|
1497
1787
|
global.OVERLAYED = {
|
|
1498
|
-
APP_NAME:
|
|
1788
|
+
APP_NAME: s.appName
|
|
1499
1789
|
};
|
|
1500
1790
|
}
|
|
1501
|
-
function
|
|
1502
|
-
|
|
1503
|
-
|
|
1791
|
+
function Fr() {
|
|
1792
|
+
Ye.getInstance().init(), B.getInstance().init(), C.getInstance().init(), T.getInstance().init(), xe.on("quit", () => {
|
|
1793
|
+
Dr();
|
|
1504
1794
|
});
|
|
1505
1795
|
}
|
|
1506
|
-
function
|
|
1507
|
-
T.getInstance().destroy(), B.getInstance().destroy(),
|
|
1796
|
+
function Dr() {
|
|
1797
|
+
T.getInstance().destroy(), B.getInstance().destroy(), Ye.getInstance().destroy(), C.getInstance().destroy(), $.getInstance().getInterface("OGG_SIEGE").destroy(), fe.getInstance().destroy(), I.getInstance().destroy();
|
|
1508
1798
|
}
|
|
1509
|
-
function
|
|
1510
|
-
return
|
|
1511
|
-
const
|
|
1512
|
-
return t[
|
|
1799
|
+
function Or(s, e) {
|
|
1800
|
+
return s.reduce((t, r) => {
|
|
1801
|
+
const n = r.key;
|
|
1802
|
+
return t[n] = {
|
|
1513
1803
|
// prettier-ignore
|
|
1514
|
-
on(
|
|
1515
|
-
const o =
|
|
1516
|
-
|
|
1804
|
+
on(i, a) {
|
|
1805
|
+
const o = F(n, i), c = e.get(o) ?? /* @__PURE__ */ new Set();
|
|
1806
|
+
c.add(a), e.set(o, c);
|
|
1517
1807
|
},
|
|
1518
|
-
onAny(
|
|
1519
|
-
const
|
|
1520
|
-
o.add(
|
|
1808
|
+
onAny(i) {
|
|
1809
|
+
const a = F(n, "*"), o = e.get(a) ?? /* @__PURE__ */ new Set();
|
|
1810
|
+
o.add(i), e.set(a, o);
|
|
1521
1811
|
},
|
|
1522
1812
|
// prettier-ignore
|
|
1523
|
-
off(
|
|
1524
|
-
const o =
|
|
1525
|
-
|
|
1813
|
+
off(i, a) {
|
|
1814
|
+
const o = F(n, i), c = e.get(o) ?? /* @__PURE__ */ new Set();
|
|
1815
|
+
c.delete(a), e.set(o, c);
|
|
1526
1816
|
},
|
|
1527
1817
|
// prettier-ignore
|
|
1528
|
-
offAny(
|
|
1529
|
-
const
|
|
1530
|
-
o.delete(
|
|
1818
|
+
offAny(i) {
|
|
1819
|
+
const a = F(n, "*"), o = e.get(a) ?? /* @__PURE__ */ new Set();
|
|
1820
|
+
o.delete(i), e.set(a, o);
|
|
1531
1821
|
}
|
|
1532
1822
|
}, t;
|
|
1533
1823
|
}, {});
|
|
1534
1824
|
}
|
|
1535
|
-
function
|
|
1536
|
-
const
|
|
1825
|
+
function Mr() {
|
|
1826
|
+
const s = I.getInstance(), e = B.getInstance();
|
|
1537
1827
|
return {
|
|
1538
1828
|
on: (t, r) => {
|
|
1539
1829
|
switch (t) {
|
|
1540
1830
|
case "fatal":
|
|
1541
|
-
|
|
1831
|
+
s.on("fatal", r);
|
|
1542
1832
|
break;
|
|
1543
1833
|
case "error":
|
|
1544
|
-
|
|
1834
|
+
s.on("error", r);
|
|
1545
1835
|
break;
|
|
1546
1836
|
case "warning":
|
|
1547
|
-
|
|
1837
|
+
s.on("warning", r);
|
|
1548
1838
|
break;
|
|
1549
1839
|
case "gameLaunch":
|
|
1550
1840
|
e.on("gameLaunch", r);
|
|
@@ -1559,13 +1849,13 @@ function vn() {
|
|
|
1559
1849
|
off: (t, r) => {
|
|
1560
1850
|
switch (t) {
|
|
1561
1851
|
case "fatal":
|
|
1562
|
-
|
|
1852
|
+
s.off("fatal", r);
|
|
1563
1853
|
break;
|
|
1564
1854
|
case "error":
|
|
1565
|
-
|
|
1855
|
+
s.off("error", r);
|
|
1566
1856
|
break;
|
|
1567
1857
|
case "warning":
|
|
1568
|
-
|
|
1858
|
+
s.off("warning", r);
|
|
1569
1859
|
break;
|
|
1570
1860
|
case "gameLaunch":
|
|
1571
1861
|
e.off("gameLaunch", r);
|
|
@@ -1579,57 +1869,57 @@ function vn() {
|
|
|
1579
1869
|
}
|
|
1580
1870
|
};
|
|
1581
1871
|
}
|
|
1582
|
-
function
|
|
1583
|
-
return `${
|
|
1872
|
+
function F(s, e) {
|
|
1873
|
+
return `${s}:${e}`;
|
|
1584
1874
|
}
|
|
1585
|
-
function
|
|
1586
|
-
const t =
|
|
1587
|
-
function r(
|
|
1588
|
-
const
|
|
1589
|
-
if (
|
|
1875
|
+
function $r(s, e) {
|
|
1876
|
+
const t = fe.getInstance();
|
|
1877
|
+
function r(n) {
|
|
1878
|
+
const i = Ct(n);
|
|
1879
|
+
if (i instanceof L.errors) {
|
|
1590
1880
|
I.getInstance().warn("Invalid event", "INVALID_EVENT", {
|
|
1591
|
-
summary:
|
|
1881
|
+
summary: i.summary
|
|
1592
1882
|
});
|
|
1593
1883
|
return;
|
|
1594
1884
|
}
|
|
1595
|
-
const
|
|
1885
|
+
const a = s.modules.find((p) => p.key === i.game), o = a == null ? void 0 : a.events.event;
|
|
1596
1886
|
if (!o)
|
|
1597
1887
|
return;
|
|
1598
|
-
const
|
|
1599
|
-
if (
|
|
1888
|
+
const c = o(n);
|
|
1889
|
+
if (c instanceof L.errors) {
|
|
1600
1890
|
I.getInstance().warn("Invalid event", "INVALID_EVENT", {
|
|
1601
|
-
summary:
|
|
1891
|
+
summary: c.summary
|
|
1602
1892
|
});
|
|
1603
1893
|
return;
|
|
1604
1894
|
}
|
|
1605
|
-
const
|
|
1606
|
-
|
|
1607
|
-
|
|
1895
|
+
const u = F(a.key, c.type), d = F(a.key, "*"), g = e.get(u), h = e.get(d), y = [...Array.from(g ?? []), ...Array.from(h ?? [])];
|
|
1896
|
+
y.length !== 0 && y.forEach((p) => {
|
|
1897
|
+
p(c);
|
|
1608
1898
|
});
|
|
1609
1899
|
}
|
|
1610
|
-
return t.on("data", (
|
|
1900
|
+
return t.on("data", (n) => n.forEach(r)), t.on("error", (n) => {
|
|
1611
1901
|
I.getInstance().error("Pipe server error", "PIPE_SERVER_ERROR", {
|
|
1612
|
-
error:
|
|
1902
|
+
error: n
|
|
1613
1903
|
});
|
|
1614
1904
|
}), t;
|
|
1615
1905
|
}
|
|
1616
|
-
function
|
|
1617
|
-
const e = new
|
|
1618
|
-
for (const
|
|
1619
|
-
t[
|
|
1620
|
-
on: (
|
|
1621
|
-
switch (
|
|
1906
|
+
function Ar(s) {
|
|
1907
|
+
const e = new Sr(s), t = {};
|
|
1908
|
+
for (const n in s)
|
|
1909
|
+
t[n] = {
|
|
1910
|
+
on: (i, a) => {
|
|
1911
|
+
switch (i) {
|
|
1622
1912
|
case "down":
|
|
1623
|
-
e.onKeybindDown(
|
|
1913
|
+
e.onKeybindDown(n, a);
|
|
1624
1914
|
break;
|
|
1625
1915
|
case "up":
|
|
1626
|
-
e.onKeybindUp(
|
|
1916
|
+
e.onKeybindUp(n, a);
|
|
1627
1917
|
break;
|
|
1628
1918
|
case "toggle":
|
|
1629
|
-
e.onKeybindToggled(
|
|
1919
|
+
e.onKeybindToggled(n, a);
|
|
1630
1920
|
break;
|
|
1631
1921
|
default:
|
|
1632
|
-
throw new Error(`Event type not implemented ${
|
|
1922
|
+
throw new Error(`Event type not implemented ${i}`, { cause: [i, a] });
|
|
1633
1923
|
}
|
|
1634
1924
|
}
|
|
1635
1925
|
};
|
|
@@ -1642,76 +1932,76 @@ function En(n) {
|
|
|
1642
1932
|
resumeKeybindListening: () => {
|
|
1643
1933
|
e.keybindListeningPaused = !1;
|
|
1644
1934
|
},
|
|
1645
|
-
updateKeybind: (
|
|
1646
|
-
e.updateKeybind(
|
|
1935
|
+
updateKeybind: (n, i) => {
|
|
1936
|
+
e.updateKeybind(n, i);
|
|
1647
1937
|
},
|
|
1648
|
-
updateKeybinds: (
|
|
1649
|
-
e.updateKeybinds(
|
|
1938
|
+
updateKeybinds: (n) => {
|
|
1939
|
+
e.updateKeybinds(n);
|
|
1650
1940
|
}
|
|
1651
1941
|
};
|
|
1652
|
-
return e.init(),
|
|
1942
|
+
return e.init(), xe.on("quit", () => {
|
|
1653
1943
|
e.destroy();
|
|
1654
1944
|
}), r;
|
|
1655
1945
|
}
|
|
1656
|
-
function
|
|
1946
|
+
function Rr() {
|
|
1657
1947
|
return {
|
|
1658
|
-
createWindow: (
|
|
1659
|
-
on: (
|
|
1660
|
-
off: (
|
|
1661
|
-
once: (
|
|
1662
|
-
addListener: (
|
|
1663
|
-
removeListener: (
|
|
1664
|
-
removeAllListeners: () =>
|
|
1665
|
-
prependListener: (
|
|
1666
|
-
prependOnceListener: (
|
|
1948
|
+
createWindow: (s) => m().instance.newWindowInternal(at.BrowserWindow, s),
|
|
1949
|
+
on: (s, e) => m().instance.on(s, e),
|
|
1950
|
+
off: (s, e) => m().instance.off(s, e),
|
|
1951
|
+
once: (s, e) => m().instance.once(s, e),
|
|
1952
|
+
addListener: (s, e) => m().instance.addListener(s, e),
|
|
1953
|
+
removeListener: (s, e) => m().instance.removeListener(s, e),
|
|
1954
|
+
removeAllListeners: () => m().instance.removeAllListeners(),
|
|
1955
|
+
prependListener: (s, e) => m().instance.prependListener(s, e),
|
|
1956
|
+
prependOnceListener: (s, e) => m().instance.prependOnceListener(s, e),
|
|
1667
1957
|
getActiveGameInfo: () => {
|
|
1668
|
-
const
|
|
1958
|
+
const s = m(), e = fe.getInstance();
|
|
1669
1959
|
return {
|
|
1670
|
-
resolution:
|
|
1960
|
+
resolution: s.resolution,
|
|
1671
1961
|
isConnected: e.hasConnection
|
|
1672
1962
|
};
|
|
1673
1963
|
}
|
|
1674
1964
|
};
|
|
1675
1965
|
}
|
|
1676
|
-
function
|
|
1966
|
+
function xr() {
|
|
1677
1967
|
return {
|
|
1678
|
-
scope: (
|
|
1968
|
+
scope: (s) => Lr.getInstance().scope(s),
|
|
1679
1969
|
raw: {
|
|
1680
|
-
setGlobalMouseBlock: (
|
|
1681
|
-
setGlobalKeyboardBlock: (
|
|
1682
|
-
setGlobalCursorOverride: (
|
|
1683
|
-
setKeyInputBlock: (
|
|
1684
|
-
getGlobalMouseBlock: () =>
|
|
1685
|
-
getGlobalKeyboardBlock: () =>
|
|
1686
|
-
getGlobalCursorOverride: () =>
|
|
1687
|
-
getKeyInputBlock: (
|
|
1970
|
+
setGlobalMouseBlock: (s) => m().instance.setGlobalMouseBlock(s),
|
|
1971
|
+
setGlobalKeyboardBlock: (s) => m().instance.setGlobalKeyboardBlock(s),
|
|
1972
|
+
setGlobalCursorOverride: (s) => m().instance.setGlobalCursorOverride(s),
|
|
1973
|
+
setKeyInputBlock: (s, e) => m().instance.setKeyInputBlock(s, e),
|
|
1974
|
+
getGlobalMouseBlock: () => m().instance.getGlobalMouseBlock(),
|
|
1975
|
+
getGlobalKeyboardBlock: () => m().instance.getGlobalKeyboardBlock(),
|
|
1976
|
+
getGlobalCursorOverride: () => m().instance.getGlobalCursorOverride(),
|
|
1977
|
+
getKeyInputBlock: (s) => m().instance.getKeyInputBlock(s)
|
|
1688
1978
|
}
|
|
1689
1979
|
};
|
|
1690
1980
|
}
|
|
1691
|
-
function
|
|
1692
|
-
|
|
1693
|
-
|
|
1981
|
+
function Tr(s) {
|
|
1982
|
+
S.getInstance().clientId = s.appName, S.getInstance().userId = hr.generateUniqueIdentifier(), I.getInstance().on("fatal", (e) => {
|
|
1983
|
+
S.getInstance().track("fatal", {
|
|
1694
1984
|
message: e.message,
|
|
1695
1985
|
code: e.code,
|
|
1696
1986
|
data: e.data
|
|
1697
1987
|
});
|
|
1698
1988
|
}), I.getInstance().on("error", (e) => {
|
|
1699
|
-
|
|
1989
|
+
S.getInstance().track("error", {
|
|
1700
1990
|
message: e.message,
|
|
1701
1991
|
code: e.code,
|
|
1702
1992
|
data: e.data
|
|
1703
1993
|
});
|
|
1704
1994
|
}), I.getInstance().on("warning", (e) => {
|
|
1705
|
-
|
|
1995
|
+
S.getInstance().track("warning", {
|
|
1706
1996
|
message: e.message,
|
|
1707
1997
|
code: e.code,
|
|
1708
1998
|
data: e.data
|
|
1709
1999
|
});
|
|
1710
2000
|
});
|
|
1711
2001
|
}
|
|
1712
|
-
function
|
|
1713
|
-
return
|
|
2002
|
+
function m() {
|
|
2003
|
+
return $.getInstance().getInterface("OGG_SIEGE");
|
|
1714
2004
|
}
|
|
1715
2005
|
export {
|
|
1716
|
-
|
|
2006
|
+
ps as overlayed
|
|
1717
2007
|
};
|