Skip to content

Commit

Permalink
feat: cors ^^
Browse files Browse the repository at this point in the history
  • Loading branch information
jbj338033 committed Aug 1, 2024
1 parent 0fa1cab commit 57d9bbf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class AuthServiceImpl(
provider = UserProvider.GOOGLE,
providerId = info.id,
avatarUrl = info.picture,
password = passwordEncoder.encode(""),
password = passwordEncoder.encode("oauth2:google"),
)

userRepository.save(newUser)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.open3r.openmusic.domain.user.service.UserService
import com.open3r.openmusic.global.common.dto.response.BaseResponse
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.validation.Valid
import org.springframework.data.domain.Pageable
import org.springframework.data.web.PageableDefault
import org.springframework.security.access.prepost.PreAuthorize
Expand All @@ -24,7 +25,7 @@ class UserController(
@Operation(summary = "나 수정")
@PatchMapping("/me")
@PreAuthorize("isAuthenticated()")
fun updateMe(@RequestBody request: UserUpdateRequest) = BaseResponse(userService.updateMe(request), 200).toEntity()
fun updateMe(@RequestBody @Valid request: UserUpdateRequest) = BaseResponse(userService.updateMe(request), 200).toEntity()

@Operation(summary = "현재 재생 중인 노래 조회")
@GetMapping("/me/now-playing")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.open3r.openmusic.global.config.discord

import net.dv8tion.jda.api.EmbedBuilder
import net.dv8tion.jda.api.JDA
import org.springframework.boot.context.event.ApplicationStartedEvent
import org.springframework.context.ApplicationListener
import org.springframework.stereotype.Component

@Component
class StartListener(
private val jda: JDA,
private val discordProperties: DiscordProperties
): ApplicationListener<ApplicationStartedEvent> {
override fun onApplicationEvent(event: ApplicationStartedEvent) {
jda.getTextChannelById(discordProperties.channelId)?.sendMessageEmbeds(
EmbedBuilder()
.setTitle("서버가 시작되었습니다.")
.setColor(0x00FF00)
.build()
)?.queue()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WebConfig : WebMvcConfigurer {
override fun addCorsMappings(registry: CorsRegistry) {
registry
.addMapping("/**")
.allowedOriginPatterns("http://localhost:5173")
.allowedOriginPatterns("https://openmusic.mcv.kr")
.allowedMethods("OPTIONS", "GET", "POST", "PUT", "PATCH", "DELETE")
.allowedHeaders("*")
.allowCredentials(true)
Expand Down

0 comments on commit 57d9bbf

Please sign in to comment.