steamutils 1.4.39 → 1.4.41
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/SteamClient.js +3 -5
- package/create_proto.js +96 -47
- package/full_steamproto.js +16128 -0
- package/package.json +1 -1
- package/steamproto.js +326 -6159
package/SteamClient.js
CHANGED
|
@@ -939,12 +939,10 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
|
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
_clientWelcome = obj;
|
|
943
|
-
|
|
942
|
+
_clientWelcome = { ...obj };
|
|
943
|
+
_clientWelcome.items = {};
|
|
944
944
|
|
|
945
|
-
|
|
946
|
-
_clientWelcome.items = {};
|
|
947
|
-
}, 10000);
|
|
945
|
+
callEvent(events.csgoOnline, obj);
|
|
948
946
|
|
|
949
947
|
if (isPartyRegister) {
|
|
950
948
|
partyRegister();
|
package/create_proto.js
CHANGED
|
@@ -1,47 +1,96 @@
|
|
|
1
|
-
import helpers, { loadProfos } from "./helpers/protos.js";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import Protobuf from "protobufjs";
|
|
5
|
-
import fs from "fs";
|
|
6
|
-
|
|
7
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import helpers, { loadProfos } from "./helpers/protos.js";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import Protobuf from "protobufjs";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const shortfileName = "steamproto.js";
|
|
9
|
+
const fullfileName = "full_steamproto.js";
|
|
10
|
+
|
|
11
|
+
function main() {
|
|
12
|
+
const rootDir = `${__dirname}/protos/`;
|
|
13
|
+
const Protos = helpers([
|
|
14
|
+
{
|
|
15
|
+
name: "csgo",
|
|
16
|
+
protos: loadProfos(rootDir),
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
const content = fs.readFileSync("_steamproto.js", { encoding: "utf8", flag: "r" });
|
|
21
|
+
|
|
22
|
+
fs.writeFileSync(shortfileName, `${content}\nexport const SteamProtoType = {};export const ESteamProto = {};`);
|
|
23
|
+
fs.writeFileSync(fullfileName, `${content}\nexport const SteamProtoType = {};export const ESteamProto = {};`);
|
|
24
|
+
|
|
25
|
+
for (const key in Protos.csgo) {
|
|
26
|
+
let csgo = Protos.csgo[key];
|
|
27
|
+
if (typeof csgo === "function" || typeof csgo === "boolean" || typeof csgo === "string" || Array.isArray(csgo) || csgo === null) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (csgo instanceof Protobuf.Type) {
|
|
32
|
+
const fields = {};
|
|
33
|
+
for (const fieldsKey in csgo.fields) {
|
|
34
|
+
fields[fieldsKey] = fieldsKey;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const filename = path.relative(rootDir, csgo.filename);
|
|
38
|
+
const text = `SteamProtoType.${key} = ${JSON.stringify({ name: csgo.name, filename })};`;
|
|
39
|
+
fs.appendFileSync(fullfileName, text);
|
|
40
|
+
if (hasKeyDir(key, __dirname)) {
|
|
41
|
+
fs.appendFileSync(shortfileName, text);
|
|
42
|
+
}
|
|
43
|
+
} else {
|
|
44
|
+
for (const csgoKey in csgo) {
|
|
45
|
+
if (csgo[csgoKey] instanceof Protobuf.Enum) {
|
|
46
|
+
const values = csgo[csgoKey].values;
|
|
47
|
+
fs.appendFileSync(fullfileName, `ESteamProto.${csgoKey} = ${JSON.stringify(values)};`);
|
|
48
|
+
|
|
49
|
+
for (const valuesKey in values) {
|
|
50
|
+
if (!hasKeyDir(`${csgoKey}.${valuesKey}`, __dirname)) {
|
|
51
|
+
delete values[valuesKey];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (Object.keys(values).length) {
|
|
55
|
+
fs.appendFileSync(shortfileName, `ESteamProto.${csgoKey} = ${JSON.stringify(values)};`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const ignoreFiles = ["create_remote_file.js", shortfileName, fullfileName];
|
|
64
|
+
|
|
65
|
+
export function hasKeyDir(key, dir) {
|
|
66
|
+
const currentDir = fs.readdirSync(dir);
|
|
67
|
+
for (const currentFile of currentDir) {
|
|
68
|
+
if (!["SteamClient.js", "index.js"].includes(currentFile)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const _dir = path.join(dir, currentFile);
|
|
73
|
+
const isDirectory = fs.lstatSync(_dir).isDirectory();
|
|
74
|
+
if (isDirectory) {
|
|
75
|
+
if (currentFile !== "node_modules") {
|
|
76
|
+
if (hasKeyDir(key, _dir)) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
if (currentFile.endsWith(".js") && !ignoreFiles.includes(currentFile)) {
|
|
82
|
+
if (hasKeyFile(key, _dir)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function hasKeyFile(key, file) {
|
|
92
|
+
const content = fs.readFileSync(file);
|
|
93
|
+
return content.includes(key);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
main();
|