Merge pull request #51 from dalbodeule/develop

update naverMEAPI
This commit is contained in:
JinU Choi 2024-08-09 15:03:33 +09:00 committed by GitHub
commit 18d28262d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View File

@ -88,8 +88,7 @@ val server = embeddedServer(Netty, port = 8080, ) {
}.body()
call.sessions.set(userInfo.response?.let { profile ->
UserSession(state,
profile.id, profile.nickname, profile.profile_image)
UserSession(state, profile.id)
})
redirects[state]?.let { redirect ->
@ -148,16 +147,12 @@ fun stop() {
@Serializable
data class UserSession(
val state: String,
val id: String,
val nickname: String,
val profileImage: String
val id: String
)
@Serializable
data class NaverMeAPI(
val id: String,
val nickname: String,
val profile_image: String
val id: String
)
@Serializable

View File

@ -91,11 +91,15 @@ fun Routing.apiRoutes() {
println(session)
var user = UserService.getUserWithNaverId(session.id)
if(user == null) {
user = UserService.saveUser(session.nickname, session.id)
user = UserService.saveUser("임시닉네임", session.id)
}
val songConfig = SongConfigService.getConfig(user)
val status = user.token?.let { it1 -> getStreamInfo(it1) }
if (user.username == "임시닉네임") {
status?.content?.channel?.let { it1 -> UserService.updateUser(user, it1.channelId, it1.channelName) }
}
if(status?.content == null) {
call.respondText(user.naverId, status = HttpStatusCode.NotFound)
return@get