cabloy 5.1.183 → 5.1.184
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/.cabloy-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
5.1.
|
|
1
|
+
5.1.184
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Next } from 'vona';
|
|
2
2
|
import type { IDecoratorGuardOptionsGlobal, IGuardExecute } from 'vona-module-a-aspect';
|
|
3
3
|
|
|
4
|
-
import { BeanBase, Global, useApp } from 'vona';
|
|
4
|
+
import { $protocolKey, BeanBase, Global, useApp } from 'vona';
|
|
5
5
|
import { Guard } from 'vona-module-a-aspect';
|
|
6
6
|
|
|
7
7
|
const app = useApp();
|
|
@@ -40,12 +40,19 @@ export interface IGuardOptionsDemonstration extends IDecoratorGuardOptionsGlobal
|
|
|
40
40
|
'/home/user/passport/createPassportJwtFromOauthCode',
|
|
41
41
|
'/home/user/passport/createTempAuthToken',
|
|
42
42
|
'/auth/passport/callback',
|
|
43
|
+
'/auth/mock/authorize',
|
|
44
|
+
'/captcha/create',
|
|
45
|
+
'/image/upload-policy',
|
|
46
|
+
'/file/upload-policy',
|
|
43
47
|
],
|
|
44
48
|
dependencies: 'a-user:passport',
|
|
45
49
|
})
|
|
46
50
|
@Global()
|
|
47
51
|
export class GuardDemonstration extends BeanBase implements IGuardExecute {
|
|
48
52
|
async execute(options: IGuardOptionsDemonstration, next: Next): Promise<boolean> {
|
|
53
|
+
const headerOpenapiSchema = this.ctx.headers[$protocolKey('x-vona-openapi-schema')];
|
|
54
|
+
if (headerOpenapiSchema?.toString() === 'true') return next();
|
|
55
|
+
|
|
49
56
|
const method = this.ctx.method.toUpperCase();
|
|
50
57
|
if (!options.methodsForWrite.some(item => item.toUpperCase() === method)) {
|
|
51
58
|
return next();
|