Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: access the list interface without logging in #81

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion console/src/components/MomentEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const queryEditorTags = function () {
const createMoment = async () => {
formState.value.spec.releaseTime = new Date().toISOString();
const { data } = await apiClient.post<Moment>(
`/apis/api.plugin.halo.run/v1alpha1/plugins/PluginMoments/moments`,
`/apis/console.api.moment.halo.run/v1alpha1/moments`,
formState.value
);
emit("save", data);
Expand Down
2 changes: 1 addition & 1 deletion console/src/extensions/tags/TagsExtensionView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const { data: tags } = useQuery<string[]>({
queryKey: ["tags", page, size, keyword],
queryFn: async () => {
const { data } = await apiClient.get(
"/apis/api.plugin.halo.run/v1alpha1/plugins/PluginMoments/tags",
"/apis/console.api.moment.halo.run/v1alpha1/tags",
{
params: {
name: keyword.value,
Expand Down
2 changes: 1 addition & 1 deletion console/src/views/MomentsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const {
}

const { data } = await apiClient.get(
"/apis/api.plugin.halo.run/v1alpha1/plugins/PluginMoments/moments",
"/apis/console.api.moment.halo.run/v1alpha1/moments",
{
params: {
page: page.value,
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/run/halo/moments/MomentEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class MomentEndpoint implements CustomEndpoint {

@Override
public RouterFunction<ServerResponse> endpoint() {
final var tag = "api.plugin.halo.run/v1alpha1/Moment";
final var tag = "console.api.moment.halo.run/v1alpha1/Moment";
return SpringdocRouteBuilder.route()
.GET("plugins/PluginMoments/moments", this::listMoment, builder -> {
.GET("moments", this::listMoment, builder -> {
builder.operationId("ListMoments")
.description("List moments.")
.tag(tag)
Expand All @@ -47,7 +47,7 @@ public RouterFunction<ServerResponse> endpoint() {
);
QueryParamBuildUtil.buildParametersFromType(builder, MomentQuery.class);
})
.GET("plugins/PluginMoments/tags", this::listTags,
.GET("tags", this::listTags,
builder -> builder.operationId("ListTags")
.description("List all moment tags.")
.tag(tag)
Expand All @@ -61,7 +61,7 @@ public RouterFunction<ServerResponse> endpoint() {
.response(responseBuilder()
.implementationArray(String.class)
))
.POST("plugins/PluginMoments/moments", this::createMoment,
.POST("moments", this::createMoment,
builder -> builder.operationId("CreateMoment")
.description("Create a Moment.")
.tag(tag)
Expand All @@ -80,7 +80,7 @@ public RouterFunction<ServerResponse> endpoint() {

@Override
public GroupVersion groupVersion() {
return GroupVersion.parseAPIVersion("api.plugin.halo.run/v1alpha1");
return GroupVersion.parseAPIVersion("console.api.moment.halo.run/v1alpha1");
}

private Mono<ServerResponse> createMoment(ServerRequest serverRequest) {
Expand Down
10 changes: 4 additions & 6 deletions src/main/resources/extensions/roleTemplate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ rules:
- apiGroups: [ "moment.halo.run"]
resources: [ "moments" ]
verbs: [ "get", "list" ]
- apiGroups: [ "api.plugin.halo.run"]
resources: [ "plugins/moments" ]
resourceNames: [ "PluginMoments" ]
- apiGroups: [ "console.api.moment.halo.run"]
resources: [ "moments", "tags" ]
verbs: [ "get", "list" ]
---
apiVersion: v1alpha1
Expand All @@ -35,7 +34,6 @@ rules:
- apiGroups: [ "moment.halo.run"]
resources: [ "moments" ]
verbs: [ "create", "patch", "update", "delete", "deletecollection" ]
- apiGroups: [ "api.plugin.halo.run"]
resources: [ "plugins/moments" ]
resourceNames: [ "PluginMoments" ]
- apiGroups: [ "console.api.moment.halo.run"]
resources: [ "moments", "tags" ]
verbs: [ "create", "patch", "update", "delete", "deletecollection" ]