diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 6d0ee1c..5815a4a 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt b/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt index 425df45..7b6a63e 100644 --- a/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt +++ b/src/main/kotlin/net/taehui/twilight/qwilight/QwilightAvatar.kt @@ -232,6 +232,8 @@ language = text.language qwilightHash = text.hash qwilightDate = text.date + val isAllowedIP = avatarIP.isLoopbackAddress || avatarIP.isSiteLocalAddress + val isAllowedHash = Configure.hash.contains(qwilightHash) if (Configure.mode.pause) { send(EventOuterClass.Event.EventID.NOTIFY, object { val text = translateLanguage("pause") @@ -249,15 +251,19 @@ val isUrgent = false val v = 2 }) - } else if (avatarIP.isLoopbackAddress || avatarIP.isSiteLocalAddress || Configure.hash.contains( - qwilightHash - ) - ) { + } else if (isAllowedIP || isAllowedHash) { val avatarID = "*" + RandomStringUtils.randomAlphanumeric(19) if (isValve) { ValveSystem.putDrawing(avatarID, eventData[0]) } AvatarHandler.establish(this, avatarID, text.qwilightName, isValve, false) + if (!isAllowedHash) { + send(EventOuterClass.Event.EventID.NOTIFY, object { + val text = qwilightHash + val isUrgent = false + val v = 2 + }) + } } else { if (isValve) { send(EventOuterClass.Event.EventID.NOTIFY, object { @@ -908,6 +914,22 @@ comment.audioMultipliersList.map { it.audioMultiplier } .plus(audioMultiplier).max(), ) + if (SiteHandler.hasAvatar(this, SiteHandler.commentSiteID)) { + SiteHandler.putSiteYell( + SiteHandler.commentSiteID, + JSON.TwilightCommentSiteYell( + it, + avatarName, + targetComputing.artist, + targetComputing.title, + targetComputing.genre, + targetComputing.levelText, + targetComputing.level, + stand, + hitPointsMode + ) + ) + } if (commentID != null) { val commentEntryPath = TwilightComponent.COMMENT_ENTRY_PATH.resolve(noteID512) Files.createDirectories(commentEntryPath) @@ -968,23 +990,6 @@ } } - if (SiteHandler.hasAvatar(this, SiteHandler.commentSiteID)) { - SiteHandler.putSiteYell( - SiteHandler.commentSiteID, - JSON.TwilightCommentSiteYell( - it, - avatarName, - targetComputing.artist, - targetComputing.title, - targetComputing.genre, - targetComputing.levelText, - targetComputing.level, - stand, - hitPointsMode - ) - ) - } - val titles = DB.getTitleItems(it) val distanceTitles = titles.filter { !lastTitles.contains(it)