Skip to content

Commit adb4019

Browse files
committed
优化附件读取接口逻辑
1 parent fe3931c commit adb4019

7 files changed

Lines changed: 21 additions & 15 deletions

File tree

CHANGELOG.MD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
更新日志文档,版本顺序从新到旧,最新版本在最前(上)面。
44

5+
# 1.0.9
6+
7+
- 优化附件读取接口逻辑
8+
59
# 1.0.8
610

711
- 优化在线流解析接口,给获取下载url添加缓存

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ext {
1414
springContext = '6.0.3'
1515
pf4j = '3.8.0'
1616
lombok = '1.18.24'
17-
libFile = 'lib/api-1.0.5.jar'
17+
libFile = 'lib/api-1.0.6.jar'
1818
}
1919

2020

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
group=run.ikaros.plugin
22
description=A pan115 plugin for ikaros.
3-
version=1.0.8
3+
version=1.0.9
Binary file not shown.

src/main/java/run/ikaros/plugin/pan115/Pan115AttachmentDriverFetcher.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.springframework.util.Assert;
77
import reactor.core.publisher.Flux;
88
import reactor.core.publisher.Mono;
9+
import run.ikaros.api.constant.OpenApiConst;
910
import run.ikaros.api.core.attachment.Attachment;
1011
import run.ikaros.api.core.attachment.AttachmentDriver;
1112
import run.ikaros.api.core.attachment.AttachmentDriverFetcher;
@@ -131,17 +132,18 @@ public Mono<String> parseReadUrl(Attachment attachment) {
131132
if (AttachmentType.Driver_Directory.equals(type)) return Mono.just(attachment.getUrl());
132133
String name = attachment.getName();
133134
Long driverId = attachment.getDriverId();
134-
Mono<AttachmentDriver> checkoutMono = checkoutToken(driverId);
135-
if (FileUtils.isImage(name)) {
136-
return checkoutMono.map(driver -> attachment.getUrl());
137-
} else if (FileUtils.isVideo(name)) {
138-
return checkoutMono.flatMap(driver -> pan115Repository.openVideoPlay(attachment.getUrl()));
139-
} else if (FileUtils.isVoice(name)) {
140-
return parseDownloadUrl(attachment);
141-
} else {
142-
// doc
143-
return checkoutMono.map(driver -> attachment.getUrl());
144-
}
135+
final String attStreamUrl = OpenApiConst.ATT_STREAM_ENDPOINT_PREFIX + '/' + attachment.getId();
136+
return checkoutToken(driverId).map(driver -> attStreamUrl);
137+
// if (FileUtils.isImage(name)) {
138+
// return checkoutMono.map(driver -> attachment.getUrl());
139+
// } else if (FileUtils.isVideo(name)) {
140+
// return checkoutMono.flatMap(driver -> pan115Repository.openVideoPlay(attachment.getUrl()));
141+
// } else if (FileUtils.isVoice(name)) {
142+
// return parseDownloadUrl(attachment);
143+
// } else {
144+
// // doc
145+
// return checkoutMono.map(driver -> attachment.getUrl());
146+
// }
145147
}
146148

147149
@Override

src/main/resources/plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ name: PluginPan115
44
# plugin entry class that extends BasePlugin
55
clazz: run.ikaros.plugin.pan115.Pan115Plugin
66
# plugin 'version' is a valid semantic version string (see semver.org).
7-
version: 1.0.8
8-
requires: ">=1.0.5"
7+
version: 1.0.9
8+
requires: ">=1.0.6"
99
author:
1010
name: Ikaros OSS Team
1111
website: https://github.com/ikaros-dev

0 commit comments

Comments
 (0)