Skip to content

Commit

Permalink
fix: access the list interface without logging in
Browse files Browse the repository at this point in the history
  • Loading branch information
LIlGG committed Feb 21, 2024
1 parent bc2c9ec commit 3e40679
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
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/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" ]

0 comments on commit 3e40679

Please sign in to comment.