Commit Graph

77 Commits

Author SHA1 Message Date
longjuan
c0fb2b1017 fix: s3 link error when filename renaming enable (#91)
fixes https://github.com/halo-dev/plugin-s3/issues/90
请测试 `上传时重命名文件方式` 选项为**非**保留原文件名时,是否能正常关联s3文件
![image](https://github.com/halo-dev/plugin-s3/assets/28662535/22ab0467-60bd-4c4c-a486-38bc922b7f37)

```release-note
当上传时文件重命名功能开启时关联S3文件错误
```
1.6.0
2023-10-26 06:38:14 +00:00
longjuan
c79fee9ba1 perf: improve s3link role permissions (#89)
1. 新建用户,仅赋予 s3link 权限
2. 测试 关联s3文件功能是否 正常使用
请使用 <ff7af9f0d9> 之后的版本进行测试


```release-note
完善 s3link 角色权限
```
2023-10-26 05:44:12 +00:00
longjuan
08d6ff49c8 feat: add URL suffix to files of specified type (#79)
增加网址后缀功能
![image](https://github.com/halo-dev/plugin-s3/assets/28662535/cd56ed01-70b0-44fc-ae40-110f7c2c1aea)

此功能在文件上传和关联文件均生效

Fix #77 
Fix #68 
```release-note
增加给指定类型的文件加上特定的网址后缀功能
```
2023-10-26 05:42:17 +00:00
longjuan
73112953ba feat: improve the styles of the data list filter area on the mobile devices (#87)
同步 <https://github.com/halo-dev/halo/pull/4587> 中的数据列表过滤器区域的样式改进。
```release-note
同步移动设备上数据列表过滤器区域的样式改进
```
2023-10-16 04:14:13 +00:00
Ryan Wang
84345ef349 chore: update github action (#84)
Signed-off-by: Ryan Wang <i@ryanc.cc>
1.5.0
2023-10-08 06:49:13 -05:00
longjuan
bc4de5fb8e fix: remove v-permission to avoid checkbox disappearing (#83)
移除v-permission以避免复选框消失
fixes https://github.com/halo-dev/plugin-s3/issues/82
```release-note
None
```
2023-10-08 03:32:16 +00:00
John Niang
c91f9981df Remove unused dependencies (#81)
This PR removes unused dependencies.

```release-note
None
```
2023-10-08 02:54:15 +00:00
John Niang
0116ae65d7 Exclude reactive-streams module for runtime classpath (#80)
Halo modified the [class loading order](https://github.com/halo-dev/halo/pull/4663) of plugins in 2.10.x to P (Plugin) D (Dependencies) A (Application), resulting in a LinkageError when the current plugin is actually run.

```java
java.lang.LinkageError: loader constraint violation: when resolving method 'reactor.core.publisher.Flux reactor.core.publisher.Mono.thenMany(org.reactivestreams.Publisher)' the class loader org.pf4j.PluginClassLoader @5da2e534 of the current class, run/halo/s3os/S3OsAttachmentHandler, and the class loader org.springframework.boot.loader.LaunchedURLClassLoader @87aac27 for the method's defining class, reactor/core/publisher/Mono, have different Class objects for the type org/reactivestreams/Publisher used in the signature (run.halo.s3os.S3OsAttachmentHandler is in unnamed module of loader org.pf4j.PluginClassLoader @5da2e534, parent loader org.springframework.boot.loader.LaunchedURLClassLoader @87aac27; reactor.core.publisher.Mono is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @87aac27, parent loader 'app')
        at run.halo.s3os.S3OsAttachmentHandler.lambda$upload$28(S3OsAttachmentHandler.java:298) ~[na:na]
        at reactor.core.publisher.MonoUsing.subscribe(MonoUsing.java:85) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4495) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) ~[reactor-core-3.5.10.jar:3.5.10]
        at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) ~[reactor-core-3.5.10.jar:3.5.10]
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
        at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
```

We just remove the reactive-streams dependency that is already in Halo to resolve the problem.

Fixes https://github.com/halo-dev/halo/issues/4676

/kind bug

```release-note
修复在 Halo 2.10 中无法正常上传的问题
```
2023-10-08 02:40:16 +00:00
longjuan
0265a71c83 chore: Modify upyun compatibility and service provider document hyperlink format (#78)
```release-note
None
```
2023-09-27 08:12:14 +00:00
AcAutomaton
217f1db0de feat: Time placeholder of upload path (#74)
Fixes #69 

```release-note
文件上传路径支持使用`${year}`,`${month}`,`${day}`占位符
```
2023-09-27 08:10:17 +00:00
AcAutomaton
38f2018fb9 chore: correct typos (#76)
```release-note
None
```
2023-09-24 09:56:11 +00:00
Ryan Wang
faa1ad59bb chore: change repo organization to halo-dev (#73)
修改仓库组织为 halo-dev

/kind cleanup

```release-note
None
```
2023-09-19 03:24:21 +00:00
longjuan
f784e3789c chore: Unify the author information of plugin.yaml (#72)
```release-note
None
```
2023-09-19 03:02:20 +00:00
AcAutomaton
e2048028f6 chore: Optimize access_key description (#71)
Fixes #67 

```release-note
优化`Access Key`相关的描述,减少误解
```
2023-09-18 15:52:21 +00:00
longjuan
91a61fd1d2 feat: Associate files originally in s3 (#59)
```release-note
关联从其他渠道上传至 s3 的文件
```
【插件】->【对象存储(Amazon S3 协议)】->【关联s3文件】
![image](https://github.com/halo-sigs/plugin-s3/assets/28662535/83096e23-d362-4924-b2f0-6984683d87cf)
![image](https://github.com/halo-sigs/plugin-s3/assets/28662535/6dd74842-f9a5-4e3c-9a93-36b4b188ecf6)

目前待优化的功能:
- [ ] 列出未关联的文件时会查询多次数据库,期望优化成只查询一次,但是代码改动较大。
2023-09-11 16:04:09 +00:00
AcAutomaton
1b8bef991e feat: automatic random file renaming optional feature (#60)
图片等文件外链往往需要呈现给用户,由于大部分时候我们都是随手创建的新文件或从别处复制粘贴,文件名会如同`无标题.png`等,上传后按照默认策略也会如同`无标题-qiks.png`等,既不美观也会给用户造成困扰。此功能可以在上传文件时将文件名自动替换为UUID、日期、随机字符串等格式。
```release-note
增加自动随机重命名文件可选功能
```
2023-08-29 13:08:14 +00:00
Ryan Wang
52cfa53d7c docs: update usage documentation of readme file (#61)
更新 README 中下载和安装插件的说明。

/kind documentation

```release-note
None 
```
2023-08-12 09:02:10 +00:00
John Niang
c109bbd61f Fallback to default handler for backward compatibility (#57)
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

See https://github.com/halo-sigs/plugin-s3/issues/56 for more.

This PR skips permalink resolution while the object key is missing. So that the default handler will resolve permalink from annotation `storage.halo.run/external-link`

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-sigs/plugin-s3/issues/56

#### Does this PR introduce a user-facing change?

```release-note
解决导入 Halo 1.x 附件后出现“Cannot obtain object key from attachment attachment-xyz”的问题
```
1.4.1
2023-08-01 10:14:54 +00:00
longjuan
2320800907 chore: bump version to 1.4.1 (#53)
```release-note
None
```
2023-07-21 15:58:13 +00:00
John Niang
00537c164c Ensure non-trailing parts are of equal size (#50)
#### What type of PR is this?

/kind improvement

#### What this PR does / why we need it:

Reshape the DataBuffers into parts of the same size (5MB) except for the last part.

#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-sigs/plugin-s3/issues/49

#### Does this PR introduce a user-facing change?

```release-note
保证分片上传时片段大小一致
```
2023-07-05 05:10:11 +00:00
Kevin Zhang
8be39b9898 Impove the readme (#46)
Fixes https://github.com/halo-sigs/plugin-s3/issues/43

桶填写错误:
![image](https://github.com/halo-sigs/plugin-s3/assets/34374831/d3f0855b-5e72-4c59-80c6-017715cd4ba4)

补充桶填写说明:
<img width="895" alt="image" src="https://github.com/halo-sigs/plugin-s3/assets/34374831/d8d2e288-e4e2-4788-95a6-b86d91f4a1ec">


/kind feature

```release-note
完善README.md
```
2023-07-01 08:14:12 +00:00
longjuan
022ecea94f Fix url space error (#41)
Fixes https://github.com/halo-sigs/plugin-s3/issues/40
![image](https://github.com/halo-sigs/plugin-s3/assets/28662535/03bc4ed8-c539-451f-8a88-99084240038a)

```release-note
None
```
1.4.0
2023-06-01 08:23:13 +00:00
John Niang
b3bdd02e08 Fix incorrect setting on TTL of share URL (#39)
Share URL mechanism was provided in https://github.com/halo-sigs/plugin-s3/pull/35, and I set the TTL of the URL with 5 mins incorrectly.

```release-note
None
```
2023-06-01 08:13:16 +00:00
longjuan
5a95b4ced1 Permalink Adaptation Path Style (#38)
Fixes https://github.com/halo-sigs/plugin-s3/issues/37

```release-note
永久链接根据访问风格进行拼接
```

使用Path Style的策略
修改前:
![image](https://github.com/halo-sigs/plugin-s3/assets/28662535/631b33f8-e534-445b-bf1c-3edbc9a543bc)


修改后:
![image](https://github.com/halo-sigs/plugin-s3/assets/28662535/ca6edbd4-8455-4246-b49b-f12afc3ea020)
2023-05-12 16:52:27 +00:00
John Niang
88490bb80f Support to get shared URL and permalink of attachment in handler (#35)
On the Halo side, PR https://github.com/halo-dev/halo/pull/3740 has already added two new methods (`getSharedURL` and `getPermalink`) into AttachmentHandler. Now It's time to implement these two methods so that users can correctly and easily use these two methods.

This PR mainly implements [new AttachmentHandler](11a5807682/api/src/main/java/run/halo/app/core/extension/attachment/endpoint/AttachmentHandler.java). At the same time, I also refactored the build script for a better development experience.

Please note that, those changes might not influence compatibility with Halo 2.0.0. You can have test against Halo 2.0.0 manually.

/kind feature

```release-note
支持获取分享链接和永久链接
```
2023-04-21 12:33:40 +00:00
John Niang
5e9b9f803b Use S3Client instead of S3AsyncClient to avoid waiting two seconds for closing (#30)
Fixes https://github.com/halo-sigs/plugin-s3/issues/23

```release-note
修复文件上传慢的问题
```
2023-04-06 08:06:15 +00:00
longjuan
c635ebede8 perf: auto rename attachment if it exists (#22)
Fixes https://github.com/halo-dev/halo/issues/3337
不更新依赖了,直接复制了FileNameUtils
在有image.png的情况下再同时粘贴两张截图,期望两张都能被上传且被自动重命名。

![image](https://user-images.githubusercontent.com/28662535/220059741-da25a490-6f6a-4172-a393-aa3f84ab6b38.png)
![image](https://user-images.githubusercontent.com/28662535/220059786-24cda2bb-6faa-4377-8eb8-a70920916f3d.png)

```release-note
文件存在时自动重命名
```
2023-02-25 02:38:14 +00:00
miaodi
459cc1cf94 add oracle cloud configuration guide in README (#20)
增加oracle cloud的配置,实测可以上传。
官方文档地址:https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/s3compatibleapi.htm

`Path Style`和`Virtual Hosted Style`均可以配置,并测试成功。
推荐使用`Virtual Hosted Style`方式:

![image](https://user-images.githubusercontent.com/19516717/216295351-5146f5ab-0cf6-43a1-bc6e-ad261c55f198.png)

entrypoint: compat.objectstorage.{region}.oraclecloud.com
将`{region}`替换为上图中`区域`的值

绑定域名留空

![image](https://user-images.githubusercontent.com/19516717/216307619-b54b5829-8341-469d-86b1-dad7e1e65260.png)
`Access Key`和`Access Secret` 在用户设置里面生成`客户秘钥`

```release-note
None
```
2023-02-02 14:20:10 +00:00
SanqianQVQ
780258ffc1 Update README.md (#18)
Added Cloudflare info and use of bright red  for readability.

    None
2023-01-31 10:58:09 +00:00
longjuan
c9f13d4b5f chore: bump version and correct license (#15)
perf: Use async client and multipart upload to avoid out of memory by @longjuan in https://github.com/halo-sigs/plugin-s3/pull/7
feat: add access style options to support minio binding domain names by @longjuan in https://github.com/halo-sigs/plugin-s3/pull/13
feat: check the file already exists before uploading by @longjuan in https://github.com/halo-sigs/plugin-s3/pull/11
```release-note
None
```
1.3.0
2023-01-31 02:22:09 +00:00
longjuan
72af0fcdac chore: add configuration guide in README (#14)
因为增加了访问风格选项,导致配置比较难理解,因此增加配置指南
```release-note
None
```
2023-01-30 02:04:11 +00:00
longjuan
21b752dd25 feat: check the file already exists before uploading (#11)
Fixes https://github.com/halo-dev/halo/issues/2945
```release-note
Add file check with the same name when uploading
```

我这里使用了ConcurrentHashMap避免**同时**上传两个同名文件导致文件覆盖问题,在本地存储策略中是由操作系统保证的
不知道这样是不是一个好方法

S3AsyncClient中没有`doesObjectExist`类似的方法,官方的文档也让用`headObject`捕获异常的办法来判断文件是否存在,详见https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md 中搜索`doesObjectExist`
2023-01-28 06:40:10 +00:00
longjuan
b5c2c50654 feat: add access style options to support minio binding domain names (#13)
Fixes https://github.com/halo-sigs/plugin-s3/issues/12

![image](https://user-images.githubusercontent.com/28662535/213078807-b4f7c877-0e83-4a0f-a87b-871c7a3c73dc.png)
![image](https://user-images.githubusercontent.com/28662535/213078827-b0cd7e93-04af-4f3e-988b-e03db3beb85a.png)

```release-note
add access style options to support minio binding domain names
```

⚠️在发布新版本前在README里增加兼容访问风格相关说明
![image](https://user-images.githubusercontent.com/28662535/213079553-9781c489-b969-4e8f-849e-01f2168f2569.png)
2023-01-28 03:40:09 +00:00
longjuan
1158ea7ae8 perf: Use async client and multipart upload to avoid out of memory (#7)
Fixes https://github.com/halo-sigs/plugin-s3/issues/6
```release-note
Use async client and multipart upload to avoid out of memory
```
2023-01-09 09:48:39 +00:00
longjuan
11087a9915 fix: EndpointProtocol setting item does not take effect (#10)
Fixes https://github.com/halo-sigs/plugin-s3/issues/9
```release-note
fix endpointProtocol setting item does not take effect
```
1.2.1
2023-01-07 09:56:36 +00:00
longjuan
bf3b11b842 Bump version to 1.2.0 (#3)
```release-note
None
```
1.2.0
2022-12-23 04:00:29 +00:00
Ryan Wang
3724a68b87 chore: rename to plugin-s3 (#1) 2022-12-23 11:30:43 +08:00
Ryan Wang
0f531daf2d Create OWNERS (#2) 2022-12-23 11:05:16 +08:00
longjuan
973bc1b3de Merge pull request #7 from longjuan/dev
upgrade sdk version
2022-12-21 22:46:50 -06:00
longjuan
c2e747ab15 extraction public tool 2022-12-21 16:04:27 +08:00
longjuan
fb06ea7172 upgrade aws-java-sdk to 1.12.360 2022-12-20 17:39:31 +08:00
longjuan
12740bfa70 Merge pull request #6 from longjuan/dev
fix MediaType is always application/octet and delete the unimplemented function of restriction extensions
2022-12-19 07:54:20 -06:00
longjuan
5da0fae2b4 Adjust Formatting 2022-12-19 21:51:42 +08:00
longjuan
79c94a29a9 Upgrade version to 1.1.1 2022-12-19 21:41:08 +08:00
longjuan
e9e9b327fe add endpoint protocol help tips 2022-12-19 21:40:55 +08:00
longjuan
dc49669b71 delete the unimplemented function of restriction extensions 2022-12-19 21:30:52 +08:00
longjuan
c7e4c91932 fix: MediaType is always application/octet stream 2022-12-19 21:26:47 +08:00
longjuan
32e748c3d3 Merge pull request #5 from longjuan/dev-update-README
Update README.md
2022-12-17 18:01:57 +08:00
longjuan
732be2f6ed Update README.md 2022-12-17 18:01:22 +08:00
longjuan
a82b75201a Merge pull request #4 from longjuan/dev
add Endpoint access protocol selection
2022-12-17 11:27:10 +08:00