@opengis/fastify-table 2.5.41 → 2.5.43

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.
@@ -1 +1 @@
1
- {"version":3,"file":"loginUser.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/auth/funcs/loginUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAWvC,wBAA8B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBAuDpE"}
1
+ {"version":3,"file":"loginUser.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/auth/funcs/loginUser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAuBvC,wBAA8B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBA2DpE"}
@@ -4,9 +4,17 @@ import logger from "../../logger/getLogger.js";
4
4
  import verifyPassword from "./verifyPassword.js";
5
5
  import authorizeUser from "./authorizeUser.js";
6
6
  import { BadRequestError } from "../../../../errors.js";
7
+ const getIp = (req) => (req.headers?.["x-real-ip"] ||
8
+ req.headers?.["x-forwarded-for"] ||
9
+ req.ip ||
10
+ req.connection?.remoteAddress ||
11
+ "")
12
+ .split(":")
13
+ .pop();
7
14
  export default async function loginUser(req, reply) {
8
15
  const { username, password } = (req.method === "POST" ? req.body : req.query) || {};
9
16
  const { pg = pgClients.client } = req;
17
+ const ip = getIp(req);
10
18
  if (!config.pg) {
11
19
  if (req.method !== "GET") {
12
20
  throw Error("empty pg");
@@ -29,6 +37,7 @@ export default async function loginUser(req, reply) {
29
37
  password,
30
38
  })) || {};
31
39
  if (!user) {
40
+ logger.file("auth/warn", { error: message, username, ip });
32
41
  if (req.method !== "GET") {
33
42
  throw BadRequestError(message);
34
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"verifyPassword.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/auth/funcs/verifyPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAWpD,wBAA8B,cAAc,CAAC,EAC3C,EAAE,EACF,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;;;eA2CA"}
1
+ {"version":3,"file":"verifyPassword.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/auth/funcs/verifyPassword.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAYpD,wBAA8B,cAAc,CAAC,EAC3C,EAAE,EACF,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;;;eA6CA"}
@@ -15,8 +15,9 @@ export default async function verifyPassword({ pg, username, password, }) {
15
15
  const json = await pg
16
16
  .query(query, [username])
17
17
  .then((r) => r.rows?.[0] || {});
18
- if (!json)
18
+ if (!json) {
19
19
  return { message: "user not found" };
20
+ }
20
21
  if (json.password_new_hash_algorithm === true) {
21
22
  const hash = await pg
22
23
  .query(`SELECT public.crypt($1, $2)`, [password, json.salt])
@@ -1 +1 @@
1
- {"version":3,"file":"inspectContent.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/file/utils/inspectContent.ts"],"names":[],"mappings":"AA+CA,wBAA8B,cAAc,CAC1C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM;;;;GAwC1B"}
1
+ {"version":3,"file":"inspectContent.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/file/utils/inspectContent.ts"],"names":[],"mappings":"AA+CA,wBAA8B,cAAc,CAC1C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM;;;;GAgD1B"}
@@ -67,6 +67,13 @@ export default async function inspectContent(buffer, expectedExtension) {
67
67
  isValid: true,
68
68
  };
69
69
  }
70
+ if (ext === "jpg" && expectedExtension === "jpeg") {
71
+ return {
72
+ ext: expectedExtension,
73
+ mime,
74
+ isValid: true,
75
+ };
76
+ }
70
77
  // ? simple xml, pdf are recognized via file-type
71
78
  return { ext, mime, isValid: ext === expectedExtension };
72
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.5.41",
3
+ "version": "2.5.43",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [