Commit Graph

69 Commits

Author SHA1 Message Date
guqing
40f66ff665 chore: remove deprecated plugin wrapper (#161)
### What this PR does?
移除对已过时的 PluginWrapper 的引用,Halo 2.18.0 版本后将不在支持从 BasePlugin 中获取 PluginWrapper ,也不再支持依赖注入 PluginWrapper,使用 PluginContext 代替

see also https://github.com/halo-dev/halo/pull/6243 for more details

```release-note
None
```
2024-07-02 15:29:25 +00:00
longjuan
cb968de154 fix: apply natural ordering to policy and attachment listings (#160)
```release-note
None
```
传递unsorted以支持Halo 2.17版本
2024-07-02 15:27:25 +00:00
longjuan
bdd62cbe12 faet: Add file prefix search function in s3link (#153)
```release-note
在 S3关联 中支持文件名前缀搜索
```
fixes https://github.com/halo-dev/plugin-s3/issues/142
2024-06-16 12:30:45 +00:00
longjuan
6b62ce7aa4 Hide the permission of the verification interface (#147)
fixes https://github.com/halo-dev/plugin-s3/issues/146
```release-note
在角色创建中隐藏配置校验接口的权限
```
2024-05-06 10:34:54 +00:00
Ryan Wang
c60e31a033 chore: update plugin.yaml file (#138)
完善插件定义文件。

1. 将 homepage 字段指向 Halo 应用市场的地址。
2. 新增 repo 字段指向源码仓库地址。
3. 新增 issues 字段指向 GitHub issues 地址。

```release-note
None
```
2024-05-05 08:39:33 +00:00
Chenhe
7a9b0de0c6 improve usage tips in settings page (#140)
使用占位组件在设置页面展示信息并不恰当,并且此项目作为存储插件的 Example 工程易误导其他开发者。

调整为利用 FormKit `el` 特性实现。

问题背景:https://github.com/halo-dev/halo/issues/5802

**Preview - old**
<img width="373" alt="image" src="https://github.com/halo-dev/plugin-s3/assets/10266066/ac4aaede-6377-459f-a866-9bfe132906af">

**Preview - new**
<img width="373" alt="image" src="https://github.com/halo-dev/plugin-s3/assets/10266066/f884417c-045a-4396-84be-633d18ae36c9">

```release-note
优化调整提示的提示
```
2024-04-28 11:54:48 +00:00
longjuan
47b6a37d0a feat: add verification function to the configuration of s3 object storage policy (#134)
```release-note
在 S3 存储策略配置中增加了验证配置的功能。
```
fixes https://github.com/halo-dev/plugin-s3/issues/132
2024-04-22 04:26:10 +00:00
longjuan
68b1a88b14 Fix original file name being incorrectly replaced (#129) 2024-04-14 20:25:05 +08:00
longjuan
f4ec56b7bc perf: optimize s3link interfaces using index mechanisms (#127)
* perf: optimize s3link list queries using index mechanisms
2024-04-03 12:10:54 +08:00
Ryan Wang
034b3f3ded chore: rename displayName to S3 对象存储 (#128)
在 Halo 完成动态数据的 i18n 之前,使用中文描述存储策略名称。

/kind improvement

<img width="821" alt="image" src="https://github.com/halo-dev/plugin-s3/assets/21301288/bc5fd32c-f7fc-43de-8bc4-cdbdd7e940d6">

```release-note
修改存储策略名称为中文显示。
```
2024-03-24 11:54:08 +00:00
longjuan
2503c6eba1 fix: Correct the formatting of Milliseconds to be a 3-digit number (#126)
```release-note
修复重命名模板中 millisecond 没有被格式化3位数的问题
```
2024-03-18 01:44:08 +00:00
longjuan
73bd9e9948 chore: correcting incorrect policy template field help text (#124)
```release-note
None
```
2024-03-01 12:41:02 +00:00
longjuan
a16bbde9dd feat: add support for custom template in automatic renaming during upload (#115)
```release-note
上传自动重命名支持自定义模板,支持更多占位符
```

fixes #110
fixes #98
2024-02-29 13:53:38 +00:00
longjuan
9efa4b97e5 chore: remove plugin view permissions from S3 Link permission dependency (#121)
```release-note
None
```
入口已从插件设置页移除,移除依赖插件查看权限
2024-02-25 05:22:08 +00:00
Ryan Wang
2b0dd98575 refactor: place the entry for the S3 link page in the side menu (#116)
将 S3 关联页面放置在左侧菜单。

/kind improvement

Note: 此特性需要运行在 Halo 2.12 才生效,所以此 PR 同时修改了 requires。

<img width="1920" alt="image" src="https://github.com/halo-dev/plugin-s3/assets/21301288/a78d7837-81c2-4c50-ad19-2c40e74cbc41">

<img width="1920" alt="image" src="https://github.com/halo-dev/plugin-s3/assets/21301288/41edeed8-9ce0-40d1-82a9-1fb376a08c51">


```release-note
将 S3 关联页面放置在左侧菜单。
```
2024-02-03 15:50:55 +00:00
longjuan
8ff4acba6e perf: improve more friendly exception messages (#113)
```release-note
友好地提示异常信息
```
fixes https://github.com/halo-dev/plugin-s3/issues/105

验证方法:
1. ak/sk乱输,发生接收到403状态码(接收错误状态码)
2. endpoint网址改成不存在的,如.com改成.comaaa(未知主机)
3. endpoint端口改成没监听的(超时)
2024-01-16 14:14:12 +00:00
longjuan
3fda6e0cde fix: log cannot be output and log information error (#101)
```release-note
修复无日志输出的问题
```
fixes #100 
测试上传,关联,删除,解除关联 4种操作的日志
```
---上传---
2023-11-27T22:39:22.139+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : operation: createMultipartUpload, result: CreateMultipartUploadResponse(Bucket=test-1305034426, Key=test/image-pjcl.png, UploadId=17010959629c897f8b8c1a592b0efe300de867a1ea3e891cf04b4f95c6986470a0f30195be)
2023-11-27T22:39:22.391+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : operation: uploadPart, result: UploadPartResponse(ETag="aa84eea735192b49552fa5bf3df317fa")
2023-11-27T22:39:22.547+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : operation: completeUpload, result: CompleteMultipartUploadResponse(Location=http://test-1305034426.cos.ap-guangzhou.myqcloud.com/test/image-pjcl.png, Bucket=test-1305034426, Key=test/image-pjcl.png, ETag="afdd5ce39cf49676238fcfc879664b55-1")
2023-11-27T22:39:22.616+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : operation: getMetadata, result: HeadObjectResponse(AcceptRanges=bytes, LastModified=2023-11-27T14:39:22Z, ContentLength=1420, ETag="afdd5ce39cf49676238fcfc879664b55-1", ContentType=image/png, Metadata={})
2023-11-27T22:39:22.616+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : Upload object test/image-pjcl.png to bucket test-1305034426 successfully
2023-11-27T22:39:22.626+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : Build attachment test/image-pjcl.png successfully
2023-11-27T22:39:29.915+08:00  WARN 7 --- [or-http-epoll-1] ocalVariableTableParameterNameDiscoverer : Using deprecated '-debug' fallback for parameter name resolution. Compile the affected code with '-parameters' instead or avoid its introspection: run.halo.s3os.S3LinkController
---关联---
2023-11-27T22:39:34.657+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : Build attachment test/34.txt successfully
---解除关联---
2023-11-27T22:39:39.937+08:00  INFO 7 --- [tReconciler-t-1] run.halo.s3os.S3OsAttachmentHandler      : Skip deleting object test/34.txt from S3.
---删除---
2023-11-27T22:39:44.290+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : operation: delete object, result: DeleteObjectResponse()
2023-11-27T22:39:44.291+08:00  INFO 7 --- [oundedElastic-5] run.halo.s3os.S3OsAttachmentHandler      : Delete object test/image-pjcl.png from bucket test-1305034426 successfully
```
2023-12-01 07:40:09 +00:00
longjuan
ac9c9b88a6 fix: list s3 file error in Halo 2.11 (#103)
```release-note
修复 Halo 2.11 中 关联S3文件 功能报错的问题
```
fixes #102
2023-11-28 02:46:10 +00:00
longjuan
77c8b21248 feat: only delete halo attachment records without deleting files in object storage (#97)
/kind feature
```release-note
提供解除 S3 关联功能(仅删除 Halo 附件记录,而不再对象存储中实际删除)
```
在附件库中选择使用本插件上传或关联的文件的更多插件,会出现 解除 S3 关联 按钮。
![image](https://github.com/halo-dev/plugin-s3/assets/28662535/6bfd109e-3be5-4fdc-afb0-bbf841dfc8e8)
对于其他附件,不会出现该按钮
![image](https://github.com/halo-dev/plugin-s3/assets/28662535/bc90166d-68c5-4599-b00a-5d2ddd868314)
本功能已支持权限管理。
2023-11-27 13:50:09 +00:00
longjuan
6f59d0ee32 chore: update .gitignore and remove untracked directories (#95)
移除 `src/main/resources/console/main.js` 并加入.gitignore
```release-note
None
```
2023-10-28 06:05:30 +00:00
longjuan
565d3cfcaa Fix findUrlSuffix NPE when upgrading from old version (#94)
fixes https://github.com/halo-dev/plugin-s3/issues/93
```release-note
修复从旧版本升级后上传文件的NPE错误
```
/kind bug
2023-10-27 02:34:15 +00:00
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文件错误
```
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
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
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”的问题
```
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
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
```
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
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
```
2023-01-31 02:22:09 +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
```
2023-01-07 09:56:36 +00:00
longjuan
bf3b11b842 Bump version to 1.2.0 (#3)
```release-note
None
```
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
longjuan
c2e747ab15 extraction public tool 2022-12-21 16:04:27 +08:00
longjuan
5da0fae2b4 Adjust Formatting 2022-12-19 21:51:42 +08:00