增加获取patch接口,未测试
This commit is contained in:
@@ -2,7 +2,8 @@ FROM eclipse-temurin:17-jdk-jammy
|
|||||||
MAINTAINER TongTongStudio <tongtongstudios@gmail.com>
|
MAINTAINER TongTongStudio <tongtongstudios@gmail.com>
|
||||||
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
|
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
|
||||||
VOLUME /tmp
|
VOLUME /tmp
|
||||||
|
RUN cd /tmp
|
||||||
ADD bsdiff .
|
ADD bsdiff .
|
||||||
ADD target/*.jar app.jar
|
ADD target/*.jar app.jar
|
||||||
EXPOSE 65534
|
EXPOSE map[65534/tcp:{}]
|
||||||
ENTRYPOINT ["java", "-jar", "/app.jar"]
|
ENTRYPOINT ["java", "-jar", "/app.jar"]
|
||||||
@@ -1,13 +1,25 @@
|
|||||||
package com.mir4updater.backend.controller.apk;
|
package com.mir4updater.backend.controller.apk;
|
||||||
|
|
||||||
|
import com.mir4updater.backend.entity.PatchFileInfo;
|
||||||
|
import com.mir4updater.backend.result.Result;
|
||||||
|
import com.mir4updater.backend.service.DiffPathService;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class CheckPatchController {
|
public class CheckPatchController {
|
||||||
public static Logger logger = LogManager.getLogger(CheckPatchController.class);
|
public static Logger logger = LogManager.getLogger(CheckPatchController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
DiffPathService diffPathService;
|
||||||
|
|
||||||
|
@GetMapping("/android/check_patch")
|
||||||
|
public Result checkPatch(@RequestParam("pkg") String pkg, @RequestParam(value = "version_code") Long versionCode) {
|
||||||
|
PatchFileInfo patchFileInfo = diffPathService.getPatchInfo(pkg, versionCode);
|
||||||
|
return Result.success(patchFileInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class PatchFileInfo implements Serializable {
|
|||||||
String packageName;
|
String packageName;
|
||||||
|
|
||||||
@Column(name = "old_version", nullable = false)
|
@Column(name = "old_version", nullable = false)
|
||||||
long old_version;
|
long oldVersion;
|
||||||
|
|
||||||
@Column(name = "old_md5", nullable = false)
|
@Column(name = "old_md5", nullable = false)
|
||||||
String old_md5;
|
String old_md5;
|
||||||
@@ -32,7 +32,7 @@ public class PatchFileInfo implements Serializable {
|
|||||||
String old_sha256;
|
String old_sha256;
|
||||||
|
|
||||||
@Column(name = "new_version", nullable = false)
|
@Column(name = "new_version", nullable = false)
|
||||||
long new_version;
|
long newVersion;
|
||||||
|
|
||||||
@Column(name = "new_md5", nullable = false)
|
@Column(name = "new_md5", nullable = false)
|
||||||
String new_md5;
|
String new_md5;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.mir4updater.backend.repository;
|
package com.mir4updater.backend.repository;
|
||||||
|
|
||||||
import com.mir4updater.backend.entity.ApkInfo;
|
import com.mir4updater.backend.entity.PatchFileInfo;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
//public class PatchInfoRepository extends JpaRepository<ApkInfo, Long> {
|
public interface PatchInfoRepository extends JpaRepository<PatchFileInfo, Long> {
|
||||||
//}
|
public PatchFileInfo findPatchFileInfoByPackageNameAndOldVersion(String packageName, Long version);
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
package com.mir4updater.backend.service;
|
package com.mir4updater.backend.service;
|
||||||
|
|
||||||
|
import com.mir4updater.backend.entity.PatchFileInfo;
|
||||||
|
import com.mir4updater.backend.repository.PatchInfoRepository;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DiffPathService {
|
public class DiffPathService {
|
||||||
|
@Autowired
|
||||||
|
PatchInfoRepository patchInfoRepository;
|
||||||
|
|
||||||
|
public PatchFileInfo getPatchInfo(String packageName, Long oldVersion) {
|
||||||
|
return patchInfoRepository.findPatchFileInfoByPackageNameAndOldVersion(packageName, oldVersion);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
spring.application.name=Mir4Updater
|
spring.application.name=Mir4Updater
|
||||||
server.port=65534
|
server.port=65534
|
||||||
|
server.address=0.0.0.0
|
||||||
## \u6570\u636E\u8FDE\u63A5\u4FE1\u606F
|
## \u6570\u636E\u8FDE\u63A5\u4FE1\u606F
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3305/spring_boot?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
spring.datasource.url=jdbc:mysql://127.0.0.1:3305/spring_boot?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
||||||
|
|||||||
Reference in New Issue
Block a user