@nocobase/plugin-client 0.7.0-alpha.83 → 0.7.1-alpha.5

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/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default } from './plugin';
1
+ export { default } from './server';
package/lib/index.js CHANGED
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _plugin.default;
9
+ return _server.default;
10
10
  }
11
11
  });
12
12
 
13
- var _plugin = _interopRequireDefault(require("./plugin"));
13
+ var _server = _interopRequireDefault(require("./server"));
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
File without changes
@@ -95,21 +95,28 @@ class ClientPlugin extends _server().Plugin {
95
95
  return _asyncToGenerator(function* () {
96
96
  _this2.app.acl.allow('app', 'getLang');
97
97
 
98
+ _this2.app.acl.allow('app', 'getInfo');
99
+
98
100
  _this2.app.acl.allow('plugins', 'getPinned', 'loggedIn');
99
101
 
100
102
  _this2.app.resource({
101
103
  name: 'app',
102
104
  actions: {
103
105
  getInfo(ctx, next) {
104
- var _this3 = this;
105
-
106
106
  return _asyncToGenerator(function* () {
107
107
  const SystemSetting = ctx.db.getRepository('systemSettings');
108
108
  const systemSetting = yield SystemSetting.findOne();
109
+ const enabledLanguages = systemSetting.get('enabledLanguages') || [];
109
110
  const currentUser = ctx.state.currentUser;
111
+ let lang = (systemSetting === null || systemSetting === void 0 ? void 0 : systemSetting.appLang) || process.env.APP_LANG || 'en-US';
112
+
113
+ if (enabledLanguages.includes(currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang)) {
114
+ lang = currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang;
115
+ }
116
+
110
117
  ctx.body = {
111
- version: _this3.app.getVersion(),
112
- lang: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang) || (systemSetting === null || systemSetting === void 0 ? void 0 : systemSetting.appLang) || process.env.APP_LANG || 'en-US'
118
+ version: yield ctx.app.version.get(),
119
+ lang
113
120
  };
114
121
  yield next();
115
122
  })();
@@ -119,9 +126,16 @@ class ClientPlugin extends _server().Plugin {
119
126
  return _asyncToGenerator(function* () {
120
127
  const SystemSetting = ctx.db.getRepository('systemSettings');
121
128
  const systemSetting = yield SystemSetting.findOne();
129
+ const enabledLanguages = systemSetting.get('enabledLanguages') || [];
122
130
  const currentUser = ctx.state.currentUser;
131
+ let lang = (systemSetting === null || systemSetting === void 0 ? void 0 : systemSetting.appLang) || process.env.APP_LANG || 'en-US';
132
+
133
+ if (enabledLanguages.includes(currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang)) {
134
+ lang = currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang;
135
+ }
136
+
123
137
  ctx.body = {
124
- lang: (currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang) || (systemSetting === null || systemSetting === void 0 ? void 0 : systemSetting.appLang) || process.env.APP_LANG || 'en-US'
138
+ lang
125
139
  };
126
140
  yield next();
127
141
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-client",
3
- "version": "0.7.0-alpha.83",
3
+ "version": "0.7.1-alpha.5",
4
4
  "main": "lib/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "licenses": [
@@ -10,10 +10,10 @@
10
10
  }
11
11
  ],
12
12
  "dependencies": {
13
- "@nocobase/server": "0.7.0-alpha.83"
13
+ "@nocobase/server": "0.7.1-alpha.5"
14
14
  },
15
15
  "devDependencies": {
16
- "@nocobase/test": "0.7.0-alpha.83"
16
+ "@nocobase/test": "0.7.1-alpha.5"
17
17
  },
18
- "gitHead": "838f4f18dcd9ed4fe2ae2660a4918e2a5bd3a869"
18
+ "gitHead": "c9159c6cf4b7deb80e87122d4b7967a510b8ae7c"
19
19
  }