@abtnode/auth 1.16.29-next-680cf137 → 1.16.29

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/lib/auth.js CHANGED
@@ -21,6 +21,7 @@ const {
21
21
  WELLKNOWN_BLOCKLET_ADMIN_PATH,
22
22
  } = require('@abtnode/constant');
23
23
  const axios = require('@abtnode/util/lib/axios');
24
+ const getRequestIP = require('@abtnode/util/lib/get-request-ip');
24
25
  const { extractUserAvatar, getUserAvatarUrl, getAppAvatarUrl, getServerAvatarUrl } = require('@abtnode/util/lib/user');
25
26
  const { LOGIN_PROVIDER } = require('@blocklet/constant');
26
27
 
@@ -518,7 +519,7 @@ const handleInvitationReceive = async ({
518
519
  pk: user.pk,
519
520
  locale,
520
521
  passport,
521
- lastLoginIp: get(req, 'headers[x-real-ip]') || '',
522
+ lastLoginIp: getRequestIP(req),
522
523
  remark,
523
524
  connectedAccount: {
524
525
  provider,
@@ -546,7 +547,7 @@ const handleInvitationReceive = async ({
546
547
  pk: userPk,
547
548
  locale,
548
549
  passport,
549
- lastLoginIp: get(req, 'headers[x-real-ip]') || '',
550
+ lastLoginIp: getRequestIP(req),
550
551
  remark,
551
552
  connectedAccount: {
552
553
  provider,
@@ -11,6 +11,7 @@ const { VC_TYPE_NODE_PASSPORT, PASSPORT_STATUS, NODE_DATA_DIR_NAME } = require('
11
11
  const get = require('lodash/get');
12
12
  const isFunction = require('lodash/isFunction');
13
13
  const { getUserAvatarUrl, getAppAvatarUrl, getServerAvatarUrl, extractUserAvatar } = require('@abtnode/util/lib/user');
14
+ const getRequestIP = require('@abtnode/util/lib/get-request-ip');
14
15
  const { getWalletDid } = require('@blocklet/meta/lib/did-utils');
15
16
  const { getSourceAppPid, getLoginProvider } = require('@blocklet/sdk/lib/util/login');
16
17
  const {
@@ -326,7 +327,7 @@ const createLostPassportIssueRoute = ({ node, type, authServicePrefix, createTok
326
327
 
327
328
  if (isFunction(createToken)) {
328
329
  if (type === TEAM_TYPES.BLOCKLET) {
329
- const lastLoginIp = request.get('x-real-ip');
330
+ const lastLoginIp = getRequestIP(request);
330
331
  const walletDeviceMessageToken = request.get('wallet-device-message-token');
331
332
  const walletDeviceId = request.get('wallet-device-id');
332
333
  const ua = request.get('user-agent');
package/lib/server.js CHANGED
@@ -17,6 +17,7 @@ const { getBlockletChainInfo, isInProgress, isRunning } = require('@blocklet/met
17
17
  const getBlockletInfo = require('@blocklet/meta/lib/info');
18
18
  const formatContext = require('@abtnode/util/lib/format-context');
19
19
  const { isInServerlessMode } = require('@abtnode/util/lib/serverless');
20
+ const getRequestIP = require('@abtnode/util/lib/get-request-ip');
20
21
  const {
21
22
  ROLES,
22
23
  VC_TYPE_GENERAL_PASSPORT,
@@ -747,7 +748,7 @@ const createLaunchBlockletHandler =
747
748
  userDid,
748
749
  ownerDid: claim.userDid,
749
750
  ownerPk: claim.userPk,
750
- lastLoginIp: get(req, 'headers[x-real-ip]') || '',
751
+ lastLoginIp: getRequestIP(req),
751
752
  context: formatContext(req),
752
753
  locale,
753
754
  launcherSessionId,
@@ -799,7 +800,7 @@ const createLaunchBlockletHandler =
799
800
  context: {
800
801
  visitorId: extraParams.visitorId,
801
802
  ua: req.get('user-agent'),
802
- lastLoginIp: req.get('x-real-ip'),
803
+ lastLoginIp: getRequestIP(req),
803
804
  walletOS: didwallet?.os,
804
805
  walletDeviceMessageToken: req.get('wallet-device-message-token'),
805
806
  walletDeviceId: req.get('wallet-device-id'),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.29-next-680cf137",
6
+ "version": "1.16.29",
7
7
  "description": "Simple lib to manage auth in ABT Node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -20,21 +20,21 @@
20
20
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@abtnode/constant": "1.16.29-next-680cf137",
24
- "@abtnode/logger": "1.16.29-next-680cf137",
25
- "@abtnode/util": "1.16.29-next-680cf137",
26
- "@arcblock/did": "1.18.126",
27
- "@arcblock/jwt": "^1.18.126",
28
- "@arcblock/nft-display": "^2.10.7",
29
- "@arcblock/validator": "^1.18.126",
30
- "@arcblock/vc": "1.18.126",
31
- "@blocklet/constant": "1.16.29-next-680cf137",
32
- "@blocklet/meta": "1.16.29-next-680cf137",
33
- "@blocklet/sdk": "1.16.29-next-680cf137",
34
- "@ocap/client": "^1.18.126",
35
- "@ocap/mcrypto": "1.18.126",
36
- "@ocap/util": "1.18.126",
37
- "@ocap/wallet": "1.18.126",
23
+ "@abtnode/constant": "1.16.29",
24
+ "@abtnode/logger": "1.16.29",
25
+ "@abtnode/util": "1.16.29",
26
+ "@arcblock/did": "1.18.128",
27
+ "@arcblock/jwt": "^1.18.128",
28
+ "@arcblock/nft-display": "^2.10.12",
29
+ "@arcblock/validator": "^1.18.128",
30
+ "@arcblock/vc": "1.18.128",
31
+ "@blocklet/constant": "1.16.29",
32
+ "@blocklet/meta": "1.16.29",
33
+ "@blocklet/sdk": "1.16.29",
34
+ "@ocap/client": "^1.18.128",
35
+ "@ocap/mcrypto": "1.18.128",
36
+ "@ocap/util": "1.18.128",
37
+ "@ocap/wallet": "1.18.128",
38
38
  "axios": "^1.7.2",
39
39
  "flat": "^5.0.2",
40
40
  "fs-extra": "^11.2.0",
@@ -50,5 +50,5 @@
50
50
  "devDependencies": {
51
51
  "jest": "^29.7.0"
52
52
  },
53
- "gitHead": "17b7e7c5e43c497980d4fe6b5bb20609328041bd"
53
+ "gitHead": "6c49cffcab4fd0dffc6bed261a5eddf733280ae7"
54
54
  }