mirror of
https://github.com/dalbodeule/chibot-chzzk-bot.git
synced 2025-06-09 15:28:21 +00:00
commit
18d28262d1
@ -88,8 +88,7 @@ val server = embeddedServer(Netty, port = 8080, ) {
|
|||||||
}.body()
|
}.body()
|
||||||
|
|
||||||
call.sessions.set(userInfo.response?.let { profile ->
|
call.sessions.set(userInfo.response?.let { profile ->
|
||||||
UserSession(state,
|
UserSession(state, profile.id)
|
||||||
profile.id, profile.nickname, profile.profile_image)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
redirects[state]?.let { redirect ->
|
redirects[state]?.let { redirect ->
|
||||||
@ -148,16 +147,12 @@ fun stop() {
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class UserSession(
|
data class UserSession(
|
||||||
val state: String,
|
val state: String,
|
||||||
val id: String,
|
val id: String
|
||||||
val nickname: String,
|
|
||||||
val profileImage: String
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class NaverMeAPI(
|
data class NaverMeAPI(
|
||||||
val id: String,
|
val id: String
|
||||||
val nickname: String,
|
|
||||||
val profile_image: String
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -91,11 +91,15 @@ fun Routing.apiRoutes() {
|
|||||||
println(session)
|
println(session)
|
||||||
var user = UserService.getUserWithNaverId(session.id)
|
var user = UserService.getUserWithNaverId(session.id)
|
||||||
if(user == null) {
|
if(user == null) {
|
||||||
user = UserService.saveUser(session.nickname, session.id)
|
user = UserService.saveUser("임시닉네임", session.id)
|
||||||
}
|
}
|
||||||
val songConfig = SongConfigService.getConfig(user)
|
val songConfig = SongConfigService.getConfig(user)
|
||||||
val status = user.token?.let { it1 -> getStreamInfo(it1) }
|
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) {
|
if(status?.content == null) {
|
||||||
call.respondText(user.naverId, status = HttpStatusCode.NotFound)
|
call.respondText(user.naverId, status = HttpStatusCode.NotFound)
|
||||||
return@get
|
return@get
|
||||||
|
Loading…
x
Reference in New Issue
Block a user