mirror of https://github.com/usbharu/Hideout.git
feat: apiのコントローラーを復活
This commit is contained in:
parent
6739bb0da2
commit
9c271b8cc8
|
@ -0,0 +1,173 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.config
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.external.RoleHierarchyAuthorizationManagerFactory
|
||||||
|
import org.springframework.context.annotation.Bean
|
||||||
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import org.springframework.core.annotation.Order
|
||||||
|
import org.springframework.http.HttpMethod.*
|
||||||
|
import org.springframework.security.access.hierarchicalroles.RoleHierarchy
|
||||||
|
import org.springframework.security.access.hierarchicalroles.RoleHierarchyImpl
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||||
|
import org.springframework.security.config.annotation.web.invoke
|
||||||
|
import org.springframework.security.web.SecurityFilterChain
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
class MastodonSecurityConfig {
|
||||||
|
@Bean
|
||||||
|
@Order(4)
|
||||||
|
@Suppress("LongMethod")
|
||||||
|
fun mastodonApiSecurityFilterChain(
|
||||||
|
http: HttpSecurity,
|
||||||
|
rf: RoleHierarchyAuthorizationManagerFactory,
|
||||||
|
): SecurityFilterChain {
|
||||||
|
http {
|
||||||
|
securityMatcher("/api/v1/**", "/api/v2/**")
|
||||||
|
authorizeHttpRequests {
|
||||||
|
authorize(POST, "/api/v1/apps", permitAll)
|
||||||
|
authorize(GET, "/api/v1/instance/**", permitAll)
|
||||||
|
authorize(POST, "/api/v1/accounts", authenticated)
|
||||||
|
|
||||||
|
authorize(GET, "/api/v1/accounts/verify_credentials", rf.hasScope("read:accounts"))
|
||||||
|
authorize(GET, "/api/v1/accounts/relationships", rf.hasScope("read:follows"))
|
||||||
|
authorize(GET, "/api/v1/accounts/*", permitAll)
|
||||||
|
authorize(GET, "/api/v1/accounts/*/statuses", permitAll)
|
||||||
|
authorize(POST, "/api/v1/accounts/*/follow", rf.hasScope("write:follows"))
|
||||||
|
authorize(POST, "/api/v1/accounts/*/unfollow", rf.hasScope("write:follows"))
|
||||||
|
authorize(POST, "/api/v1/accounts/*/block", rf.hasScope("write:blocks"))
|
||||||
|
authorize(POST, "/api/v1/accounts/*/unblock", rf.hasScope("write:blocks"))
|
||||||
|
authorize(POST, "/api/v1/accounts/*/mute", rf.hasScope("write:mutes"))
|
||||||
|
authorize(POST, "/api/v1/accounts/*/unmute", rf.hasScope("write:mutes"))
|
||||||
|
authorize(GET, "/api/v1/mutes", rf.hasScope("read:mutes"))
|
||||||
|
|
||||||
|
authorize(POST, "/api/v1/media", rf.hasScope("write:media"))
|
||||||
|
authorize(POST, "/api/v1/statuses", rf.hasScope("write:statuses"))
|
||||||
|
authorize(GET, "/api/v1/statuses/*", permitAll)
|
||||||
|
authorize(POST, "/api/v1/statuses/*/favourite", rf.hasScope("write:favourites"))
|
||||||
|
authorize(POST, "/api/v1/statuses/*/unfavourite", rf.hasScope("write:favourites"))
|
||||||
|
authorize(PUT, "/api/v1/statuses/*/emoji_reactions/*", rf.hasScope("write:favourites"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v1/timelines/public", permitAll)
|
||||||
|
authorize(GET, "/api/v1/timelines/home", rf.hasScope("read:statuses"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v2/filters", rf.hasScope("read:filters"))
|
||||||
|
authorize(POST, "/api/v2/filters", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v2/filters/*", rf.hasScope("read:filters"))
|
||||||
|
authorize(PUT, "/api/v2/filters/*", rf.hasScope("write:filters"))
|
||||||
|
authorize(DELETE, "/api/v2/filters/*", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v2/filters/*/keywords", rf.hasScope("read:filters"))
|
||||||
|
authorize(POST, "/api/v2/filters/*/keywords", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v2/filters/keywords/*", rf.hasScope("read:filters"))
|
||||||
|
authorize(PUT, "/api/v2/filters/keywords/*", rf.hasScope("write:filters"))
|
||||||
|
authorize(DELETE, "/api/v2/filters/keywords/*", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v2/filters/*/statuses", rf.hasScope("read:filters"))
|
||||||
|
authorize(POST, "/api/v2/filters/*/statuses", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v2/filters/statuses/*", rf.hasScope("read:filters"))
|
||||||
|
authorize(DELETE, "/api/v2/filters/statuses/*", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v1/filters", rf.hasScope("read:filters"))
|
||||||
|
authorize(POST, "/api/v1/filters", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v1/filters/*", rf.hasScope("read:filters"))
|
||||||
|
authorize(POST, "/api/v1/filters/*", rf.hasScope("write:filters"))
|
||||||
|
authorize(DELETE, "/api/v1/filters/*", rf.hasScope("write:filters"))
|
||||||
|
|
||||||
|
authorize(GET, "/api/v1/notifications", rf.hasScope("read:notifications"))
|
||||||
|
authorize(GET, "/api/v1/notifications/*", rf.hasScope("read:notifications"))
|
||||||
|
authorize(POST, "/api/v1/notifications/clear", rf.hasScope("write:notifications"))
|
||||||
|
authorize(POST, "/api/v1/notifications/*/dismiss", rf.hasScope("write:notifications"))
|
||||||
|
|
||||||
|
authorize(anyRequest, authenticated)
|
||||||
|
}
|
||||||
|
|
||||||
|
oauth2ResourceServer {
|
||||||
|
jwt { }
|
||||||
|
}
|
||||||
|
|
||||||
|
csrf {
|
||||||
|
ignoringRequestMatchers("/api/v1/apps")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return http.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
fun roleHierarchy(): RoleHierarchy {
|
||||||
|
val roleHierarchyImpl = RoleHierarchyImpl()
|
||||||
|
|
||||||
|
roleHierarchyImpl.setHierarchy(
|
||||||
|
"""
|
||||||
|
SCOPE_read > SCOPE_read:accounts
|
||||||
|
SCOPE_read > SCOPE_read:accounts
|
||||||
|
SCOPE_read > SCOPE_read:blocks
|
||||||
|
SCOPE_read > SCOPE_read:bookmarks
|
||||||
|
SCOPE_read > SCOPE_read:favourites
|
||||||
|
SCOPE_read > SCOPE_read:filters
|
||||||
|
SCOPE_read > SCOPE_read:follows
|
||||||
|
SCOPE_read > SCOPE_read:lists
|
||||||
|
SCOPE_read > SCOPE_read:mutes
|
||||||
|
SCOPE_read > SCOPE_read:notifications
|
||||||
|
SCOPE_read > SCOPE_read:search
|
||||||
|
SCOPE_read > SCOPE_read:statuses
|
||||||
|
SCOPE_write > SCOPE_write:accounts
|
||||||
|
SCOPE_write > SCOPE_write:blocks
|
||||||
|
SCOPE_write > SCOPE_write:bookmarks
|
||||||
|
SCOPE_write > SCOPE_write:conversations
|
||||||
|
SCOPE_write > SCOPE_write:favourites
|
||||||
|
SCOPE_write > SCOPE_write:filters
|
||||||
|
SCOPE_write > SCOPE_write:follows
|
||||||
|
SCOPE_write > SCOPE_write:lists
|
||||||
|
SCOPE_write > SCOPE_write:media
|
||||||
|
SCOPE_write > SCOPE_write:mutes
|
||||||
|
SCOPE_write > SCOPE_write:notifications
|
||||||
|
SCOPE_write > SCOPE_write:reports
|
||||||
|
SCOPE_write > SCOPE_write:statuses
|
||||||
|
SCOPE_follow > SCOPE_write:blocks
|
||||||
|
SCOPE_follow > SCOPE_write:follows
|
||||||
|
SCOPE_follow > SCOPE_write:mutes
|
||||||
|
SCOPE_follow > SCOPE_read:blocks
|
||||||
|
SCOPE_follow > SCOPE_read:follows
|
||||||
|
SCOPE_follow > SCOPE_read:mutes
|
||||||
|
SCOPE_admin > SCOPE_admin:read
|
||||||
|
SCOPE_admin > SCOPE_admin:write
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:accounts
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:reports
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:domain_allows
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:domain_blocks
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:ip_blocks
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:email_domain_blocks
|
||||||
|
SCOPE_admin:read > SCOPE_admin:read:canonical_email_blocks
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:accounts
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:reports
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:domain_allows
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:domain_blocks
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:ip_blocks
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:email_domain_blocks
|
||||||
|
SCOPE_admin:write > SCOPE_admin:write:canonical_email_blocks
|
||||||
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
|
||||||
|
return roleHierarchyImpl
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.external
|
||||||
|
|
||||||
|
import org.springframework.security.access.hierarchicalroles.RoleHierarchy
|
||||||
|
import org.springframework.security.authorization.AuthorityAuthorizationManager
|
||||||
|
import org.springframework.security.authorization.AuthorizationManager
|
||||||
|
import org.springframework.security.web.access.intercept.RequestAuthorizationContext
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
@Component
|
||||||
|
class RoleHierarchyAuthorizationManagerFactory(private val roleHierarchy: RoleHierarchy) {
|
||||||
|
fun hasScope(role: String): AuthorizationManager<RequestAuthorizationContext> {
|
||||||
|
val hasAuthority = AuthorityAuthorizationManager.hasAuthority<RequestAuthorizationContext>("SCOPE_$role")
|
||||||
|
hasAuthority.setRoleHierarchy(roleHierarchy)
|
||||||
|
return hasAuthority
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.AccountApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.*
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringAccountApi : AccountApi {
|
||||||
|
override suspend fun apiV1AccountsIdBlockPost(id: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdBlockPost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdFollowPost(
|
||||||
|
id: String,
|
||||||
|
followRequestBody: FollowRequestBody?,
|
||||||
|
): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdFollowPost(id, followRequestBody)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdGet(id: String): ResponseEntity<Account> {
|
||||||
|
return super.apiV1AccountsIdGet(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdMutePost(id: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdMutePost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdRemoveFromFollowersPost(id: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdRemoveFromFollowersPost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdUnblockPost(id: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdUnblockPost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdUnfollowPost(id: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdUnfollowPost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsIdUnmutePost(id: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1AccountsIdUnmutePost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsPost(accountsCreateRequest: AccountsCreateRequest): ResponseEntity<Unit> {
|
||||||
|
return super.apiV1AccountsPost(accountsCreateRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsUpdateCredentialsPatch(updateCredentials: UpdateCredentials?): ResponseEntity<Account> {
|
||||||
|
return super.apiV1AccountsUpdateCredentialsPatch(updateCredentials)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1AccountsVerifyCredentialsGet(): ResponseEntity<CredentialAccount> {
|
||||||
|
return super.apiV1AccountsVerifyCredentialsGet()
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1FollowRequestsAccountIdAuthorizePost(accountId: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1FollowRequestsAccountIdAuthorizePost(accountId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1FollowRequestsAccountIdRejectPost(accountId: String): ResponseEntity<Relationship> {
|
||||||
|
return super.apiV1FollowRequestsAccountIdRejectPost(accountId)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.AppApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.Application
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.AppsRequest
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringAppApi : AppApi {
|
||||||
|
override suspend fun apiV1AppsPost(appsRequest: AppsRequest): ResponseEntity<Application> {
|
||||||
|
return super.apiV1AppsPost(appsRequest)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.FilterApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.*
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringFilterApi : FilterApi {
|
||||||
|
|
||||||
|
override suspend fun apiV1FiltersIdDelete(id: String): ResponseEntity<Any> {
|
||||||
|
return super.apiV1FiltersIdDelete(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1FiltersIdGet(id: String): ResponseEntity<V1Filter> {
|
||||||
|
return super.apiV1FiltersIdGet(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1FiltersIdPut(
|
||||||
|
id: String,
|
||||||
|
phrase: String?,
|
||||||
|
context: List<String>?,
|
||||||
|
irreversible: Boolean?,
|
||||||
|
wholeWord: Boolean?,
|
||||||
|
expiresIn: Int?,
|
||||||
|
): ResponseEntity<V1Filter> {
|
||||||
|
return super.apiV1FiltersIdPut(id, phrase, context, irreversible, wholeWord, expiresIn)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1FiltersPost(v1FilterPostRequest: V1FilterPostRequest): ResponseEntity<V1Filter> {
|
||||||
|
return super.apiV1FiltersPost(v1FilterPostRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersFilterIdKeywordsPost(
|
||||||
|
filterId: String,
|
||||||
|
filterKeywordsPostRequest: FilterKeywordsPostRequest,
|
||||||
|
): ResponseEntity<FilterKeyword> {
|
||||||
|
return super.apiV2FiltersFilterIdKeywordsPost(filterId, filterKeywordsPostRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersFilterIdStatusesPost(
|
||||||
|
filterId: String,
|
||||||
|
filterStatusRequest: FilterStatusRequest,
|
||||||
|
): ResponseEntity<FilterStatus> {
|
||||||
|
return super.apiV2FiltersFilterIdStatusesPost(filterId, filterStatusRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersIdDelete(id: String): ResponseEntity<Any> {
|
||||||
|
return super.apiV2FiltersIdDelete(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersIdGet(id: String): ResponseEntity<Filter> {
|
||||||
|
return super.apiV2FiltersIdGet(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersIdPut(
|
||||||
|
id: String,
|
||||||
|
title: String?,
|
||||||
|
context: List<String>?,
|
||||||
|
filterAction: String?,
|
||||||
|
expiresIn: Int?,
|
||||||
|
keywordsAttributes: List<FilterPubRequestKeyword>?,
|
||||||
|
): ResponseEntity<Filter> {
|
||||||
|
return super.apiV2FiltersIdPut(id, title, context, filterAction, expiresIn, keywordsAttributes)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersKeywordsIdDelete(id: String): ResponseEntity<Any> {
|
||||||
|
return super.apiV2FiltersKeywordsIdDelete(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersKeywordsIdGet(id: String): ResponseEntity<FilterKeyword> {
|
||||||
|
return super.apiV2FiltersKeywordsIdGet(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersKeywordsIdPut(
|
||||||
|
id: String,
|
||||||
|
keyword: String?,
|
||||||
|
wholeWord: Boolean?,
|
||||||
|
regex: Boolean?,
|
||||||
|
): ResponseEntity<FilterKeyword> {
|
||||||
|
return super.apiV2FiltersKeywordsIdPut(id, keyword, wholeWord, regex)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersPost(filterPostRequest: FilterPostRequest): ResponseEntity<Filter> {
|
||||||
|
return super.apiV2FiltersPost(filterPostRequest)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersStatusesIdDelete(id: String): ResponseEntity<Any> {
|
||||||
|
return super.apiV2FiltersStatusesIdDelete(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2FiltersStatusesIdGet(id: String): ResponseEntity<FilterStatus> {
|
||||||
|
return super.apiV2FiltersStatusesIdGet(id)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.InstanceApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.*
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringInstanceApi : InstanceApi {
|
||||||
|
|
||||||
|
override suspend fun apiV1InstanceExtendedDescriptionGet(): ResponseEntity<ExtendedDescription> {
|
||||||
|
return super.apiV1InstanceExtendedDescriptionGet()
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1InstanceGet(): ResponseEntity<V1Instance> {
|
||||||
|
return super.apiV1InstanceGet()
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV2InstanceGet(): ResponseEntity<Instance> {
|
||||||
|
return super.apiV2InstanceGet()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.MediaApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.MediaAttachment
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
import org.springframework.web.multipart.MultipartFile
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringMediaApi : MediaApi {
|
||||||
|
override suspend fun apiV1MediaPost(
|
||||||
|
file: MultipartFile,
|
||||||
|
thumbnail: MultipartFile?,
|
||||||
|
description: String?,
|
||||||
|
focus: String?,
|
||||||
|
): ResponseEntity<MediaAttachment> {
|
||||||
|
return super.apiV1MediaPost(file, thumbnail, description, focus)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.NotificationsApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.Notification
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringNotificationApi : NotificationsApi {
|
||||||
|
override suspend fun apiV1NotificationsClearPost(): ResponseEntity<Any> {
|
||||||
|
return super.apiV1NotificationsClearPost()
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1NotificationsIdDismissPost(id: String): ResponseEntity<Any> {
|
||||||
|
return super.apiV1NotificationsIdDismissPost(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1NotificationsIdGet(id: String): ResponseEntity<Notification> {
|
||||||
|
return super.apiV1NotificationsIdGet(id)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.StatusApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.Status
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.StatusesRequest
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringStatusApi : StatusApi {
|
||||||
|
override suspend fun apiV1StatusesIdEmojiReactionsEmojiDelete(id: String, emoji: String): ResponseEntity<Status> {
|
||||||
|
return super.apiV1StatusesIdEmojiReactionsEmojiDelete(id, emoji)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1StatusesIdEmojiReactionsEmojiPut(id: String, emoji: String): ResponseEntity<Status> {
|
||||||
|
return super.apiV1StatusesIdEmojiReactionsEmojiPut(id, emoji)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1StatusesIdGet(id: String): ResponseEntity<Status> {
|
||||||
|
return super.apiV1StatusesIdGet(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun apiV1StatusesPost(statusesRequest: StatusesRequest): ResponseEntity<Status> {
|
||||||
|
return super.apiV1StatusesPost(statusesRequest)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 usbharu
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package dev.usbharu.hideout.mastodon.interfaces.api
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.TimelineApi
|
||||||
|
import dev.usbharu.hideout.mastodon.interfaces.api.generated.model.Status
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import org.springframework.http.ResponseEntity
|
||||||
|
import org.springframework.stereotype.Controller
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
class SpringTimelineApi : TimelineApi {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue