nodebb-plugin-session-sharing 7.2.3 → 8.0.0
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/controllers.js +2 -4
- package/library.js +11 -11
- package/package.json +4 -4
- package/static/lib/admin.js +4 -4
- package/static/lib/main.js +10 -8
- package/test/index.js +3 -3
- package/upgrades/session_sharing_hash_to_zset.js +4 -4
- package/package-lock.json +0 -6428
package/lib/controllers.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const groups =
|
|
3
|
+
const groups = nodebb.require('./src/groups');
|
|
4
4
|
|
|
5
|
-
const Controllers =
|
|
5
|
+
const Controllers = module.exports;
|
|
6
6
|
|
|
7
7
|
Controllers.renderAdminPage = async (req, res) => {
|
|
8
8
|
const groupData = await groups.getGroupsFromSet('groups:visible:createtime', 0, -1);
|
|
@@ -58,5 +58,3 @@ Controllers.process = async (req, res) => {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
module.exports = Controllers;
|
package/library.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const winston =
|
|
4
|
-
const nconf =
|
|
3
|
+
const winston = nodebb.require('winston');
|
|
4
|
+
const nconf = nodebb.require('nconf');
|
|
5
5
|
|
|
6
6
|
const util = require('util');
|
|
7
7
|
|
|
8
8
|
const _ = require('lodash');
|
|
9
9
|
const jwt = require('jsonwebtoken');
|
|
10
10
|
|
|
11
|
-
const meta =
|
|
12
|
-
const user =
|
|
13
|
-
const groups =
|
|
14
|
-
const SocketPlugins =
|
|
15
|
-
const db =
|
|
16
|
-
const plugins =
|
|
17
|
-
const routeHelpers =
|
|
11
|
+
const meta = nodebb.require('./src/meta');
|
|
12
|
+
const user = nodebb.require('./src/user');
|
|
13
|
+
const groups = nodebb.require('./src/groups');
|
|
14
|
+
const SocketPlugins = nodebb.require('./src/socket.io/plugins');
|
|
15
|
+
const db = nodebb.require('./src/database');
|
|
16
|
+
const plugins = nodebb.require('./src/plugins');
|
|
17
|
+
const routeHelpers = nodebb.require('./src/routes/helpers');
|
|
18
18
|
|
|
19
19
|
const controllers = require('./lib/controllers');
|
|
20
|
-
const nbbAuthController =
|
|
20
|
+
const nbbAuthController = nodebb.require('./src/controllers/authentication');
|
|
21
21
|
const logoutAsync = util.promisify((req, callback) => req.logout(callback));
|
|
22
22
|
|
|
23
23
|
/* all the user profile fields that can be passed to user.updateProfile */
|
|
@@ -262,7 +262,7 @@ plugin.findOrCreateUser = async (userData) => {
|
|
|
262
262
|
|
|
263
263
|
plugin.updateUserProfile = async (uid, userData, isNewUser) => {
|
|
264
264
|
winston.debug('consider updateProfile?', isNewUser || plugin.settings.updateProfile === 'on');
|
|
265
|
-
let userObj
|
|
265
|
+
let userObj;
|
|
266
266
|
|
|
267
267
|
/* even update the profile on a new account, since some fields are not initialized by NodeBB */
|
|
268
268
|
if (!isNewUser && plugin.settings.updateProfile !== 'on') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-session-sharing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Allows login sessions from your app to persist in NodeBB",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"readmeFilename": "README.md",
|
|
26
26
|
"nbbpm": {
|
|
27
|
-
"compatibility": "^
|
|
27
|
+
"compatibility": "^4.14.0"
|
|
28
28
|
},
|
|
29
29
|
"husky": {
|
|
30
30
|
"hooks": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@commitlint/cli": "^9.1.2",
|
|
50
50
|
"@commitlint/config-angular": "^7.1.2",
|
|
51
|
-
"eslint": "
|
|
52
|
-
"eslint-config-nodebb": "^
|
|
51
|
+
"eslint": "10.7.0",
|
|
52
|
+
"eslint-config-nodebb": "^2.0.3",
|
|
53
53
|
"husky": "^2.4.0",
|
|
54
54
|
"lint-staged": "^10.0.9",
|
|
55
55
|
"request": "^2.88.2",
|
package/static/lib/admin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
define('admin/plugins/session-sharing', ['settings'], function (Settings) {
|
|
4
|
-
|
|
4
|
+
const ACP = {};
|
|
5
5
|
|
|
6
6
|
ACP.init = function () {
|
|
7
7
|
Settings.load('session-sharing', $('.session-sharing-settings'));
|
|
@@ -20,7 +20,7 @@ define('admin/plugins/session-sharing', ['settings'], function (Settings) {
|
|
|
20
20
|
delete ACP._searchDelay;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
const element = $(this);
|
|
24
24
|
|
|
25
25
|
ACP._searchDelay = setTimeout(function () {
|
|
26
26
|
delete ACP._searchDelay;
|
|
@@ -30,7 +30,7 @@ define('admin/plugins/session-sharing', ['settings'], function (Settings) {
|
|
|
30
30
|
return resultEl.text('');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const qs = decodeURIComponent($.param({
|
|
34
34
|
query: element.val(),
|
|
35
35
|
}));
|
|
36
36
|
|
|
@@ -67,7 +67,7 @@ define('admin/plugins/session-sharing', ['settings'], function (Settings) {
|
|
|
67
67
|
delete ACP._searchDelay;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
const element = $(this);
|
|
71
71
|
|
|
72
72
|
ACP._searchDelay = setTimeout(function () {
|
|
73
73
|
delete ACP._searchDelay;
|
package/static/lib/main.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
$(document).ready(function () {
|
|
4
4
|
if (config.sessionSharing && config.sessionSharing.hostWhitelist) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (
|
|
5
|
+
const hosts = config.sessionSharing.hostWhitelist.split(',') || [config.sessionSharing.hostWhitelist];
|
|
6
|
+
let whitelisted = false;
|
|
7
|
+
for (const host of hosts) {
|
|
8
8
|
if (window && window.location && window.location.host && window.location.host.includes(host)) {
|
|
9
9
|
whitelisted = true;
|
|
10
10
|
break;
|
|
@@ -57,11 +57,13 @@ $(document).ready(function () {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
if (ajaxify.data.sessionSharingBan) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
require(['modals'], function (modals) {
|
|
61
|
+
modals.alert({
|
|
62
|
+
title: '[[error:user-banned]]',
|
|
63
|
+
message: ajaxify.data.sessionSharingBan.ban.expiry > 0 ?
|
|
64
|
+
'[[error:user-banned-reason-until, ' + ajaxify.data.sessionSharingBan.ban.expiry_readable + ', ' + ajaxify.data.sessionSharingBan.ban.reason + ']]' :
|
|
65
|
+
'[[error:user-banned-reason, ' + ajaxify.data.sessionSharingBan.ban.reason + ']]',
|
|
66
|
+
});
|
|
65
67
|
});
|
|
66
68
|
}
|
|
67
69
|
|
package/test/index.js
CHANGED
|
@@ -10,10 +10,10 @@ const url = require('url');
|
|
|
10
10
|
const util = require('util');
|
|
11
11
|
const request = require('request-promise-native');
|
|
12
12
|
|
|
13
|
-
const db =
|
|
13
|
+
const db = nodebb.require('./test/mocks/databasemock');
|
|
14
14
|
|
|
15
|
-
const nconf =
|
|
16
|
-
const meta =
|
|
15
|
+
const nconf = nodebb.require('nconf');
|
|
16
|
+
const meta = nodebb.require('./src/meta');
|
|
17
17
|
|
|
18
18
|
describe('nodebb-plugin-session-sharing', () => {
|
|
19
19
|
const userJar = request.jar();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const winston =
|
|
3
|
+
const winston = nodebb.require('winston');
|
|
4
4
|
|
|
5
|
-
const db =
|
|
6
|
-
const batch =
|
|
7
|
-
const meta =
|
|
5
|
+
const db = nodebb.require('./src/database');
|
|
6
|
+
const batch = nodebb.require('./src/batch');
|
|
7
|
+
const meta = nodebb.require('./src/meta');
|
|
8
8
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: 'Convert remote-to-local user ID from hash to sorted set',
|