vrchat 1.19.1 → 1.19.4

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/base.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * VRChat API Documentation
5
5
  *
6
- * The version of the OpenAPI document: 1.19.1
6
+ * The version of the OpenAPI document: 1.19.4
7
7
  * Contact: vrchatapi.lpv0t@aries.fyi
8
8
  *
9
9
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/common.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * VRChat API Documentation
5
5
  *
6
- * The version of the OpenAPI document: 1.19.1
6
+ * The version of the OpenAPI document: 1.19.4
7
7
  * Contact: vrchatapi.lpv0t@aries.fyi
8
8
  *
9
9
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/configuration.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * VRChat API Documentation
5
5
  *
6
- * The version of the OpenAPI document: 1.19.1
6
+ * The version of the OpenAPI document: 1.19.4
7
7
  * Contact: vrchatapi.lpv0t@aries.fyi
8
8
  *
9
9
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
package/cookies_load.js CHANGED
@@ -1,20 +1,36 @@
1
1
  const vrchat = require("vrchat");
2
2
 
3
+ const readline = require("readline")
4
+
5
+ const tough = require("tough-cookie");
6
+ const fs = require("fs");
7
+
8
+ const COOKIE_FILE = "cookies.json";
9
+ let cookieJar = new tough.CookieJar();
10
+
11
+ if (fs.existsSync(COOKIE_FILE)) {
12
+ const serializedCookies = fs.readFileSync(COOKIE_FILE, "utf-8");
13
+ cookieJar = tough.CookieJar.deserializeSync(JSON.parse(serializedCookies));
14
+ }
15
+
3
16
  const configuration = new vrchat.Configuration({
4
17
  username: "username",
5
18
  password: "password",
6
19
  baseOptions: {
7
20
  headers: {
8
- "User-Agent": "ExampleProgram/0.0.1 my@email.com"
9
- "Cookie": "auth=[AUTH_COOKIE_HERE]; twoFactorAuth=[TWO_FACTOR_AUTH_COOKIE_HERE]}"
10
- }
21
+ "User-Agent": "ExampleProgram/0.0.1 my@email.com",
22
+ // Use this instead of jar if you want to hard code cookies
23
+ // "Cookie": "auth=[AUTH_COOKIE_HERE]; twoFactorAuth=[TWO_FACTOR_AUTH_COOKIE_HERE]"
24
+ },
25
+ jar: cookieJar,
11
26
  }
12
27
  });
13
28
 
14
- const AuthenticationApi = new vrchat.AuthenticationApi(configuration);
29
+
30
+ const authenticationApi = new AuthenticationApi(configuration);
15
31
 
16
32
  async function main() {
17
- const currentUser = (await AuthenticationApi.getCurrentUser()).data;
33
+ var currentUser = (await authenticationApi.getCurrentUser()).data
18
34
  console.log(`Logged in as: ${currentUser.displayName}`);
19
35
  }
20
36
 
package/cookies_store.js CHANGED
@@ -1,17 +1,23 @@
1
1
  const vrchat = require("vrchat");
2
2
 
3
3
  const readline = require("readline")
4
- import globalAxios from "axios"
5
4
 
6
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
5
+ const tough = require("tough-cookie");
6
+ const fs = require("fs");
7
+
8
+ const rl = readline.createInterface({input: process.stdin, output: process.stdout});
7
9
  const prompt = (query) => new Promise((resolve) => rl.question(query, resolve));
8
10
 
9
11
 
12
+ const COOKIE_FILE = "cookies.json";
13
+ let cookieJar = new tough.CookieJar();
14
+
10
15
  const configuration = new vrchat.Configuration({
11
16
  username: "username",
12
17
  password: "password",
13
18
  baseOptions: {
14
- headers: { "User-Agent": "ExampleProgram/0.0.1 my@email.com"}
19
+ headers: { "User-Agent": "ExampleProgram/0.0.1 my@email.com"},
20
+ jar: cookieJar,
15
21
  }
16
22
  });
17
23
 
@@ -32,9 +38,13 @@ async function main() {
32
38
 
33
39
  console.log(`Logged in as: ${currentUser.displayName}`);
34
40
 
35
- const store = globalAxios.defaults.jar.store.idx["api.vrchat.cloud"]["/"];
36
- console.log(`auth=${store["auth"]["value"]}`)
37
- console.log(`twoFactorAuth=${store["twoFactorAuth"]["value"]}`)
41
+ const serializedJar = JSON.stringify(cookieJar.serializeSync());
42
+ fs.writeFileSync(COOKIE_FILE, serializedJar);
43
+
44
+ const deserializedJar = tough.CookieJar.deserializeSync(serializedJar);
45
+ const store = deserializedJar.store.idx["api.vrchat.cloud"]["/"];
46
+ console.log(`auth=${store["auth"]["value"]}`);
47
+ console.log(`twoFactorAuth=${store["twoFactorAuth"]["value"]}`);
38
48
  }
39
49
 
40
50
  main();