diff --git a/Dockerfile b/Dockerfile index 6ce59ec..91cd262 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,8 @@ RUN ls COPY production.env production.env COPY production.env development.env # Run the container under "node" user by default +RUN mkdir apk +COPY ./apk/app.apk apk/app.apk USER node CMD [ "node", "main.js" ] diff --git a/src/apk/app.apk b/src/apk/app.apk new file mode 100644 index 0000000..7810f45 Binary files /dev/null and b/src/apk/app.apk differ diff --git a/src/app.controller.ts b/src/app.controller.ts index ce6e4f6..462a2ba 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -1,4 +1,4 @@ -import { BadRequestException, Body, Controller, Get, Post, Put, Query, Req } from '@nestjs/common'; +import { BadRequestException, Body, Controller, Get, Post, Put, Query, Req, Res } from '@nestjs/common'; import { AppService } from './app.service'; import * as fs from 'fs'; import { ApiBearerAuth, ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; @@ -13,6 +13,7 @@ import { InjectRepository } from '@nestjs/typeorm'; import axios from 'axios'; import { v4 as uuid } from 'uuid'; import { verificationService } from './lib/face'; +import { join } from 'path'; export class Electronics { @ApiProperty({ description: "电子产品名称" }) @@ -584,4 +585,25 @@ export class AppController { }; } } + + @Get('version.json') + async version( + @Req() req: any, + ): Promise { + return { + "versionName":"1.1.2", + "apkUrl":`http://${process.env.LOCAL_IP}/app.apk`, + "forceUpdate": false, + "whatsNew": "新版本更新" + }; + } + + @Get('app.apk') + async file( + @Res() res: any, + ): Promise { + const file_path = join(__dirname, "./apk/app.apk") + + res.sendFile(file_path) + } }