steamutils 1.5.55 → 1.5.56
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/.idea/gbrowser_project.xml +15 -0
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/prettier.xml +1 -0
- package/SteamClient.js +3159 -3159
- package/_steamproto.js +56 -56
- package/const.js +582 -582
- package/full_steamproto.js +2 -7
- package/index.js +8783 -8783
- package/package.json +1 -1
- package/parse_html.js +61 -0
- package/race.js +2241 -0
- package/remote.js +2503 -2503
- package/steamproto.js +57 -57
- package/utils.js +1311 -1311
package/_steamproto.js
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
import path from "path";
|
2
|
-
import { fileURLToPath } from "url";
|
3
|
-
import Protobuf from "protobufjs";
|
4
|
-
import gpf from "google-proto-files";
|
5
|
-
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
7
|
-
const __dirname = path.dirname(__filename);
|
8
|
-
|
9
|
-
export class SteamProto {
|
10
|
-
constructor(proto) {
|
11
|
-
this._proto = proto;
|
12
|
-
}
|
13
|
-
|
14
|
-
toProto() {
|
15
|
-
const localProto = path.join(`${__dirname}/protos/`, this._proto.filename);
|
16
|
-
|
17
|
-
const descriptorPath = gpf.getProtoPath("protobuf/descriptor.proto");
|
18
|
-
|
19
|
-
const root = new Protobuf.Root().loadSync([descriptorPath, localProto], {
|
20
|
-
keepCase: true,
|
21
|
-
});
|
22
|
-
return root.lookupType(this._proto.name);
|
23
|
-
}
|
24
|
-
|
25
|
-
protoEncode(obj) {
|
26
|
-
const protobuf = this.toProto();
|
27
|
-
return protobuf.encode(protobuf.create(obj)).finish();
|
28
|
-
}
|
29
|
-
|
30
|
-
protoEncodeBase64(obj) {
|
31
|
-
return this.protoEncode(obj).toString("base64");
|
32
|
-
}
|
33
|
-
|
34
|
-
protoDecode(obj) {
|
35
|
-
if (isBase64(obj)) {
|
36
|
-
obj = Buffer.from(obj, "base64");
|
37
|
-
}
|
38
|
-
|
39
|
-
const protobuf = this.toProto();
|
40
|
-
try {
|
41
|
-
return protobuf.toObject(protobuf.decode(obj), { defaults: true });
|
42
|
-
} catch (e) {
|
43
|
-
console.error(`[${this._proto.name}] protoDecode 1`, typeof obj, obj);
|
44
|
-
console.error(`[${this._proto.name}] protoDecode 2`, e);
|
45
|
-
return null;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
function isBase64(str) {
|
51
|
-
if (typeof str !== "string") return false;
|
52
|
-
// remove whitespace and check
|
53
|
-
str = str.trim();
|
54
|
-
// base64 should only contain A-Z, a-z, 0-9, +, /, and possibly = at the end
|
55
|
-
return /^[A-Za-z0-9+/]+={0,2}$/.test(str) && str.length % 4 === 0;
|
56
|
-
}
|
1
|
+
import path from "path";
|
2
|
+
import { fileURLToPath } from "url";
|
3
|
+
import Protobuf from "protobufjs";
|
4
|
+
import gpf from "google-proto-files";
|
5
|
+
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
7
|
+
const __dirname = path.dirname(__filename);
|
8
|
+
|
9
|
+
export class SteamProto {
|
10
|
+
constructor(proto) {
|
11
|
+
this._proto = proto;
|
12
|
+
}
|
13
|
+
|
14
|
+
toProto() {
|
15
|
+
const localProto = path.join(`${__dirname}/protos/`, this._proto.filename);
|
16
|
+
|
17
|
+
const descriptorPath = gpf.getProtoPath("protobuf/descriptor.proto");
|
18
|
+
|
19
|
+
const root = new Protobuf.Root().loadSync([descriptorPath, localProto], {
|
20
|
+
keepCase: true,
|
21
|
+
});
|
22
|
+
return root.lookupType(this._proto.name);
|
23
|
+
}
|
24
|
+
|
25
|
+
protoEncode(obj) {
|
26
|
+
const protobuf = this.toProto();
|
27
|
+
return protobuf.encode(protobuf.create(obj)).finish();
|
28
|
+
}
|
29
|
+
|
30
|
+
protoEncodeBase64(obj) {
|
31
|
+
return this.protoEncode(obj).toString("base64");
|
32
|
+
}
|
33
|
+
|
34
|
+
protoDecode(obj) {
|
35
|
+
if (isBase64(obj)) {
|
36
|
+
obj = Buffer.from(obj, "base64");
|
37
|
+
}
|
38
|
+
|
39
|
+
const protobuf = this.toProto();
|
40
|
+
try {
|
41
|
+
return protobuf.toObject(protobuf.decode(obj), { defaults: true });
|
42
|
+
} catch (e) {
|
43
|
+
console.error(`[${this._proto.name}] protoDecode 1`, typeof obj, obj);
|
44
|
+
console.error(`[${this._proto.name}] protoDecode 2`, e);
|
45
|
+
return null;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
function isBase64(str) {
|
51
|
+
if (typeof str !== "string") return false;
|
52
|
+
// remove whitespace and check
|
53
|
+
str = str.trim();
|
54
|
+
// base64 should only contain A-Z, a-z, 0-9, +, /, and possibly = at the end
|
55
|
+
return /^[A-Za-z0-9+/]+={0,2}$/.test(str) && str.length % 4 === 0;
|
56
|
+
}
|