Conversation
hi @cooker 感谢你对此提交PR,不过为了方便你应该在描述中说明该如何测试它 |
@cooker 非常感谢你的贡献,不过我测试的过程中功能上还有些小问题,比如我访问http://localhost:8090/plugins/web/potatoes/abc/ 时 报错会提示 NOT FOUND potatoes/abc/.ftl 或许带/应该访问的是potatoes/abc/index.ftl |
|
||
public class FileViewerTest { | ||
public static void main(String[] args) throws IOException { | ||
// String file = "F:\\IT\\Code\\halo-plugin-experimental\\build\\plugins\\plugin-potatoes-1.0-SNAPSHOT.zip"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cooker 这个测试文件只能运行在windows机器上而无法运行在ci或我的linux 可以将绝对路径改为相对路径或通过Files创建临时目录来编写
//task zipStatic(type: Zip) { | ||
// from 'src/main/resources/static/' | ||
// include '*' | ||
// include '*/*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cooker 这些不需要的注释需要删一下
<div> | ||
<p>Index abc</p> | ||
</div> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cooker 行末需要一个空行
<div> | ||
<p>Index</p> | ||
</div> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cooker 同上
final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:**/"+pluginId+"-*.jar"); | ||
try { | ||
final Path[] sourcePath = {null}; | ||
Files.walkFileTree(path, new SimpleFileVisitor<Path>(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cooker 我认为没有必要去遍历目录 效率太低了 特别时目录很深时,在 deployment 模式下通过
Path path = event.getPlugin().getPluginPath().toAbsolutePath();
已经可以获取到目录。
而在 development 模式下加载插件时使用的是 build/classes的内容因此实际是没有使用jar包的但是这里的静态文件加载还是依赖jar并且还解压了,我认为在开发模式下应该区别对待 可以直接通过插件类加载器获取到静态文件的目录直接复制到 halo的工作目录即可 无需使用 new ZipFile(args)
处理,运行模式可以通过event.getPlugin().getRuntimeMode()
来获取
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
hi @cooker 此PR是否还在继续 |
此 PR 太久未活跃 我将关闭它 如有后续可以重新open |
测试流程
以potatoes 项目为例,在resources/static 新增需要的js、css、flt等静态资源。并build(打包)
本地调试