improvement: device 更名为 env
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package net.geedge.api.config;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import net.geedge.api.entity.DeviceApiYml;
|
||||
import net.geedge.api.entity.EnvApiYml;
|
||||
import net.geedge.common.T;
|
||||
import org.springframework.web.socket.BinaryMessage;
|
||||
import org.springframework.web.socket.CloseStatus;
|
||||
@@ -17,9 +17,9 @@ public class VncProxyHandler extends TextWebSocketHandler {
|
||||
|
||||
private static final Log log = Log.get();
|
||||
|
||||
private DeviceApiYml.Vnc vnc;
|
||||
private EnvApiYml.Vnc vnc;
|
||||
|
||||
public VncProxyHandler(DeviceApiYml.Vnc vnc) {
|
||||
public VncProxyHandler(EnvApiYml.Vnc vnc) {
|
||||
this.vnc = vnc;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.geedge.api.config;
|
||||
|
||||
import net.geedge.api.entity.DeviceApiYml;
|
||||
import net.geedge.api.entity.EnvApiYml;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
@@ -12,10 +12,10 @@ import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry
|
||||
public class WebSocketConfig implements WebSocketConfigurer {
|
||||
|
||||
@Autowired
|
||||
private DeviceApiYml deviceApiYml;
|
||||
private EnvApiYml envApiYml;
|
||||
|
||||
@Override
|
||||
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
|
||||
registry.addHandler(new VncProxyHandler(deviceApiYml.getVnc()), "/api/v1/device/websocket").setAllowedOrigins("*");
|
||||
registry.addHandler(new VncProxyHandler(envApiYml.getVnc()), "/api/v1/env/websocket").setAllowedOrigins("*");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.geedge.api.controller;
|
||||
|
||||
import cn.hutool.core.codec.Base32Codec;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import net.geedge.api.entity.DeviceApiYml;
|
||||
import net.geedge.api.entity.EnvApiYml;
|
||||
import net.geedge.api.util.AdbUtil;
|
||||
import net.geedge.common.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -15,14 +15,14 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/device")
|
||||
@RequestMapping("/api/v1/env")
|
||||
public class APIController {
|
||||
|
||||
private final AdbUtil adbUtil;
|
||||
|
||||
@Autowired
|
||||
public APIController(DeviceApiYml deviceApiYml) {
|
||||
this.adbUtil = AdbUtil.getInstance(deviceApiYml.getAdb());
|
||||
public APIController(EnvApiYml envApiYml) {
|
||||
this.adbUtil = AdbUtil.getInstance(envApiYml.getAdb());
|
||||
}
|
||||
|
||||
@GetMapping("/status")
|
||||
|
||||
@@ -3,14 +3,14 @@ package net.geedge.api.entity;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeviceApiYml {
|
||||
public class EnvApiYml {
|
||||
|
||||
private Device device;
|
||||
private Env env;
|
||||
private Adb adb;
|
||||
private Vnc vnc;
|
||||
|
||||
@Data
|
||||
public class Device {
|
||||
public class Env {
|
||||
String type;
|
||||
String platform;
|
||||
String root;
|
||||
@@ -3,7 +3,7 @@ package net.geedge.api.util;
|
||||
import cn.hutool.core.codec.Base32Codec;
|
||||
import cn.hutool.core.thread.NamedThreadFactory;
|
||||
import cn.hutool.log.Log;
|
||||
import net.geedge.api.entity.DeviceApiYml;
|
||||
import net.geedge.api.entity.EnvApiYml;
|
||||
import net.geedge.common.APIException;
|
||||
import net.geedge.common.Constant;
|
||||
import net.geedge.common.RCode;
|
||||
@@ -38,7 +38,7 @@ public class AdbUtil {
|
||||
public record CommandResult(Integer exitCode, String output) {
|
||||
}
|
||||
|
||||
private AdbUtil(DeviceApiYml.Adb adb) {
|
||||
private AdbUtil(EnvApiYml.Adb adb) {
|
||||
this.serial = T.StrUtil.emptyToDefault(adb.getSerial(), "");
|
||||
this.host = adb.getHost();
|
||||
this.port = adb.getPort();
|
||||
@@ -48,7 +48,7 @@ public class AdbUtil {
|
||||
this.init();
|
||||
}
|
||||
|
||||
public static AdbUtil getInstance(DeviceApiYml.Adb connInfo) {
|
||||
public static AdbUtil getInstance(EnvApiYml.Adb connInfo) {
|
||||
if (instance == null) {
|
||||
synchronized (AdbUtil.class) {
|
||||
if (instance == null) {
|
||||
|
||||
Reference in New Issue
Block a user