diff --git a/.adonisrc.json b/.adonisrc.json
index f7767e2..6bce9d9 100644
--- a/.adonisrc.json
+++ b/.adonisrc.json
@@ -20,7 +20,9 @@
"providers": [
"./providers/AppProvider",
"@adonisjs/core",
- "@adonisjs/lucid"
+ "@adonisjs/lucid",
+ "@adonisjs/auth",
+ "@adonisjs/session"
],
"aceProviders": [
"@adonisjs/repl"
diff --git a/.env.example b/.env.example
index f533e03..23809fa 100644
--- a/.env.example
+++ b/.env.example
@@ -9,3 +9,4 @@ MYSQL_PORT=3306
MYSQL_USER=lucid
MYSQL_PASSWORD=
MYSQL_DB_NAME=lucid
+SESSION_DRIVER=cookie
diff --git a/app/Controllers/Http/ErpsController.ts b/app/Controllers/Http/ErpsController.ts
new file mode 100644
index 0000000..682c6a5
--- /dev/null
+++ b/app/Controllers/Http/ErpsController.ts
@@ -0,0 +1,305 @@
+import fs from "fs";
+import type { HttpContextContract } from "@ioc:Adonis/Core/HttpContext";
+import axios from "axios";
+
+export default class ErpsController {
+ /**
+ * Controller do tim cac serial number trong cac log trong khoang thoi gian xac dinh
+ * @param {Integer} from thoi gian bat dau YYYYMMDD (vd: 20230130)
+ * @param {Integer} to thoi gian ket thuc YYYYMMDD (vd: 20230230)
+ */
+ public async getIndexSerialNumber({
+ request,
+ response,
+ }: HttpContextContract) {
+ const { from, to } = request.all();
+ const getListLog = async (from, to) => {
+ try {
+ // console.log("check!")
+ const listLog:string[] = []
+ const response = await axios.get("http://192.168.5.7:8080/");
+ const data = response.data;
+ const arrayLine = data
+ .split("\n")
+ .filter((i) => i.search(" {
+ let temp = u
+ .slice(u.search(""))
+ .split(">")[1];
+
+ if (
+ parseInt(temp?.split("-")[0]) >= from &&
+ parseInt(temp?.split("-")[0]) <= to
+ ) {
+ listLog.push(
+ "http://192.168.5.7:8080/" +
+ u.slice(u.search("")).split(">")[1] +
+ " "
+ );
+ }
+ });
+
+ return listLog;
+ } catch (error) {
+ console.log(error);
+ }
+ };
+
+ const fetchFiles = async (from, to) => {
+ try {
+ const urls = await getListLog(from, to);
+ let report = [];
+ const fileContents = await Promise.all(
+ urls.map(async (url) => {
+ const maxRetries = 10;
+ let retries = 0;
+ while (retries < maxRetries) {
+ try {
+ const response = await axios.get(url?.split(" ")[0]);
+ return response.data;
+ } catch (error) {
+ if (error.code !== "") {
+ //=== "ETIMEDOUT" || error.code === "ECONNRESET"
+ // console.log("Connection timed out. Retrying...");
+ retries++;
+ } else {
+ console.error("Error fetching file:", error);
+ return;
+ }
+ }
+ }
+ })
+ );
+
+ // Handle the file contents
+ fileContents.forEach((content, index) => {
+ console.log(`Content of file ${index + 1}:`);
+ const arrayLine = content?.split("\n");
+ let output = [];
+ if (arrayLine !== undefined) {
+ for (let i = 0; i < arrayLine.length; i++) {
+ if (
+ arrayLine[i].search("PID:") !== -1 &&
+ arrayLine[i].search("SN:") !== -1 &&
+ arrayLine[i].search("%") === -1 &&
+ arrayLine[i]
+ ?.split(",")[2]
+ ?.split(":")[1]
+ ?.replace("\r", "")
+ .trim() !== "" &&
+ arrayLine[i]
+ ?.split(",")[2]
+ ?.split(":")[1]
+ ?.replace("\r", "")
+ .trim() !== "N/A"
+ ) {
+ if (
+ output.some(
+ (u) =>
+ u.SN ===
+ arrayLine[i]
+ ?.split(",")[2]
+ ?.split(":")[1]
+ ?.replace("\r", "")
+ .trim()
+ )
+ ) {
+ output.map((u, index) => {
+ if (
+ u.SN === arrayLine[i]?.split(",")[2]?.split(":")[1].trim()
+ ) {
+ output[index].line = output[index].line.concat([i + 1]);
+ }
+ });
+ } else {
+ let fName = urls[index]
+ ?.split("/")
+ [urls[index]?.split("/")?.length - 1]?.trim();
+ output.push({
+ PID:
+ arrayLine[i]?.split(",")[0] !== undefined
+ ? arrayLine[i]?.split(",")[0]?.split(":")[1] !==
+ undefined
+ ? arrayLine[i]?.split(",")[0]?.split(":")[1]?.trim()
+ : ""
+ : "",
+ VID:
+ arrayLine[i]?.split(",")[0] !== undefined
+ ? arrayLine[i]?.split(",")[1]?.split(":")[1] !==
+ undefined
+ ? arrayLine[i]?.split(",")[1]?.split(":")[1]?.trim()
+ : ""
+ : "",
+ SN:
+ arrayLine[i].split(",")[1] !== undefined
+ ? arrayLine[i]
+ ?.split(",")[2]
+ ?.split(":")[1]
+ ?.replace("\r", "")
+ .trim()
+ : "",
+ line: [i + 1],
+ fileName: fName,
+ warehouse:
+ fName.search("-US") !== -1 ||
+ fName.search(".US") !== -1 ||
+ fName.search("US-") !== -1
+ ? "US"
+ : "AU",
+ });
+ }
+ }
+
+ if (arrayLine[i].search("PCB Serial Number") !== -1) {
+ if (
+ //Neu SN da nam trong output
+ output.some(
+ (u) =>
+ u.SN ===
+ arrayLine[i]?.split(":")[1]?.replace("\r", "").trim()
+ )
+ ) {
+ output.map((u, index) => {
+ if (
+ u.SN ===
+ arrayLine[i]?.split(":")[1]?.replace("\r", "").trim()
+ ) {
+ output[index].line = output[index].line.concat([i + 1]);
+ }
+ });
+ } else {
+ let fName = urls[index]
+ ?.split("/")
+ [urls[index]?.split("/")?.length - 1]?.trim();
+ output.push({
+ PID: "",
+ VID: "",
+ SN: arrayLine[i]?.split(":")[1]?.replace("\r", "").trim(),
+ line: [i + 1],
+ fileName: fName,
+ warehouse:
+ fName.search("-US") !== -1 ||
+ fName.search(".US") !== -1 ||
+ fName.search("US-") !== -1
+ ? "US"
+ : "AU",
+ });
+ }
+ }
+
+ if (arrayLine[i].search("Processor board ID") !== -1) {
+ if (
+ //Neu SN da nam trong output
+ output.some(
+ (u) =>
+ u.SN ===
+ arrayLine[i]
+ ?.split(" ")
+ [arrayLine[i]?.split(" ").length - 1]?.replace("\r", "")
+ .trim()
+ )
+ ) {
+ output.map((u, index) => {
+ if (
+ u.SN ===
+ arrayLine[i]
+ ?.split(" ")
+ [arrayLine[i]?.split(" ").length - 1]?.replace("\r", "")
+ .trim()
+ ) {
+ output[index].line = output[index].line.concat([i + 1]);
+ }
+ });
+ } else {
+ let fName = urls[index]
+ ?.split("/")
+ [urls[index]?.split("/")?.length - 1]?.trim();
+ output.push({
+ PID: "",
+ VID: "",
+ SN: arrayLine[i]
+ ?.split(" ")
+ [arrayLine[i]?.split(" ").length - 1]?.replace("\r", "")
+ .trim(),
+ line: [i + 1],
+ fileName: fName,
+ warehouse:
+ fName.search("-US") !== -1 ||
+ fName.search(".US") !== -1 ||
+ fName.search("US-") !== -1
+ ? "US"
+ : "AU",
+ });
+ }
+ }
+ }
+ report = report.concat(output);
+ }
+ });
+
+ fs.writeFile(
+ "./app/utils/indexSN.txt",
+ JSON.stringify(report)
+ .replace(/,{/g, "\n,{")
+ .replace(/\\u0000/g, ""),
+ function (err) {
+ if (err) {
+ return console.error(err);
+ }
+ console.log("Write loggg !");
+ }
+ );
+ // console.log(report);
+ return report;
+ // }, 15000);
+ } catch (error) {
+ response
+ .status(500)
+ .send({ mess: "GET INFORMATION FAIL", error: error });
+ }
+ };
+ const result = await fetchFiles(from, to);
+ response.status(200).json(result);
+ }
+
+ /**
+ * Controller lay noi dung file log theo so dong
+ * @param {String} fileName url file log tren server log
+ * @param {Integer} line dong chua serial number trong log
+ * @param {Integer} range khoang dong truoc/sau line
+ * @author {Bearer Token} req.headers.authorization //token xac thuc
+ */
+ public async getParagraph({ request, response }: HttpContextContract) {
+ const { fileName, line, range } = request.all();
+
+ try {
+ const res = await axios.get("http://192.168.5.7:8080/" + fileName);
+ const arrayLine = res?.data?.split("\n");
+ // console.log(arrayLine)
+ if (range >= line) {
+ response.status(200).json({
+ content: arrayLine?.slice(0, line + range)?.join("\n"),
+ });
+ } else {
+ response.status(200).json({
+ content: arrayLine?.slice(line - range - 1, line + range)?.join("\n"),
+ });
+ }
+ } catch (error) {
+ console.log(error);
+ response
+ .status(500)
+ .send({ mess: "GET CONTENT FILE FAIL", error: error });
+ }
+ }
+
+ public async store({}: HttpContextContract) {}
+
+ public async show({}: HttpContextContract) {}
+
+ public async edit({}: HttpContextContract) {}
+
+ public async update({}: HttpContextContract) {}
+
+ public async destroy({}: HttpContextContract) {}
+}
diff --git a/app/Controllers/Http/UsersController.ts b/app/Controllers/Http/UsersController.ts
new file mode 100644
index 0000000..1b5f982
--- /dev/null
+++ b/app/Controllers/Http/UsersController.ts
@@ -0,0 +1,65 @@
+import Env from "@ioc:Adonis/Core/Env";
+import type { HttpContextContract } from "@ioc:Adonis/Core/HttpContext";
+import Users from "App/Models/Users";
+import jwt from "jsonwebtoken";
+import { schema, rules } from "@ioc:Adonis/Core/Validator";
+export default class UsersController {
+ public async index({}: HttpContextContract) {}
+
+ public async create({ request, response }: HttpContextContract) {
+ try {
+ if ((await Users.findBy("username", request.all().username)) === null) {
+ const userSchema = schema.create({
+ username: schema.string({ trim: true }, [
+ rules.unique({
+ table: "users",
+ column: "username",
+ caseInsensitive: true,
+ }),
+ ]),
+ password: schema.string({}, [rules.minLength(8)]),
+ });
+
+ const data = await request.validate({ schema: userSchema });
+ const user = await Users.create(data);
+
+ return response.status(201).send({ mess: "REGISTER_SUCCESS" });
+ } else {
+ return response.status(203).send({ mess: "USERNAME EXIST" });
+ }
+ } catch (error) {
+ response.status(500).send({ mess: "CREATE USER FAIL", error: error });
+ }
+ }
+
+ public async checkLogin({ request, response, auth }: HttpContextContract) {
+ const { username, password } = request.all();
+ try {
+ const userLogin = await Users.findBy("username", username);
+ if (userLogin !== null) {
+ const user = await auth.attempt(username, password);
+ delete user.$original.password;
+ const accessToken = jwt.sign(user.$original, Env.get("JWT_KEY"), {
+ expiresIn: "365d",
+ });
+ await auth.login(user);
+ return response
+ .status(200)
+ .send({ mess: "AUTHENTICATION_SUCCESS", accessToken: accessToken });
+ } else {
+ return response.status(204).send("USER NOT EXISTS");
+ }
+ } catch (error) {
+ console.log(error);
+ response.status(500).send({ mess: "LOGIN FAIL", error: error });
+ }
+ }
+
+ public async show({}: HttpContextContract) {}
+
+ public async edit({}: HttpContextContract) {}
+
+ public async update({}: HttpContextContract) {}
+
+ public async destroy({}: HttpContextContract) {}
+}
diff --git a/app/Middleware/Auth.ts b/app/Middleware/Auth.ts
new file mode 100644
index 0000000..1a26ad0
--- /dev/null
+++ b/app/Middleware/Auth.ts
@@ -0,0 +1,76 @@
+import { AuthenticationException } from '@adonisjs/auth/build/standalone'
+import type { GuardsList } from '@ioc:Adonis/Addons/Auth'
+import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
+
+/**
+ * Auth middleware is meant to restrict un-authenticated access to a given route
+ * or a group of routes.
+ *
+ * You must register this middleware inside `start/kernel.ts` file under the list
+ * of named middleware.
+ */
+export default class AuthMiddleware {
+ /**
+ * The URL to redirect to when request is Unauthorized
+ */
+ protected redirectTo = '/login'
+
+ /**
+ * Authenticates the current HTTP request against a custom set of defined
+ * guards.
+ *
+ * The authentication loop stops as soon as the user is authenticated using any
+ * of the mentioned guards and that guard will be used by the rest of the code
+ * during the current request.
+ */
+ protected async authenticate(auth: HttpContextContract['auth'], guards: (keyof GuardsList)[]) {
+ /**
+ * Hold reference to the guard last attempted within the for loop. We pass
+ * the reference of the guard to the "AuthenticationException", so that
+ * it can decide the correct response behavior based upon the guard
+ * driver
+ */
+ let guardLastAttempted: string | undefined
+
+ for (let guard of guards) {
+ guardLastAttempted = guard
+
+ if (await auth.use(guard).check()) {
+ /**
+ * Instruct auth to use the given guard as the default guard for
+ * the rest of the request, since the user authenticated
+ * succeeded here
+ */
+ auth.defaultGuard = guard
+ return true
+ }
+ }
+
+ /**
+ * Unable to authenticate using any guard
+ */
+ throw new AuthenticationException(
+ 'Unauthorized access',
+ 'E_UNAUTHORIZED_ACCESS',
+ guardLastAttempted,
+ this.redirectTo,
+ )
+ }
+
+ /**
+ * Handle request
+ */
+ public async handle (
+ { auth }: HttpContextContract,
+ next: () => Promise,
+ customGuards: (keyof GuardsList)[]
+ ) {
+ /**
+ * Uses the user defined guards or the default guard mentioned in
+ * the config file
+ */
+ const guards = customGuards.length ? customGuards : [auth.name]
+ await this.authenticate(auth, guards)
+ await next()
+ }
+}
diff --git a/app/Middleware/CheckToken.ts b/app/Middleware/CheckToken.ts
new file mode 100644
index 0000000..feb16d4
--- /dev/null
+++ b/app/Middleware/CheckToken.ts
@@ -0,0 +1,43 @@
+import Env from "@ioc:Adonis/Core/Env";
+import jwt from "jsonwebtoken";
+import type { HttpContextContract } from "@ioc:Adonis/Core/HttpContext";
+// import { loggerAPI } from "App/utils/logger";
+// import jwtDecode from "jwt-decode";
+
+export default class CheckToken {
+ public async handle(
+ { request, response }: HttpContextContract,
+ next: () => Promise
+ ) {
+ // code for middleware goes here. ABOVE THE NEXT CALL
+ try {
+ // const user = jwtDecode(request.headers().authorization);
+ await jwt.verify(
+ request.headers().authorization?.replace(/"/g, ""),
+ Env.get("JWT_KEY"),
+ async function (err, decoded) {
+ if (err) {
+ response.status(203).send("Token invalid");
+ // loggerAPI(
+ // request,
+ // response,
+ // user,
+ // "Middleware CheckToken - " + request.url()
+ // );
+ } else {
+ await next();
+ }
+ }
+ );
+ } catch (error) {
+ console.log(error)
+ response.status(203).send("Token invalid");
+ // loggerAPI(
+ // request,
+ // response,
+ // request.headers().email,
+ // "Middleware CheckToken - " + request.url()
+ // );
+ }
+ }
+}
diff --git a/app/Middleware/SilentAuth.ts b/app/Middleware/SilentAuth.ts
new file mode 100644
index 0000000..5d3ac8f
--- /dev/null
+++ b/app/Middleware/SilentAuth.ts
@@ -0,0 +1,21 @@
+import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
+
+/**
+ * Silent auth middleware can be used as a global middleware to silent check
+ * if the user is logged-in or not.
+ *
+ * The request continues as usual, even when the user is not logged-in.
+ */
+export default class SilentAuthMiddleware {
+ /**
+ * Handle request
+ */
+ public async handle({ auth }: HttpContextContract, next: () => Promise) {
+ /**
+ * Check if user is logged-in or not. If yes, then `ctx.auth.user` will be
+ * set to the instance of the currently logged in user.
+ */
+ await auth.check()
+ await next()
+ }
+}
diff --git a/app/Models/Users.ts b/app/Models/Users.ts
new file mode 100644
index 0000000..20587ee
--- /dev/null
+++ b/app/Models/Users.ts
@@ -0,0 +1,27 @@
+import { DateTime } from 'luxon'
+import { BaseModel, beforeSave, column } from '@ioc:Adonis/Lucid/Orm'
+import Hash from '@ioc:Adonis/Core/Hash'
+
+export default class Users extends BaseModel {
+ @column({ isPrimary: true })
+ public id_user: number
+
+ @column()
+ public username: string
+
+ @column({ serializeAs: null })
+ public password: string
+
+ @column.dateTime({ autoCreate: true })
+ public createdAt: DateTime
+
+ @column.dateTime({ autoCreate: true, autoUpdate: true })
+ public updatedAt: DateTime
+
+ @beforeSave()
+ public static async hashPassword (user: Users) {
+ if (user.$dirty.password) {
+ user.password = await Hash.make(user.password)
+ }
+ }
+}
diff --git a/app/store/logs/abcdef.log b/app/store/logs/abcdef.log
deleted file mode 100644
index 32682c9..0000000
--- a/app/store/logs/abcdef.log
+++ /dev/null
@@ -1 +0,0 @@
-hukljksdsdf
\ No newline at end of file
diff --git a/app/store/logs/shgfhsjd.log b/app/store/logs/shgfhsjd.log
deleted file mode 100644
index 5fab3d7..0000000
--- a/app/store/logs/shgfhsjd.log
+++ /dev/null
@@ -1 +0,0 @@
-,mb
\ No newline at end of file
diff --git a/app/utils/indexSN.txt b/app/utils/indexSN.txt
new file mode 100644
index 0000000..019bfc7
--- /dev/null
+++ b/app/utils/indexSN.txt
@@ -0,0 +1,92 @@
+[{"PID":"","VID":"","SN":"FDO1829Q1VF","line":[6935,6982,6985],"fileName":"20230822-HELEN1-Session.US-3-5-127.0.0.1.log","warehouse":"US"}
+,{"PID":"PWR-C2-640WAC","VID":"V01","SN":"LIT18390RKX","line":[6988],"fileName":"20230822-HELEN1-Session.US-3-5-127.0.0.1.log","warehouse":"US"}
+,{"PID":"N5K-C5596UP","VID":"V01","SN":"FOX1633H4B5","line":[1807,1852,8537,8704,10259,10660,10917,11964],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"N5K-C5596UP","VID":"V01","SN":"FOC16427G2V","line":[1810,1855,8540,8707,10262,10663,10920,11967],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"N55-M16UP","VID":"V01","SN":"FOC16430FAZ","line":[1813,1858,8543,8710,10265,10666,10923,11970],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"N55-M16UP","VID":"V01","SN":"FOC16414PLF","line":[1816,1861,8546,8713,10268,10669,10926,11973],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"N55-M16UP","VID":"V01","SN":"FOC164411EC","line":[1819,1864,8549,8716,10271,10672,10929,11976],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"NXA-PAC-1100W","VID":"V01","SN":"PST2041H0DP","line":[1845,1879,8697,8731,10287,10687,10944,11991],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"NXA-PAC-1100W","VID":"V01","SN":"PST2041H08D","line":[1848,1882,8700,8734,10290,10690,10947,11994],"fileName":"20230822-HELEN1-Session.US-4-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-B-K9","VID":"V03","SN":"FJC2147M0VB","line":[853,926],"fileName":"20230822-HELEN1-Session.US-5-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC213946PL","line":[943,2000,2377],"fileName":"20230822-HELEN1-Session.US-5-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M09A","line":[1907,1983,2287,2360,4251],"fileName":"20230822-HELEN1-Session.US-5-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"","line":[5447],"fileName":"20230822-HELEN1-Session.US-7-9-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-B-K9","VID":"V04","SN":"FJC2229M5VU","line":[1391,1465],"fileName":"20230822-HELEN1-Session.US-8-10-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC22253W2J","line":[1482,3577],"fileName":"20230822-HELEN1-Session.US-8-10-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M09D","line":[3439,3562,3955],"fileName":"20230822-HELEN1-Session.US-8-10-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2408M2FD","line":[761,845,2071,2833,3413,5093],"fileName":"20230822-HELEN1-Session.US2-14-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC23060XBS","line":[860],"fileName":"20230822-HELEN1-Session.US2-14-6-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-B-K9","VID":"V04","SN":"FJC2229M5WB","line":[17,105,2238,2520,2595,3455,3536],"fileName":"20230822-HELEN1-Session.US2-15-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC22254TMQ","line":[122,2612,3553,4575],"fileName":"20230822-HELEN1-Session.US2-15-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M09F","line":[4485,4558,4857],"fileName":"20230822-HELEN1-Session.US2-15-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-B-K9","VID":"V03","SN":"FJC2147M0S3","line":[5635,5710,6106],"fileName":"20230822-HELEN1-Session.US2-15-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC214307RB","line":[5727,7023],"fileName":"20230822-HELEN1-Session.US2-15-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M09L","line":[6933,7006,8390,8403,8430,8498],"fileName":"20230822-HELEN1-Session.US2-15-7-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2408M54Y","line":[18,90,320,338],"fileName":"20230822-HELEN1-Session.US2-16-8-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC21394FKU","line":[105],"fileName":"20230822-HELEN1-Session.US2-16-8-127.0.0.1.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2408M2FF","line":[850,923,1134,1317,1415,2604,2617,2639,2705],"fileName":"20230822-HELEN1-Session.US2-16-8-127.0.0.1.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC21394GDG","line":[940],"fileName":"20230822-HELEN1-Session.US2-16-8-127.0.0.1.log","warehouse":"US"}
+,{"PID":"WS-C3750X-24P-S","VID":"V07","SN":"FDO1933F2F9","line":[135,179,847],"fileName":"20230822-HELEN1-Session.US2-18-10-127.0.0.1.log","warehouse":"US"}
+,{"PID":"C3KX-PWR-715WAC","VID":"V01","SN":"LIT1512072R","line":[138],"fileName":"20230822-HELEN1-Session.US2-18-10-127.0.0.1.log","warehouse":"US"}
+,{"PID":"C3KX-NM-1G","VID":"V01","SN":"FDO19371ASX","line":[141],"fileName":"20230822-HELEN1-Session.US2-18-10-127.0.0.1.log","warehouse":"US"}
+,{"PID":"WS-C3650-24PS","VID":"V01","SN":"FDO1829Q1VF","line":[65,68,666,800,2213,3126,3350,3685,4124,4309,4469,4595,8026,8346,8401,8404,8737],"fileName":"20230822-KENPC-Session.US-3-5-192.168.5.7.log","warehouse":"US"}
+,{"PID":"PWR-C2-640WAC","VID":"V01","SN":"LIT18390RKX","line":[71,8407],"fileName":"20230822-KENPC-Session.US-3-5-192.168.5.7.log","warehouse":"US"}
+,{"PID":"PID","VID":"","SN":"","line":[3247],"fileName":"20230822-KENPC-Session.US-3-5-192.168.5.7.log","warehouse":"US"}
+,{"PID":"WS-C3650-24PS SN","VID":"","SN":"","line":[3249],"fileName":"20230822-KENPC-Session.US-3-5-192.168.5.7.log","warehouse":"US"}
+,{"PID":"CISCO1921/K9","VID":"V05","SN":"FGL18192117","line":[77,285,568,579,597],"fileName":"20230822-KENPC-Session.US-1921TS-111-192.168.5.7.log","warehouse":"US"}
+,{"PID":"HWIC-8A","VID":"V02","SN":"FOC160247XB","line":[80,288,571,582],"fileName":"20230822-KENPC-Session.US-1921TS-111-192.168.5.7.log","warehouse":"US"}
+,{"PID":"HWIC-8A","VID":"V02","SN":"FOC16035XH6","line":[600],"fileName":"20230822-KENPC-Session.US-1921TS-111-192.168.5.7.log","warehouse":"US"}
+,{"PID":"WS-C3750X-24P-S","VID":"V07","SN":"FDO1933F2F9","line":[42,417],"fileName":"20230822-KENPC-Session.US2-18-10-192.168.5.7.log","warehouse":"US"}
+,{"PID":"C3KX-PWR-715WAC","VID":"V01","SN":"LIT1512072R","line":[45],"fileName":"20230822-KENPC-Session.US2-18-10-192.168.5.7.log","warehouse":"US"}
+,{"PID":"C3KX-NM-1G","VID":"V01","SN":"FDO19371ASX","line":[48],"fileName":"20230822-KENPC-Session.US2-18-10-192.168.5.7.log","warehouse":"US"}
+,{"PID":"CISCO1921/K9","VID":"V05","SN":"FGL182922Q1","line":[58],"fileName":"20230822-KENPC-Session.US2_1921TS_222-192.168.5.7.log","warehouse":"US"}
+,{"PID":"HWIC-8A","VID":"V02","SN":"FOC16095E5X","line":[61],"fileName":"20230822-KENPC-Session.US2_1921TS_222-192.168.5.7.log","warehouse":"US"}
+,{"PID":"N5K-C5596UP","VID":"V01","SN":"FOX1633H4B5","line":[71,412],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"N5K-C5596UP","VID":"V01","SN":"FOC16427G2V","line":[74,415],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"N55-M16UP","VID":"V01","SN":"FOC16430FAZ","line":[77,418],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"N55-M16UP","VID":"V01","SN":"FOC16414PLF","line":[80,421],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"N55-M16UP","VID":"V01","SN":"FOC164411EC","line":[83,424],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"NXA-PAC-1100W","VID":"V01","SN":"PST2041H0DP","line":[98,439],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"NXA-PAC-1100W","VID":"V01","SN":"PST2041H08D","line":[101,442],"fileName":"20230822-SAMBA-US4.log","warehouse":"US"}
+,{"PID":"WS-C3750X-24P-S","VID":"V07","SN":"FDO1933F2F9","line":[53,97],"fileName":"20230822-SAMBA-US18.log","warehouse":"US"}
+,{"PID":"C3KX-PWR-715WAC","VID":"V01","SN":"LIT1512072R","line":[56],"fileName":"20230822-SAMBA-US18.log","warehouse":"US"}
+,{"PID":"C3KX-NM-1G","VID":"V01","SN":"FDO19371ASX","line":[59],"fileName":"20230822-SAMBA-US18.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FGL1844X9JN","line":[40],"fileName":"20230822-TEST01-Session.Port11-11-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC184374WF","line":[50,1125],"fileName":"20230822-TEST01-Session.Port11-11-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC18487HHX","line":[22,1299],"fileName":"20230822-TEST01-Session.Port13-13-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-Z-K9","VID":"V03","SN":"FGL2126ABZ0","line":[1756],"fileName":"20230822-TEST01-Session.Port13-13-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M08G","line":[1990,2051,2140,2542,2630,2768],"fileName":"20230822-TEST01-Session.Port13-13-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC21245KL3","line":[2066,2155,2647],"fileName":"20230822-TEST01-Session.Port13-13-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FGL1918X1RE","line":[850,3893,4423,4594],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC19123AMA","line":[861,3904,4434,4605],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-Z-K9","VID":"V03","SN":"FGL2114ABMK","line":[1314],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M08G","line":[2242,2302,2489],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC21245KL3","line":[2317,2504],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M086","line":[2892,2979,3157,3240,3780],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC211163S2","line":[2994,3255],"fileName":"20230822-TEST01-Session.Port14-14-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FGL183910G1","line":[108,173,262,387,450],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"PWR-4450-AC","VID":"V02","SN":"DCA2019X0LZ","line":[176,265,390,453,546,603],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"SM-X-4X1G-1X10G","VID":"V02","SN":"FOC1949000X","line":[280,405,468,773],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"SM-X-4X1G-1X10G","VID":"V02","SN":"FOC21237HK2","line":[411,474,807],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"ISR4451-X/K9","VID":"V03","SN":"FOC18348MEV","line":[414,480,524,581,624,645,666,687,708],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"QFBR-5766LP","VID":"","SN":"AGS09015BKF","line":[477],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"","line":[732],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FGL1717S590","line":[1033,1350],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC17151MGW","line":[1043,2006],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-Z-K9","VID":"V03","SN":"FGL2114ABM4","line":[2453,2958,2982,2989,3073,3215],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC211163S2","line":[3088,3230,4102,4230],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2319M086","line":[3972,4087,4143,4215],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FOC18487HHX","line":[4323,4531,4688,4735,4878,5082,5181,5381,5612,5706,5918,6014,6159],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FGL1852X5A1","line":[4520,4677,5071,5170,5601,5694,5907,6003],"fileName":"20230822-TEST01-Session.Port16-16-172.16.20.1.log","warehouse":"AU"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2408M2FD","line":[17,105,689,726,817],"fileName":"20230822-TEST01-Session.US2-14-6-192.168.5.7.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC23060XBS","line":[120,832],"fileName":"20230822-TEST01-Session.US2-14-6-192.168.5.7.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FJC2319M09L","line":[107],"fileName":"20230822-TEST01-Session.US2-15-7-192.168.5.7.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC214307RB","line":[124],"fileName":"20230822-TEST01-Session.US2-15-7-192.168.5.7.log","warehouse":"US"}
+,{"PID":"AIR-AP3802E-A-K9","VID":"V05","SN":"FJC2408M2FF","line":[23,142,1178],"fileName":"20230822-TEST01-Session.US2-16-8-192.168.5.7.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FOC21394GDG","line":[159,1195],"fileName":"20230822-TEST01-Session.US2-16-8-192.168.5.7.log","warehouse":"US"}
+,{"PID":"","VID":"","SN":"FGL174211HP","line":[62,207,291,341],"fileName":"20230822-TEST02-Session.Port7-9-172.16.20.7.log","warehouse":"AU"}
+,{"PID":"C3900-SPE100/K9","VID":"V06","SN":"FOC17385UN9","line":[210],"fileName":"20230822-TEST02-Session.Port7-9-172.16.20.7.log","warehouse":"AU"}
+,{"PID":"VIC3-4FXS/DID","VID":"V03","SN":"FOC17361N9U","line":[213],"fileName":"20230822-TEST02-Session.Port7-9-172.16.20.7.log","warehouse":"AU"}
+,{"PID":"PWR-3900-POE","VID":"V02","SN":"SNI1507C75Q","line":[216,347],"fileName":"20230822-TEST02-Session.Port7-9-172.16.20.7.log","warehouse":"AU"}
+,{"PID":"C3900-SPE150/K9","VID":"V06","SN":"FOC19182VLK","line":[344],"fileName":"20230822-TEST02-Session.Port7-9-172.16.20.7.log","warehouse":"AU"}
+,{"PID":"","VID":"","SN":"FHK143470K5","line":[88],"fileName":"20230822-TEST02-Session.Port8-10-172.16.20.7.log","warehouse":"AU"}]
\ No newline at end of file
diff --git a/app/utils/runtimeCheckLogs.ts b/app/utils/runtimeCheckLogs.ts
index 4b377b9..71d9a8c 100644
--- a/app/utils/runtimeCheckLogs.ts
+++ b/app/utils/runtimeCheckLogs.ts
@@ -6,10 +6,9 @@ import LogReport from "App/Models/LogReport";
// export default class loggerAPI {
export function runtimeCheckLogs(folderPath) {
- console.log(folderPath);
try {
- let fileList = [];
- let fileList_old = [];
+ let fileList = Array();
+ let fileList_old = Array();
// Function to update the list of files
async function updateFileList() {
let dateNow = moment(Date.now()).format("YYYY/MM/DD");
diff --git a/config/auth.ts b/config/auth.ts
new file mode 100644
index 0000000..3fd727f
--- /dev/null
+++ b/config/auth.ts
@@ -0,0 +1,86 @@
+/**
+ * Config source: https://git.io/JY0mp
+ *
+ * Feel free to let us know via PR, if you find something broken in this config
+ * file.
+ */
+
+import type { AuthConfig } from '@ioc:Adonis/Addons/Auth'
+
+/*
+|--------------------------------------------------------------------------
+| Authentication Mapping
+|--------------------------------------------------------------------------
+|
+| List of available authentication mapping. You must first define them
+| inside the `contracts/auth.ts` file before mentioning them here.
+|
+*/
+const authConfig: AuthConfig = {
+ guard: 'web',
+ guards: {
+ /*
+ |--------------------------------------------------------------------------
+ | Web Guard
+ |--------------------------------------------------------------------------
+ |
+ | Web guard uses classic old school sessions for authenticating users.
+ | If you are building a standard web application, it is recommended to
+ | use web guard with session driver
+ |
+ */
+ web: {
+ driver: 'session',
+
+ provider: {
+ /*
+ |--------------------------------------------------------------------------
+ | Driver
+ |--------------------------------------------------------------------------
+ |
+ | Name of the driver
+ |
+ */
+ driver: 'lucid',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Identifier key
+ |--------------------------------------------------------------------------
+ |
+ | The identifier key is the unique key on the model. In most cases specifying
+ | the primary key is the right choice.
+ |
+ */
+ identifierKey: 'id_user',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Uids
+ |--------------------------------------------------------------------------
+ |
+ | Uids are used to search a user against one of the mentioned columns. During
+ | login, the auth module will search the user mentioned value against one
+ | of the mentioned columns to find their user record.
+ |
+ */
+ uids: ['username'],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Model
+ |--------------------------------------------------------------------------
+ |
+ | The model to use for fetching or finding users. The model is imported
+ | lazily since the config files are read way earlier in the lifecycle
+ | of booting the app and the models may not be in a usable state at
+ | that time.
+ |
+ */
+ model: () => import('App/Models/Users'),
+ },
+ },
+ },
+}
+
+export default authConfig
diff --git a/config/session.ts b/config/session.ts
new file mode 100644
index 0000000..3d359cc
--- /dev/null
+++ b/config/session.ts
@@ -0,0 +1,116 @@
+/**
+ * Config source: https://git.io/JeYHp
+ *
+ * Feel free to let us know via PR, if you find something broken in this config
+ * file.
+ */
+
+import Env from '@ioc:Adonis/Core/Env'
+import Application from '@ioc:Adonis/Core/Application'
+import { sessionConfig } from '@adonisjs/session/build/config'
+
+export default sessionConfig({
+ /*
+ |--------------------------------------------------------------------------
+ | Enable/Disable sessions
+ |--------------------------------------------------------------------------
+ |
+ | Setting the following property to "false" will disable the session for the
+ | entire application
+ |
+ */
+ enabled: true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Driver
+ |--------------------------------------------------------------------------
+ |
+ | The session driver to use. You can choose between one of the following
+ | drivers.
+ |
+ | - cookie (Uses signed cookies to store session values)
+ | - file (Uses filesystem to store session values)
+ | - redis (Uses redis. Make sure to install "@adonisjs/redis" as well)
+ |
+ | Note: Switching drivers will make existing sessions invalid.
+ |
+ */
+ driver: Env.get('SESSION_DRIVER'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Cookie name
+ |--------------------------------------------------------------------------
+ |
+ | The name of the cookie that will hold the session id.
+ |
+ */
+ cookieName: 'adonis-session',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Clear session when browser closes
+ |--------------------------------------------------------------------------
+ |
+ | Whether or not you want to destroy the session when browser closes. Setting
+ | this value to `true` will ignore the `age`.
+ |
+ */
+ clearWithBrowser: false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Session age
+ |--------------------------------------------------------------------------
+ |
+ | The duration for which session stays active after no activity. A new HTTP
+ | request to the server is considered as activity.
+ |
+ | The value can be a number in milliseconds or a string that must be valid
+ | as per https://npmjs.org/package/ms package.
+ |
+ | Example: `2 days`, `2.5 hrs`, `1y`, `5s` and so on.
+ |
+ */
+ age: '2h',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Cookie values
+ |--------------------------------------------------------------------------
+ |
+ | The cookie settings are used to setup the session id cookie and also the
+ | driver will use the same values.
+ |
+ */
+ cookie: {
+ path: '/',
+ httpOnly: true,
+ sameSite: false,
+ },
+
+ /*
+ |--------------------------------------------------------------------------
+ | Configuration for the file driver
+ |--------------------------------------------------------------------------
+ |
+ | The file driver needs absolute path to the directory in which sessions
+ | must be stored.
+ |
+ */
+ file: {
+ location: Application.tmpPath('sessions'),
+ },
+
+ /*
+ |--------------------------------------------------------------------------
+ | Redis driver
+ |--------------------------------------------------------------------------
+ |
+ | The redis connection you want session driver to use. The same connection
+ | must be defined inside `config/redis.ts` file as well.
+ |
+ */
+ redisConnection: 'local',
+})
diff --git a/contracts/auth.ts b/contracts/auth.ts
new file mode 100644
index 0000000..1fe370b
--- /dev/null
+++ b/contracts/auth.ts
@@ -0,0 +1,73 @@
+/**
+ * Contract source: https://git.io/JOdz5
+ *
+ * Feel free to let us know via PR, if you find something broken in this
+ * file.
+ */
+
+import User from 'App/Models/User'
+
+declare module '@ioc:Adonis/Addons/Auth' {
+ /*
+ |--------------------------------------------------------------------------
+ | Providers
+ |--------------------------------------------------------------------------
+ |
+ | The providers are used to fetch users. The Auth module comes pre-bundled
+ | with two providers that are `Lucid` and `Database`. Both uses database
+ | to fetch user details.
+ |
+ | You can also create and register your own custom providers.
+ |
+ */
+ interface ProvidersList {
+ /*
+ |--------------------------------------------------------------------------
+ | User Provider
+ |--------------------------------------------------------------------------
+ |
+ | The following provider uses Lucid models as a driver for fetching user
+ | details from the database for authentication.
+ |
+ | You can create multiple providers using the same underlying driver with
+ | different Lucid models.
+ |
+ */
+ user: {
+ implementation: LucidProviderContract
+ config: LucidProviderConfig
+ }
+ }
+
+ /*
+ |--------------------------------------------------------------------------
+ | Guards
+ |--------------------------------------------------------------------------
+ |
+ | The guards are used for authenticating users using different drivers.
+ | The auth module comes with 3 different guards.
+ |
+ | - SessionGuardContract
+ | - BasicAuthGuardContract
+ | - OATGuardContract ( Opaque access token )
+ |
+ | Every guard needs a provider for looking up users from the database.
+ |
+ */
+ interface GuardsList {
+ /*
+ |--------------------------------------------------------------------------
+ | Web Guard
+ |--------------------------------------------------------------------------
+ |
+ | The web guard uses sessions for maintaining user login state. It uses
+ | the `user` provider for fetching user details.
+ |
+ */
+ web: {
+ implementation: SessionGuardContract<'user', 'web'>
+ config: SessionGuardConfig<'user'>
+ client: SessionClientContract<'user'>
+ }
+ }
+}
diff --git a/env.ts b/env.ts
index 99e816d..122dd43 100644
--- a/env.ts
+++ b/env.ts
@@ -27,4 +27,5 @@ export default Env.rules({
MYSQL_USER: Env.schema.string(),
MYSQL_PASSWORD: Env.schema.string.optional(),
MYSQL_DB_NAME: Env.schema.string(),
+ SESSION_DRIVER: Env.schema.string()
});
diff --git a/package-lock.json b/package-lock.json
index 45e19ca..aab62e4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,11 +8,15 @@
"name": "log-server",
"version": "1.0.0",
"dependencies": {
+ "@adonisjs/auth": "^8.2.3",
"@adonisjs/core": "^5.9.0",
"@adonisjs/lucid": "^18.4.0",
"@adonisjs/repl": "^3.1.11",
+ "@adonisjs/session": "^6.4.0",
+ "axios": "^1.4.0",
"chokidar": "^3.5.3",
"fs": "^0.0.1-security",
+ "jsonwebtoken": "^9.0.1",
"luxon": "^3.4.0",
"moment": "^2.29.4",
"mysql2": "^3.6.0",
@@ -118,6 +122,50 @@
"@adonisjs/core": "^5.1.0"
}
},
+ "node_modules/@adonisjs/auth": {
+ "version": "8.2.3",
+ "resolved": "https://registry.npmjs.org/@adonisjs/auth/-/auth-8.2.3.tgz",
+ "integrity": "sha512-js9e8AHEsNC/8MGvho6MgL+uXr8SlhTg9MJJDWQBBiqsKkT7+H7NMP/pLbuSzYaaf40t2u/OXfq6wXuIC5ZYvw==",
+ "dependencies": {
+ "@poppinss/hooks": "^5.0.3",
+ "@poppinss/utils": "^5.0.0",
+ "luxon": "^3.0.4"
+ },
+ "peerDependencies": {
+ "@adonisjs/core": "^5.7.1",
+ "@adonisjs/i18n": "^1.5.0",
+ "@adonisjs/lucid": "^18.0.0",
+ "@adonisjs/redis": "^7.2.0",
+ "@adonisjs/session": "^6.2.0"
+ },
+ "peerDependenciesMeta": {
+ "@adonisjs/i18n": {
+ "optional": true
+ },
+ "@adonisjs/lucid": {
+ "optional": true
+ },
+ "@adonisjs/redis": {
+ "optional": true
+ },
+ "@adonisjs/session": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@adonisjs/auth/node_modules/@poppinss/hooks": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/@poppinss/hooks/-/hooks-5.0.3.tgz",
+ "integrity": "sha512-M5a151VUl+RslVP5qwDW+u+0VmzKt5Nfplzdx2nrtXol3yVlLN3u2Jp6UADESid3DDI7IRHmFrA3sQusey3eUA==",
+ "peerDependencies": {
+ "@adonisjs/application": ">=4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@adonisjs/application": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@adonisjs/bodyparser": {
"version": "8.1.9",
"resolved": "https://registry.npmjs.org/@adonisjs/bodyparser/-/bodyparser-8.1.9.tgz",
@@ -474,6 +522,42 @@
"source-map-support": "^0.5.21"
}
},
+ "node_modules/@adonisjs/session": {
+ "version": "6.4.0",
+ "resolved": "https://registry.npmjs.org/@adonisjs/session/-/session-6.4.0.tgz",
+ "integrity": "sha512-9yHS60lFpNBUX5/yB+0j+bXQDWqbaYJ1JelLCYtaKRa7B0NewvmPAmsNpHH8SrXE3XGaRyKOxrUGRcmSGg5mRA==",
+ "dependencies": {
+ "@poppinss/utils": "^4.0.4",
+ "fs-extra": "^10.1.0"
+ },
+ "peerDependencies": {
+ "@adonisjs/core": "^5.8.0"
+ }
+ },
+ "node_modules/@adonisjs/session/node_modules/@poppinss/utils": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@poppinss/utils/-/utils-4.0.4.tgz",
+ "integrity": "sha512-6LS3mofSVB9IQZqofA4rX6KVVcCpdwUQuNe4efHqOTzgD/Q5HTVvDP0vKg1m994QlzJs4aLW1JwXVcNCThEh4g==",
+ "dependencies": {
+ "@poppinss/file-generator": "^1.0.2",
+ "@types/bytes": "^3.1.1",
+ "@types/he": "^1.1.2",
+ "bytes": "^3.1.2",
+ "change-case": "^4.1.2",
+ "cuid": "^2.1.8",
+ "flattie": "^1.1.0",
+ "fs-readdir-recursive": "^1.1.0",
+ "he": "^1.2.0",
+ "kind-of": "^6.0.3",
+ "lodash": "^4.17.21",
+ "ms": "^2.1.3",
+ "pluralize": "^8.0.0",
+ "require-all": "^3.0.0",
+ "resolve-from": "^5.0.0",
+ "slugify": "^1.6.5",
+ "truncatise": "0.0.8"
+ }
+ },
"node_modules/@adonisjs/sink": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/@adonisjs/sink/-/sink-5.4.3.tgz",
@@ -1653,8 +1737,7 @@
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
- "dev": true
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/atob": {
"version": "2.1.2",
@@ -1676,6 +1759,16 @@
"node": ">=8.0.0"
}
},
+ "node_modules/axios": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
+ "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
+ "dependencies": {
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"node_modules/babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@@ -1848,6 +1941,11 @@
"ieee754": "^1.2.1"
}
},
+ "node_modules/buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
+ },
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@@ -2292,7 +2390,6 @@
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "dev": true,
"dependencies": {
"delayed-stream": "~1.0.0"
},
@@ -2607,7 +2704,6 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
- "dev": true,
"engines": {
"node": ">=0.4.0"
}
@@ -2697,6 +2793,14 @@
"url": "https://github.com/motdotla/dotenv?sponsor=1"
}
},
+ "node_modules/ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "dependencies": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/editorconfig": {
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
@@ -3238,6 +3342,25 @@
"node": ">=8"
}
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.2",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
+ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
"node_modules/for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -3251,7 +3374,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
- "dev": true,
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@@ -4361,6 +4483,21 @@
"graceful-fs": "^4.1.6"
}
},
+ "node_modules/jsonwebtoken": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz",
+ "integrity": "sha512-K8wx7eJ5TPvEjuiVSkv167EVboBDv9PZdDoF7BgeQnBLVvZWW9clr2PsQHVJDTKaEIH5JBIwHujGcHp7GgI2eg==",
+ "dependencies": {
+ "jws": "^3.2.2",
+ "lodash": "^4.17.21",
+ "ms": "^2.1.1",
+ "semver": "^7.3.8"
+ },
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ }
+ },
"node_modules/junk": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz",
@@ -4370,6 +4507,25 @@
"node": ">=8"
}
},
+ "node_modules/jwa": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
+ "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
+ "dependencies": {
+ "buffer-equal-constant-time": "1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "node_modules/jws": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
+ "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
+ "dependencies": {
+ "jwa": "^1.4.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -5909,6 +6065,11 @@
"node": ">= 0.10"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
"node_modules/pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
@@ -7760,6 +7921,24 @@
"slash": "^3.0.0"
}
},
+ "@adonisjs/auth": {
+ "version": "8.2.3",
+ "resolved": "https://registry.npmjs.org/@adonisjs/auth/-/auth-8.2.3.tgz",
+ "integrity": "sha512-js9e8AHEsNC/8MGvho6MgL+uXr8SlhTg9MJJDWQBBiqsKkT7+H7NMP/pLbuSzYaaf40t2u/OXfq6wXuIC5ZYvw==",
+ "requires": {
+ "@poppinss/hooks": "^5.0.3",
+ "@poppinss/utils": "^5.0.0",
+ "luxon": "^3.0.4"
+ },
+ "dependencies": {
+ "@poppinss/hooks": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/@poppinss/hooks/-/hooks-5.0.3.tgz",
+ "integrity": "sha512-M5a151VUl+RslVP5qwDW+u+0VmzKt5Nfplzdx2nrtXol3yVlLN3u2Jp6UADESid3DDI7IRHmFrA3sQusey3eUA==",
+ "requires": {}
+ }
+ }
+ },
"@adonisjs/bodyparser": {
"version": "8.1.9",
"resolved": "https://registry.npmjs.org/@adonisjs/bodyparser/-/bodyparser-8.1.9.tgz",
@@ -8084,6 +8263,41 @@
"source-map-support": "^0.5.21"
}
},
+ "@adonisjs/session": {
+ "version": "6.4.0",
+ "resolved": "https://registry.npmjs.org/@adonisjs/session/-/session-6.4.0.tgz",
+ "integrity": "sha512-9yHS60lFpNBUX5/yB+0j+bXQDWqbaYJ1JelLCYtaKRa7B0NewvmPAmsNpHH8SrXE3XGaRyKOxrUGRcmSGg5mRA==",
+ "requires": {
+ "@poppinss/utils": "^4.0.4",
+ "fs-extra": "^10.1.0"
+ },
+ "dependencies": {
+ "@poppinss/utils": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/@poppinss/utils/-/utils-4.0.4.tgz",
+ "integrity": "sha512-6LS3mofSVB9IQZqofA4rX6KVVcCpdwUQuNe4efHqOTzgD/Q5HTVvDP0vKg1m994QlzJs4aLW1JwXVcNCThEh4g==",
+ "requires": {
+ "@poppinss/file-generator": "^1.0.2",
+ "@types/bytes": "^3.1.1",
+ "@types/he": "^1.1.2",
+ "bytes": "^3.1.2",
+ "change-case": "^4.1.2",
+ "cuid": "^2.1.8",
+ "flattie": "^1.1.0",
+ "fs-readdir-recursive": "^1.1.0",
+ "he": "^1.2.0",
+ "kind-of": "^6.0.3",
+ "lodash": "^4.17.21",
+ "ms": "^2.1.3",
+ "pluralize": "^8.0.0",
+ "require-all": "^3.0.0",
+ "resolve-from": "^5.0.0",
+ "slugify": "^1.6.5",
+ "truncatise": "0.0.8"
+ }
+ }
+ }
+ },
"@adonisjs/sink": {
"version": "5.4.3",
"resolved": "https://registry.npmjs.org/@adonisjs/sink/-/sink-5.4.3.tgz",
@@ -9061,8 +9275,7 @@
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
- "dev": true
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"atob": {
"version": "2.1.2",
@@ -9075,6 +9288,16 @@
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ=="
},
+ "axios": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz",
+ "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
+ "requires": {
+ "follow-redirects": "^1.15.0",
+ "form-data": "^4.0.0",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@@ -9196,6 +9419,11 @@
"ieee754": "^1.2.1"
}
},
+ "buffer-equal-constant-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
+ "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="
+ },
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@@ -9539,7 +9767,6 @@
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "dev": true,
"requires": {
"delayed-stream": "~1.0.0"
}
@@ -9787,8 +10014,7 @@
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
- "dev": true
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"denque": {
"version": "2.1.0",
@@ -9850,6 +10076,14 @@
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ=="
},
+ "ecdsa-sig-formatter": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
+ "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
"editorconfig": {
"version": "0.15.3",
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz",
@@ -10275,6 +10509,11 @@
"resolved": "https://registry.npmjs.org/flattie/-/flattie-1.1.0.tgz",
"integrity": "sha512-xU99gDEnciIwJdGcBmNHnzTJ/w5AT+VFJOu6sTB6WM8diOYNA3Sa+K1DiEBQ7XH4QikQq3iFW1U+jRVcotQnBw=="
},
+ "follow-redirects": {
+ "version": "1.15.2",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
+ "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
+ },
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -10285,7 +10524,6 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
- "dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
@@ -11123,12 +11361,42 @@
"universalify": "^2.0.0"
}
},
+ "jsonwebtoken": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.1.tgz",
+ "integrity": "sha512-K8wx7eJ5TPvEjuiVSkv167EVboBDv9PZdDoF7BgeQnBLVvZWW9clr2PsQHVJDTKaEIH5JBIwHujGcHp7GgI2eg==",
+ "requires": {
+ "jws": "^3.2.2",
+ "lodash": "^4.17.21",
+ "ms": "^2.1.1",
+ "semver": "^7.3.8"
+ }
+ },
"junk": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz",
"integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==",
"dev": true
},
+ "jwa": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz",
+ "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==",
+ "requires": {
+ "buffer-equal-constant-time": "1.0.1",
+ "ecdsa-sig-formatter": "1.0.11",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "jws": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
+ "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==",
+ "requires": {
+ "jwa": "^1.4.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -12311,6 +12579,11 @@
"ipaddr.js": "1.9.1"
}
},
+ "proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+ },
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
diff --git a/package.json b/package.json
index 5e06d49..2e54e0b 100644
--- a/package.json
+++ b/package.json
@@ -21,11 +21,15 @@
"youch-terminal": "^2.2.2"
},
"dependencies": {
+ "@adonisjs/auth": "^8.2.3",
"@adonisjs/core": "^5.9.0",
"@adonisjs/lucid": "^18.4.0",
"@adonisjs/repl": "^3.1.11",
+ "@adonisjs/session": "^6.4.0",
+ "axios": "^1.4.0",
"chokidar": "^3.5.3",
"fs": "^0.0.1-security",
+ "jsonwebtoken": "^9.0.1",
"luxon": "^3.4.0",
"moment": "^2.29.4",
"mysql2": "^3.6.0",
diff --git a/start/kernel.ts b/start/kernel.ts
index 57cfaea..6c70c54 100644
--- a/start/kernel.ts
+++ b/start/kernel.ts
@@ -41,4 +41,5 @@ Server.middleware.register([
|
*/
Server.middleware.registerNamed({
+ checkToken: () => import('App/Middleware/CheckToken'),
})
diff --git a/start/routes.ts b/start/routes.ts
index c68ac83..fa2432e 100644
--- a/start/routes.ts
+++ b/start/routes.ts
@@ -30,3 +30,9 @@ Route.get('/api/list', async () => {
// console.log("first")
return a
})
+
+Route.post('/api/getIndexSerialNumber', "ErpsController.getIndexSerialNumber").middleware("checkToken")
+Route.post('/api/getParagraph', "ErpsController.getParagraph").middleware("checkToken")
+
+Route.post('/api/account/createUser', "UsersController.create")
+Route.post('/api/account/checkLogin', "UsersController.checkLogin")
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 73c279f..7afaf7b 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -29,7 +29,9 @@
"@adonisjs/core",
"@adonisjs/repl",
"@japa/preset-adonis/build/adonis-typings",
- "@adonisjs/lucid"
+ "@adonisjs/lucid",
+ "@adonisjs/auth",
+ "@adonisjs/session"
]
}
}
\ No newline at end of file