summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-08-07 16:46:40 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-08-07 16:46:40 +1000
commitdb777541ccba1a974d4f3d21d4536aad5742ea25 (patch)
tree837d8b3f7a02a5b280833d9397432d5088f0ffc4
parentgenerate openapi (diff)
downloadserver-db777541ccba1a974d4f3d21d4536aad5742ea25.tar.xz
add login script
-rw-r--r--scripts/stress/identify.js2
-rw-r--r--scripts/stress/login.js17
2 files changed, 18 insertions, 1 deletions
diff --git a/scripts/stress/identify.js b/scripts/stress/identify.js
index 9c74c634..2a271bbc 100644
--- a/scripts/stress/identify.js
+++ b/scripts/stress/identify.js
@@ -3,7 +3,7 @@
 require("dotenv").config();
 const { OPCODES } = require("../../dist/gateway/util/Constants.js");
 const WebSocket = require("ws");
-const ENDPOINT = `ws://localhost:3002?v=9&encoding=json`;
+const ENDPOINT = `ws://localhost:3001?v=9&encoding=json`;
 const TOKEN = process.env.TOKEN;
 const TOTAL_ITERATIONS = process.env.ITER ? parseInt(process.env.ITER) : 500;
 
diff --git a/scripts/stress/login.js b/scripts/stress/login.js
new file mode 100644
index 00000000..473e2e95
--- /dev/null
+++ b/scripts/stress/login.js
@@ -0,0 +1,17 @@
+const fetch = require("node-fetch");
+const ENDPOINT = process.env.API || "http://localhost:3001";
+
+async function main() {
+	const ret = await fetch(`${ENDPOINT}/api/auth/login`, {
+		method: "POST",
+		body: JSON.stringify({
+			login: process.argv[2],
+			password: process.argv[3],
+		}),
+		headers: { "content-type": "application/json " },
+	});
+
+	console.log((await ret.json()).token);
+}
+
+main();