midway-fatcms 0.0.1-beta.34 → 0.0.1-beta.36

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.
@@ -11,7 +11,6 @@ interface HttpGetRes {
11
11
  */
12
12
  export declare class StaticController extends BaseApiController {
13
13
  protected ctx: Context;
14
- constructor();
15
14
  private getLocalPaths;
16
15
  private initNotFoundList;
17
16
  private responseLocalFile;
@@ -20,6 +20,7 @@ const fs2 = require("fs");
20
20
  const path = require("path");
21
21
  const https = require("https");
22
22
  const functions_1 = require("../../libs/utils/functions");
23
+ const schedule_1 = require("../../schedule");
23
24
  function getPathConfig(ossName) {
24
25
  const remoteBaseUrlMap = {
25
26
  cdnjsx: 'https://cdnjsx.oss-cn-shanghai.aliyuncs.com',
@@ -43,12 +44,9 @@ let notFoundListIsInit = false;
43
44
  * 静态文件代理功能
44
45
  */
45
46
  let StaticController = class StaticController extends BaseApiController_1.BaseApiController {
46
- constructor() {
47
- super();
48
- this.initNotFoundList();
49
- }
50
47
  getLocalPaths() {
51
- const appDir = this.app.getAppDir();
48
+ const app = schedule_1.ANONYMOUS_CONTEXT.getApp();
49
+ const appDir = app.getAppDir();
52
50
  const localDir = path.join(appDir, './public/static'); // 本地文件存储目录
53
51
  const notFoundListFile = path.join(localDir, '__404__list.json'); // 404列表文件
54
52
  return {
@@ -125,6 +123,7 @@ let StaticController = class StaticController extends BaseApiController_1.BaseAp
125
123
  return false;
126
124
  }
127
125
  async proxyStaticFile(ossName, relativePath) {
126
+ await this.initNotFoundList();
128
127
  const { localDir } = this.getLocalPaths();
129
128
  const PATH_CONFIG = getPathConfig(ossName);
130
129
  // 构建本地路径和远程路径
@@ -282,7 +281,6 @@ __decorate([
282
281
  __metadata("design:returntype", Promise)
283
282
  ], StaticController.prototype, "proxyStaticFile", null);
284
283
  StaticController = __decorate([
285
- (0, core_1.Controller)('/ns/static'),
286
- __metadata("design:paramtypes", [])
284
+ (0, core_1.Controller)('/ns/static')
287
285
  ], StaticController);
288
286
  exports.StaticController = StaticController;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "midway-fatcms",
3
- "version": "0.0.1-beta.34",
3
+ "version": "0.0.1-beta.36",
4
4
  "description": "This is a midway component sample",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",