Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e44c9741ed
@ -114,7 +114,9 @@ public class SecurityConfig
|
||||
requests.antMatchers("/login", "/register", "/captchaImage").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/system/file/upload","/evaluation/callback","/flow/**","/flowise/**","/kws/**","/ws/**","/api/grpc/**","/show/**","/node-red/**","/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
.antMatchers("/system/file/upload","/evaluation/callback","/flow/**","/flowise/**","/kws/**","/ws/**","/api/grpc/**","/show/**",
|
||||
"/node-red/**","/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**",
|
||||
"/ti/ui/findNextClickToFunction", "/ti/function/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated();
|
||||
})
|
||||
|
||||
@ -23,8 +23,9 @@ public class FlowCodeNodeHandler implements FlowNodeTypeHandler {
|
||||
String code = inputParams.getString("code");
|
||||
inputParams.remove("code");
|
||||
log.info("code 节点 {} 开始执行", nodeId);
|
||||
JSONObject execute = nashornJsExecutor.execute(code, inputParams);
|
||||
Object execute = nashornJsExecutor.execute(code, inputParams);
|
||||
|
||||
log.info("code 节点 {} 执行完成", nodeId);
|
||||
return TaskNodeExecuteResult.success(execute);
|
||||
return TaskNodeExecuteResult.success(JSONObject.of("result", execute));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.cmvr.test.flow.runtime.operator.edge;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cmvr.common.enums.FileType;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
@ -85,18 +87,18 @@ public class EdgeCameraOperateService implements EdgeOperateService {
|
||||
// // 驾驶偏好
|
||||
// imageUrl = "http://192.168.1.100:9000/cmvr-iot/FILE/20250822/1755849654731.jpg";
|
||||
// }
|
||||
String imageUrl = "http://192.168.1.100:9000/cmvr-iot/IMAGE/20250901/1756718594725.jpg";
|
||||
// String imageUrl = edgeCameraService.getRGBDImages(terminalId, deviceId);
|
||||
// String imageUrl = "http://192.168.1.100:9000/cmvr-iot/IMAGE/20250901/1756718594725.jpg";
|
||||
String imageUrl = edgeCameraService.getRGBDImages(edgeCommonVO);
|
||||
|
||||
// JSONArray imageUrls = new JSONArray();
|
||||
// if (ObjUtil.isNotEmpty(upstreamOutput)) {
|
||||
// JSONArray upstream = upstreamOutput.getJSONArray("imageUrl");
|
||||
// if (ObjUtil.isNotEmpty(upstream)) {
|
||||
// imageUrls.addAll(upstream);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// imageUrls.add(imageUrl);
|
||||
JSONArray imageUrls = new JSONArray();
|
||||
if (ObjUtil.isNotEmpty(upstreamOutput)) {
|
||||
JSONArray upstream = upstreamOutput.getJSONArray("imageUrl");
|
||||
if (ObjUtil.isNotEmpty(upstream)) {
|
||||
imageUrls.addAll(upstream);
|
||||
}
|
||||
}
|
||||
|
||||
imageUrls.add(imageUrl);
|
||||
output.put("imageUrl", imageUrl);
|
||||
output.put("type", FileType.IMAGE.code());
|
||||
break;
|
||||
|
||||
@ -68,14 +68,14 @@ public class NashornJsExecutor {
|
||||
* @param params 传入的参数(Map 或 POJO)
|
||||
* @return 执行结果 Map
|
||||
*/
|
||||
public JSONObject execute(String jsCode, Object params) {
|
||||
public Object execute(String jsCode, Object params) {
|
||||
// 1. 代码安全检查
|
||||
validateCode(jsCode);
|
||||
|
||||
// 2. 提交到线程池执行(支持超时中断)
|
||||
Future<JSONObject> future = executor.submit(new Callable<JSONObject>() {
|
||||
Future<Object> future = executor.submit(new Callable<Object>() {
|
||||
@Override
|
||||
public JSONObject call() throws Exception {
|
||||
public Object call() throws Exception {
|
||||
return doExecute(jsCode, params);
|
||||
}
|
||||
});
|
||||
@ -97,7 +97,7 @@ public class NashornJsExecutor {
|
||||
/**
|
||||
* 实际执行逻辑
|
||||
*/
|
||||
private JSONObject doExecute(String jsCode, Object params) throws ScriptException {
|
||||
private Object doExecute(String jsCode, Object params) throws ScriptException {
|
||||
// 将参数转为 JSON 字符串
|
||||
String jsonParams = toJson(params);
|
||||
|
||||
@ -117,9 +117,9 @@ public class NashornJsExecutor {
|
||||
if (resultJson.length() > MAX_RESULT_SIZE) {
|
||||
throw new RuntimeException("返回结果超过 " + (MAX_RESULT_SIZE/1024/1024) + "MB 限制");
|
||||
}
|
||||
|
||||
return resultJson;
|
||||
// 解析为 Map
|
||||
return fromJson(resultJson);
|
||||
// return fromJson(resultJson);
|
||||
}
|
||||
|
||||
// 更简单的版本:不覆盖 eval,依赖其他安全措施
|
||||
|
||||
Loading…
Reference in New Issue
Block a user