From 58d1f71718f158616541a29c55f17d0391dc78fe Mon Sep 17 00:00:00 2001
From: TooYoungTooSimp <6648049+TooYoungTooSimp@users.noreply.github.com>
Date: Sat, 5 Jun 2021 09:48:36 +0800
Subject: [PATCH] Sat, 05 Jun 2021 09:48:35 GMT
---
.gitignore | 2 +-
src/config.js | 10 ++++++++++
src/config.ts | 13 +++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 src/config.js
create mode 100644 src/config.ts
diff --git a/.gitignore b/.gitignore
index db4cad6..22454b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-config.*
+config.json
# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,node
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,visualstudiocode,node
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 0000000..d384ad6
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,10 @@
+"use strict";
+///
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.users = void 0;
+var fs_1 = require("fs");
+var path_1 = require("path");
+var config = JSON.parse(fs_1.readFileSync(path_1.join(__dirname, "../config.json"), { encoding: "utf-8" }));
+var users_raw = config.users_raw;
+var users = Object.fromEntries(users_raw.flatMap(function (arr, i) { return arr.map(function (v) { return [v, i + 1]; }); }));
+exports.users = users;
diff --git a/src/config.ts b/src/config.ts
new file mode 100644
index 0000000..517f613
--- /dev/null
+++ b/src/config.ts
@@ -0,0 +1,13 @@
+///
+
+import { readFileSync } from "fs";
+import { join } from "path";
+
+const config = JSON.parse(readFileSync(join(__dirname, "../config.json"), { encoding: "utf-8" }));
+
+const users_raw: string[][] = config.users_raw;
+let users = Object.fromEntries(users_raw.flatMap((arr, i) => arr.map(v => [v, i + 1])))
+
+const teacher_pass: string = config.teacher_pass;
+
+export { users, teacher_pass };
\ No newline at end of file