generated from ikaros-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
li-guohao
committed
May 25, 2024
1 parent
c1da016
commit 9fd69cb
Showing
11 changed files
with
221 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div class="ik-plugin-alist-container"> | ||
Hello Ikaros Plugin AList Home View. | ||
<hr /> | ||
<form name="form" method="post" action="#"> | ||
<input name="path" placeholder="请输入需要导入的基础路径" required> | ||
<input type="submit" name="submit" value="提交导入"> | ||
</form> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.ik-plugin-alist-container { | ||
display: inline-block; | ||
width: 100%; | ||
height: 100%; | ||
background-color: antiquewhite; | ||
border: 1px solid blue; | ||
} | ||
</style> |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
25 changes: 25 additions & 0 deletions
25
src/main/java/run/ikaros/plugin/alist/AListAttachment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package run.ikaros.plugin.alist; | ||
|
||
import lombok.Data; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Data | ||
public class AListAttachment { | ||
private List<String> paths; | ||
private String name; | ||
private Long size; | ||
private Boolean is_dir; | ||
private LocalDateTime modified; | ||
private LocalDateTime created; | ||
private String sign; | ||
private String thumb; | ||
private int type; | ||
private String hashinfo; | ||
private String hash_info; | ||
private String raw_url; | ||
private String readme; | ||
private String header; | ||
private String provider; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package run.ikaros.plugin.alist; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springdoc.core.fn.builders.requestbody.Builder; | ||
import org.springdoc.webflux.core.fn.SpringdocRouteBuilder; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.reactive.function.server.RouterFunction; | ||
import org.springframework.web.reactive.function.server.ServerRequest; | ||
import org.springframework.web.reactive.function.server.ServerResponse; | ||
import reactor.core.publisher.Mono; | ||
import run.ikaros.api.custom.GroupVersionKind; | ||
import run.ikaros.api.custom.ReactiveCustomClient; | ||
import run.ikaros.api.endpoint.CustomEndpoint; | ||
|
||
@Slf4j | ||
@Component | ||
public class AListEndpoint implements CustomEndpoint { | ||
|
||
private GroupVersionKind groupVersionKind = | ||
new GroupVersionKind("plugin.ikaros.run", "v1alpha1", AListPlugin.NAME); | ||
|
||
private final AListClient aListClient; | ||
|
||
public AListEndpoint(AListClient aListClient) { | ||
this.aListClient = aListClient; | ||
} | ||
|
||
@Override | ||
public RouterFunction<ServerResponse> endpoint() { | ||
var tag = groupVersionKind.group() | ||
+ "/" + groupVersionKind.version() | ||
+ "/" + groupVersionKind.kind(); | ||
return SpringdocRouteBuilder.route() | ||
.POST("/alist/import", this::doImportFilesFromAList, | ||
builder -> builder.operationId("ImportAlistFiles") | ||
.tag(tag) | ||
.description("Import Alist Files") | ||
.requestBody(Builder.requestBodyBuilder() | ||
.implementation(AListImportPostBody.class))) | ||
.build(); | ||
} | ||
|
||
Mono<ServerResponse> doImportFilesFromAList(ServerRequest request) { | ||
return request.bodyToMono(AListImportPostBody.class) | ||
.map(AListImportPostBody::getPath) | ||
.flatMap(path -> aListClient.doImportFilesFromAListPath(path)) | ||
.then(ServerResponse.ok().build()); | ||
} | ||
|
||
@Override | ||
public GroupVersionKind groupVersionKind() { | ||
return groupVersionKind; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/run/ikaros/plugin/alist/AListImportPostBody.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package run.ikaros.plugin.alist; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class AListImportPostBody { | ||
private String path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters