@fecommunity/reactpress 3.0.0 → 3.0.2
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/README.md +67 -21
- package/bin/reactpress.js +8 -5
- package/dist/index.js +0 -0
- package/lib/api-dev.js +4 -4
- package/lib/bootstrap.js +2 -2
- package/lib/build.js +130 -13
- package/lib/dev.js +2 -14
- package/lib/i18n/strings.js +32 -2
- package/lib/lifecycle.js +8 -8
- package/lib/paths.js +39 -19
- package/lib/pm2.js +2 -2
- package/lib/publish.js +9 -0
- package/lib/root.js +63 -6
- package/lib/spawn.js +15 -10
- package/lib/status.js +1 -1
- package/package.json +7 -4
- package/server/dist/app.module.js +1 -26
- package/server/dist/app.module.js.map +1 -1
- package/server/dist/modules/article/article.controller.d.ts +1 -6
- package/server/dist/modules/article/article.controller.js +1 -45
- package/server/dist/modules/article/article.controller.js.map +1 -1
- package/server/dist/modules/article/article.entity.d.ts +0 -1
- package/server/dist/modules/article/article.entity.js +0 -5
- package/server/dist/modules/article/article.entity.js.map +1 -1
- package/server/dist/modules/article/article.module.js +2 -14
- package/server/dist/modules/article/article.module.js.map +1 -1
- package/server/dist/modules/article/article.service.d.ts +1 -9
- package/server/dist/modules/article/article.service.js +5 -59
- package/server/dist/modules/article/article.service.js.map +1 -1
- package/server/dist/modules/auth/auth.service.js +3 -4
- package/server/dist/modules/auth/auth.service.js.map +1 -1
- package/server/dist/modules/auth/jwt-auth.guard.js +1 -2
- package/server/dist/modules/auth/jwt-auth.guard.js.map +1 -1
- package/server/dist/modules/auth/jwt.strategy.js +1 -2
- package/server/dist/modules/auth/jwt.strategy.js.map +1 -1
- package/server/dist/modules/category/category.service.js +2 -3
- package/server/dist/modules/category/category.service.js.map +1 -1
- package/server/dist/modules/comment/comment.module.js +1 -10
- package/server/dist/modules/comment/comment.module.js.map +1 -1
- package/server/dist/modules/comment/comment.service.d.ts +1 -3
- package/server/dist/modules/comment/comment.service.js +5 -15
- package/server/dist/modules/comment/comment.service.js.map +1 -1
- package/server/dist/modules/knowledge/knowledge.service.js +2 -3
- package/server/dist/modules/knowledge/knowledge.service.js.map +1 -1
- package/server/dist/modules/page/page.service.js +1 -2
- package/server/dist/modules/page/page.service.js.map +1 -1
- package/server/dist/modules/smtp/smtp.service.js +1 -2
- package/server/dist/modules/smtp/smtp.service.js.map +1 -1
- package/server/dist/modules/tag/tag.service.js +2 -3
- package/server/dist/modules/tag/tag.service.js.map +1 -1
- package/server/dist/modules/user/user.controller.js +3 -4
- package/server/dist/modules/user/user.controller.js.map +1 -1
- package/server/dist/modules/user/user.service.js +9 -10
- package/server/dist/modules/user/user.service.js.map +1 -1
- package/server/dist/starter.js +1 -1
- package/server/dist/tsconfig.build.tsbuildinfo +11335 -11537
- package/server/dist/utils/oss.util.js +1 -2
- package/server/dist/utils/oss.util.js.map +1 -1
- package/templates/env.default +1 -1
- package/templates/package.json +3 -2
- package/ui/banner.js +2 -2
- package/ui/interactive.js +20 -4
|
@@ -24,7 +24,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.UserService = void 0;
|
|
27
|
-
const api_messages_1 = require("../../common/api-messages");
|
|
28
27
|
const common_1 = require("@nestjs/common");
|
|
29
28
|
const config_1 = require("@nestjs/config");
|
|
30
29
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
@@ -73,15 +72,15 @@ let UserService = class UserService {
|
|
|
73
72
|
const { name, password } = user;
|
|
74
73
|
if (!ignoreValidator) {
|
|
75
74
|
if (!name || !password) {
|
|
76
|
-
throw new common_1.HttpException(
|
|
75
|
+
throw new common_1.HttpException('请输入用户名和密码', common_1.HttpStatus.BAD_REQUEST);
|
|
77
76
|
}
|
|
78
77
|
if (!user_util_1.isValidUsername(name)) {
|
|
79
|
-
throw new common_1.HttpException(
|
|
78
|
+
throw new common_1.HttpException('用户名不能包含空格和非法字符', common_1.HttpStatus.BAD_REQUEST);
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
const existUser = await this.userRepository.findOne({ where: { name } });
|
|
83
82
|
if (existUser) {
|
|
84
|
-
throw new common_1.HttpException(
|
|
83
|
+
throw new common_1.HttpException('用户已存在', common_1.HttpStatus.BAD_REQUEST);
|
|
85
84
|
}
|
|
86
85
|
const newUser = await this.userRepository.create(user);
|
|
87
86
|
await this.userRepository.save(newUser);
|
|
@@ -91,10 +90,10 @@ let UserService = class UserService {
|
|
|
91
90
|
const { name, password } = user;
|
|
92
91
|
const existUser = await this.userRepository.findOne({ where: { name } });
|
|
93
92
|
if (!existUser || !(await user_entity_1.User.comparePassword(password, existUser.password))) {
|
|
94
|
-
throw new common_1.HttpException(
|
|
93
|
+
throw new common_1.HttpException('用户名或密码错误', common_1.HttpStatus.BAD_REQUEST);
|
|
95
94
|
}
|
|
96
95
|
if (existUser.status === 'locked') {
|
|
97
|
-
throw new common_1.HttpException(
|
|
96
|
+
throw new common_1.HttpException('用户已锁定,无法登录', common_1.HttpStatus.BAD_REQUEST);
|
|
98
97
|
}
|
|
99
98
|
delete existUser.password;
|
|
100
99
|
return existUser;
|
|
@@ -103,7 +102,7 @@ let UserService = class UserService {
|
|
|
103
102
|
const { name } = user;
|
|
104
103
|
const existUser = await this.userRepository.findOne({ where: { name } });
|
|
105
104
|
if (existUser.status === 'locked') {
|
|
106
|
-
throw new common_1.HttpException(
|
|
105
|
+
throw new common_1.HttpException('用户已锁定,无法登录', common_1.HttpStatus.BAD_REQUEST);
|
|
107
106
|
}
|
|
108
107
|
delete existUser.password;
|
|
109
108
|
return existUser;
|
|
@@ -114,7 +113,7 @@ let UserService = class UserService {
|
|
|
114
113
|
async updateById(currentUser, id, user) {
|
|
115
114
|
if (user.role === 'admin') {
|
|
116
115
|
if (!currentUser || currentUser.role !== 'admin') {
|
|
117
|
-
throw new common_1.HttpException(
|
|
116
|
+
throw new common_1.HttpException('您无权操作', common_1.HttpStatus.FORBIDDEN);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
const oldUser = await this.userRepository.findOne(id);
|
|
@@ -122,7 +121,7 @@ let UserService = class UserService {
|
|
|
122
121
|
if (user.name && user.name !== oldUser.name) {
|
|
123
122
|
const existUser = await this.userRepository.findOne({ where: { name: user.name } });
|
|
124
123
|
if (existUser) {
|
|
125
|
-
throw new common_1.HttpException(
|
|
124
|
+
throw new common_1.HttpException('用户已存在', common_1.HttpStatus.BAD_REQUEST);
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
const newUser = await this.userRepository.merge(oldUser, user);
|
|
@@ -132,7 +131,7 @@ let UserService = class UserService {
|
|
|
132
131
|
const existUser = await this.userRepository.findOne(id);
|
|
133
132
|
const { oldPassword, newPassword } = user;
|
|
134
133
|
if (!existUser || !(await user_entity_1.User.comparePassword(oldPassword, existUser.password))) {
|
|
135
|
-
throw new common_1.HttpException(
|
|
134
|
+
throw new common_1.HttpException('用户名或密码错误', common_1.HttpStatus.BAD_REQUEST);
|
|
136
135
|
}
|
|
137
136
|
const hashNewPassword = user_entity_1.User.encryptPassword(newPassword);
|
|
138
137
|
const newUser = await this.userRepository.merge(existUser, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../../src/modules/user/user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"user.service.js","sourceRoot":"","sources":["../../../src/modules/user/user.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,2CAA+C;AAC/C,6CAAmD;AACnD,qCAAsD;AACtD,qDAAwD;AAExD,+CAAqC;AAGrC,IAAa,WAAW,GAAxB,MAAa,WAAW;IACtB,YAEmB,cAAgC,EAChC,aAA4B;QAD5B,mBAAc,GAAd,cAAc,CAAkB;QAChC,kBAAa,GAAb,aAAa,CAAe;QAE7C,MAAM,IAAI,GAA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E,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAE1C,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,MAAM,kBAAI,CAAC,eAAe,CAAC,WAAW,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE;YAChF,MAAM,IAAI,sBAAa,CACrB,UAAU,EAEV,mBAAU,CAAC,WAAW,CACvB,CAAC;SACH;QAED,MAAM,eAAe,GAAG,kBAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAC1D,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE;YACzD,QAAQ,EAAE,eAAe;SAC1B,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,OAAO,CAAC,CAAC;IACX,CAAC;CACF,CAAA;AA/LY,WAAW;IADvB,mBAAU,EAAE;IAGR,WAAA,0BAAgB,CAAC,kBAAI,CAAC,CAAA;qCACU,oBAAU;QACX,sBAAa;GAJpC,WAAW,CA+LvB;AA/LY,kCAAW"}
|
package/server/dist/starter.js
CHANGED
|
@@ -34,7 +34,7 @@ async function bootstrap() {
|
|
|
34
34
|
const swaggerConfig = new swagger_1.DocumentBuilder()
|
|
35
35
|
.setTitle('ReactPress API Documentation')
|
|
36
36
|
.setDescription('Comprehensive API documentation for ReactPress - A modern content management system built with NestJS')
|
|
37
|
-
.setVersion('
|
|
37
|
+
.setVersion('2.0')
|
|
38
38
|
.setContact('ReactPress Team', 'https://github.com/fecommunity/reactpress', 'admin@gaoredu.com')
|
|
39
39
|
.setLicense('MIT', 'https://github.com/fecommunity/reactpress/blob/main/LICENSE')
|
|
40
40
|
.addServer(configService.get('SERVER_SITE_URL', 'http://localhost:3002'), 'API Server')
|