mirror of
https://github.com/dataease/dataease.git
synced 2026-05-18 09:48:10 +08:00
refactor: 视图插件自定义icon
This commit is contained in:
@@ -68,6 +68,8 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/**/*.js", ANON);
|
||||
filterChainDefinitionMap.put("/**/*.css", ANON);
|
||||
filterChainDefinitionMap.put("/**/*.map", ANON);
|
||||
filterChainDefinitionMap.put("/**/*.svg", ANON);
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
||||
filterChainDefinitionMap.put("/api/auth/isPluginLoaded", ANON);
|
||||
@@ -77,6 +79,7 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/api/auth/isOpenOidc", ANON);
|
||||
filterChainDefinitionMap.put("/api/auth/getPublicKey", ANON);
|
||||
filterChainDefinitionMap.put("/api/pluginCommon/component/*", ANON);
|
||||
filterChainDefinitionMap.put("/api/pluginCommon/staticInfo/**", ANON);
|
||||
filterChainDefinitionMap.put("/plugin/oidc/authInfo", ANON);
|
||||
filterChainDefinitionMap.put("/sso/callBack*", ANON);
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ package io.dataease.plugins.server;
|
||||
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.plugins.common.dto.PluginSysMenu;
|
||||
import io.dataease.plugins.common.dto.StaticResource;
|
||||
import io.dataease.plugins.common.service.PluginComponentService;
|
||||
import io.dataease.plugins.common.service.PluginMenuService;
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -102,4 +104,43 @@ public class PluginCommonServer {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@GetMapping("/staticInfo/{name}/{suffix}")
|
||||
public void staticInfo(@PathVariable("name") String name, @PathVariable("suffix") String suffix) {
|
||||
Map<String, PluginComponentService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(PluginComponentService.class);
|
||||
beansOfType.values().stream().forEach(service -> {
|
||||
List<StaticResource> staticResources = service.staticResources();
|
||||
|
||||
if (staticResources.stream().anyMatch(resource -> resource.match(name, suffix))) {
|
||||
HttpServletResponse response = ServletUtils.response();
|
||||
BufferedInputStream bis = null;
|
||||
InputStream inputStream = null;
|
||||
OutputStream os = null; //输出流
|
||||
try{
|
||||
inputStream = service.vueResource(name, suffix);
|
||||
byte[] buffer = new byte[1024];
|
||||
os = response.getOutputStream();
|
||||
bis = new BufferedInputStream(inputStream);
|
||||
int i = bis.read(buffer);
|
||||
while(i != -1){
|
||||
os.write(buffer, 0, i);
|
||||
i = bis.read(buffer);
|
||||
}
|
||||
response.setContentType("image/svg+xml");
|
||||
os.flush();
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
bis.close();
|
||||
inputStream.close();
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user