Skip to content

Commit 9b88fb9

Browse files
authored
Merge pull request #1043 from lavalink-devs/dev
release v4.0.5
2 parents c3c9e25 + 0e13bbf commit 9b88fb9

File tree

11 files changed

+83
-15
lines changed

11 files changed

+83
-15
lines changed

CHANGELOG.md

+22-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@
33
Each release usually includes various fixes and improvements.
44
The most noteworthy of these, as well as any features and breaking changes, are listed here.
55

6+
## v4.0.5
7+
* Updated Lavaplayer to [`2.1.2`](https://github.com/lavalink-devs/lavaplayer/releases/tag/2.1.2)
8+
* Updated Koe to [`2.0.1`](https://github.com/KyokoBot/koe/releases/tag/2.0.1) (fixes the `IndexOutOfBoundsException` when playing a YouTube track)
9+
* Added option to enable [Nico](https://www.nicovideo.jp/) source
10+
* Expose Lavalink sessions to plugins via the `ISocketServer` interface
11+
12+
> [!WARNING]
13+
> The default Youtube source is now deprecated and won't receive further updates. Please use https://github.com/lavalink-devs/youtube-source#plugin instead.
14+
615
## v4.0.4
7-
* Update Lavaplayer to `2.1.1`
16+
* Update Lavaplayer to [`2.1.1`](https://github.com/lavalink-devs/lavaplayer/releases/tag/2.1.1)
817

918
## v4.0.3
1019
* Fixed plugins not registering (introduced in [`4.0.2`](https://github.com/lavalink-devs/Lavalink/releases/tag/4.0.2))
@@ -89,6 +98,18 @@ Contributors:
8998

9099
</details>
91100

101+
## v3.7.12
102+
* Updated Lavaplayer to [`1.5.4`](https://github.com/lavalink-devs/lavaplayer/releases/tag/1.5.4)
103+
* Updated Koe to [`2.0.1`](https://github.com/KyokoBot/koe/releases/tag/2.0.1) (fixes the `IndexOutOfBoundsException` when playing a YouTube track)
104+
105+
> [!WARNING]
106+
> The default Youtube source is now deprecated and won't receive further updates. Please use https://github.com/lavalink-devs/youtube-source#plugin instead.
107+
108+
## v3.7.11
109+
* Fixed not being able to seek when player is paused
110+
* Update Oshi to `6.4.3`
111+
* Update Lavaplayer to `1.5.3`
112+
92113
## v3.7.10
93114
* Update lavaplayer to [`1.5.2`](https://github.com/lavalink-devs/lavaplayer/releases/tag/1.5.2) - Fixed NPE on missing author in playlist tracks in YouTube
94115

LavalinkServer/application.yml.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ lavalink:
2323
soundcloud: true
2424
twitch: true
2525
vimeo: true
26-
http: true
26+
nico: true
27+
http: true # warning: keeping HTTP enabled without a proxy configured could expose your server's IP address.
2728
local: false
2829
filters: # All filters are enabled by default
2930
volume: true

LavalinkServer/src/main/java/lavalink/server/config/AudioPlayerConfiguration.kt

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.sedmelluq.discord.lavaplayer.source.AudioSourceManager
99
import com.sedmelluq.discord.lavaplayer.source.bandcamp.BandcampAudioSourceManager
1010
import com.sedmelluq.discord.lavaplayer.source.http.HttpAudioSourceManager
1111
import com.sedmelluq.discord.lavaplayer.source.local.LocalAudioSourceManager
12+
import com.sedmelluq.discord.lavaplayer.source.nico.NicoAudioSourceManager
1213
import com.sedmelluq.discord.lavaplayer.source.soundcloud.*
1314
import com.sedmelluq.discord.lavaplayer.source.twitch.TwitchStreamAudioSourceManager
1415
import com.sedmelluq.discord.lavaplayer.source.vimeo.VimeoAudioSourceManager
@@ -102,6 +103,14 @@ class AudioPlayerConfiguration {
102103
val mcr: MediaContainerRegistry = MediaContainerRegistry.extended(*mediaContainerProbes.toTypedArray())
103104

104105
if (sources.isYoutube) {
106+
log.warn(
107+
"""
108+
The default Youtube source is now deprecated and won't receive further updates.
109+
You should use the new Youtube source plugin instead.
110+
https://github.com/lavalink-devs/youtube-source#plugin.
111+
To disable this warning, set 'lavalink.server.sources.youtube' to false in your application.yml.
112+
""".trimIndent()
113+
)
105114
val youtubeConfig = serverConfig.youtubeConfig
106115
val youtube: YoutubeAudioSourceManager
107116
if (youtubeConfig != null) {
@@ -155,6 +164,7 @@ class AudioPlayerConfiguration {
155164
if (sources.isBandcamp) audioPlayerManager.registerSourceManager(BandcampAudioSourceManager())
156165
if (sources.isTwitch) audioPlayerManager.registerSourceManager(TwitchStreamAudioSourceManager())
157166
if (sources.isVimeo) audioPlayerManager.registerSourceManager(VimeoAudioSourceManager())
167+
if (sources.isNico) audioPlayerManager.registerSourceManager(NicoAudioSourceManager())
158168
if (sources.isLocal) audioPlayerManager.registerSourceManager(LocalAudioSourceManager(mcr))
159169

160170
audioSourceManagers.forEach {

LavalinkServer/src/main/java/lavalink/server/config/AudioSourcesConfig.kt

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ data class AudioSourcesConfig(
1414
var isSoundcloud: Boolean = true,
1515
var isTwitch: Boolean = true,
1616
var isVimeo: Boolean = true,
17+
var isNico: Boolean = false,
1718
var isHttp: Boolean = true,
1819
var isLocal: Boolean = false,
1920
)

LavalinkServer/src/main/java/lavalink/server/io/SocketServer.kt

+9-8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package lavalink.server.io
2424

2525
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager
2626
import dev.arbjerg.lavalink.api.AudioPluginInfoModifier
27+
import dev.arbjerg.lavalink.api.ISocketServer
2728
import dev.arbjerg.lavalink.api.PluginEventHandler
2829
import dev.arbjerg.lavalink.protocol.v4.Message
2930
import dev.arbjerg.lavalink.protocol.v4.PlayerState
@@ -46,11 +47,11 @@ final class SocketServer(
4647
koeOptions: KoeOptions,
4748
private val eventHandlers: List<PluginEventHandler>,
4849
private val pluginInfoModifiers: List<AudioPluginInfoModifier>
49-
) : TextWebSocketHandler() {
50+
) : TextWebSocketHandler(), ISocketServer {
5051

5152
// sessionID <-> Session
52-
val contextMap = ConcurrentHashMap<String, SocketContext>()
53-
private val resumableSessions = mutableMapOf<String, SocketContext>()
53+
override val sessions = ConcurrentHashMap<String, SocketContext>()
54+
override val resumableSessions = mutableMapOf<String, SocketContext>()
5455
private val koe = Koe.koe(koeOptions)
5556
private val statsCollector = StatsCollector(this)
5657
private val charPool = ('a'..'z') + ('0'..'9')
@@ -81,12 +82,12 @@ final class SocketServer(
8182
var sessionId: String
8283
do {
8384
sessionId = List(16) { charPool.random() }.joinToString("")
84-
} while (contextMap[sessionId] != null)
85+
} while (sessions[sessionId] != null)
8586
return sessionId
8687
}
8788

8889
val contexts: Collection<SocketContext>
89-
get() = contextMap.values
90+
get() = sessions.values
9091

9192
@Suppress("UastIncorrectHttpHeaderInspection")
9293
override fun afterConnectionEstablished(session: WebSocketSession) {
@@ -100,7 +101,7 @@ final class SocketServer(
100101

101102
if (resumable != null) {
102103
session.attributes["sessionId"] = resumable.sessionId
103-
contextMap[resumable.sessionId] = resumable
104+
sessions[resumable.sessionId] = resumable
104105
resumable.resume(session)
105106
log.info("Resumed session with id $sessionId")
106107
resumable.eventEmitter.onWebSocketOpen(true)
@@ -123,7 +124,7 @@ final class SocketServer(
123124
eventHandlers,
124125
pluginInfoModifiers
125126
)
126-
contextMap[sessionId] = socketContext
127+
sessions[sessionId] = socketContext
127128
socketContext.sendMessage(Message.Serializer, Message.ReadyEvent(false, sessionId))
128129
socketContext.eventEmitter.onWebSocketOpen(false)
129130
if (clientName != null) {
@@ -140,7 +141,7 @@ final class SocketServer(
140141
}
141142

142143
override fun afterConnectionClosed(session: WebSocketSession, status: CloseStatus) {
143-
val context = contextMap.remove(session.attributes["sessionId"]) ?: return
144+
val context = sessions.remove(session.attributes["sessionId"]) ?: return
144145
if (context.resumable) {
145146
resumableSessions.remove(context.sessionId)?.let { removed ->
146147
log.warn(

LavalinkServer/src/main/java/lavalink/server/util/util.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fun getRootCause(throwable: Throwable?): Throwable {
122122
}
123123

124124
fun socketContext(socketServer: SocketServer, sessionId: String) =
125-
socketServer.contextMap[sessionId] ?: throw ResponseStatusException(HttpStatus.NOT_FOUND, "Session not found")
125+
socketServer.sessions[sessionId] ?: throw ResponseStatusException(HttpStatus.NOT_FOUND, "Session not found")
126126

127127
fun existingPlayer(socketContext: SocketContext, guildId: Long) =
128128
socketContext.players[guildId] ?: throw ResponseStatusException(HttpStatus.NOT_FOUND, "Player not found")

docs/changelog/v3.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## v3.7.12
2+
* Updated Lavaplayer to [`1.5.4`](https://github.com/lavalink-devs/lavaplayer/releases/tag/1.5.4)
3+
* Updated Koe to [`2.0.1`](https://github.com/KyokoBot/koe/releases/tag/2.0.1) (fixes the `IndexOutOfBoundsException` when playing a YouTube track)
4+
5+
> [!WARNING]
6+
> The default Youtube source is now deprecated and won't receive further updates. Please use https://github.com/lavalink-devs/youtube-source#plugin instead.
7+
18
## v3.7.11
29
* Fixed not being able to seek when player is paused
310
* Updated Oshi to `6.4.3`

docs/changelog/v4.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
## v4.0.5
2+
* Updated Lavaplayer to [`2.1.2`](https://github.com/lavalink-devs/lavaplayer/releases/tag/2.1.2)
3+
* Updated Koe to [`2.0.1`](https://github.com/KyokoBot/koe/releases/tag/2.0.1) (fixes the `IndexOutOfBoundsException` when playing a YouTube track)
4+
* Added option to enable [Nico](https://www.nicovideo.jp/) source
5+
* Expose Lavalink sessions to plugins via the `ISocketServer` interface
6+
7+
> [!WARNING]
8+
> The default Youtube source is now deprecated and won't receive further updates. Please use https://github.com/lavalink-devs/youtube-source#plugin instead.
9+
110
## v4.0.4
2-
* Updated Lavaplayer to `2.1.1`
11+
* Updated Lavaplayer to [`2.1.1`](https://github.com/lavalink-devs/lavaplayer/releases/tag/2.1.1)
312

413
## v4.0.3
514
* Fixed plugins not registering (introduced in [`4.0.2`](https://github.com/lavalink-devs/Lavalink/releases/tag/4.0.2))

docs/configuration/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ LAVALINK_SERVER_SOURCES_SOUNDCLOUD
4747
LAVALINK_SERVER_SOURCES_TWITCH
4848
LAVALINK_SERVER_SOURCES_VIMEO
4949
LAVALINK_SERVER_SOURCES_HTTP
50+
LAVALINK_SERVER_SOURCES_NICO
5051
LAVALINK_SERVER_SOURCES_LOCAL
5152
5253
LAVALINK_SERVER_FILTERS_VOLUME
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package dev.arbjerg.lavalink.api
2+
3+
/**
4+
* Represents a Lavalink server which handles WebSocket connections.
5+
*/
6+
interface ISocketServer {
7+
/**
8+
* A map of all active sessions by their session id.
9+
*/
10+
val sessions: Map<String, ISocketContext>
11+
12+
/**
13+
* A map of all resumable sessions by their session id.
14+
* A session is resumable if the client configured resuming and has disconnected.
15+
*/
16+
val resumableSessions: Map<String, ISocketContext>
17+
}

settings.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ fun VersionCatalogBuilder.spring() {
3636
}
3737

3838
fun VersionCatalogBuilder.voice() {
39-
version("lavaplayer", "2.1.1")
39+
version("lavaplayer", "2.1.2")
4040

4141
library("lavaplayer", "dev.arbjerg", "lavaplayer").versionRef("lavaplayer")
4242
library("lavaplayer-ip-rotator", "dev.arbjerg", "lavaplayer-ext-youtube-rotator").versionRef("lavaplayer")
4343
library("lavadsp", "dev.arbjerg", "lavadsp").version("0.7.8")
4444

45-
library("koe", "moe.kyokobot.koe", "core").version("2.0.0-rc2")
46-
library("koe-udpqueue", "moe.kyokobot.koe", "ext-udpqueue").version("2.0.0-rc2")
45+
library("koe", "moe.kyokobot.koe", "core").version("2.0.1")
46+
library("koe-udpqueue", "moe.kyokobot.koe", "ext-udpqueue").version("2.0.1")
4747

4848
version("udpqueue", "0.2.7")
4949
val platforms = listOf("linux-x86-64", "linux-x86", "linux-aarch64", "linux-arm", "linux-musl-x86-64", "linux-musl-aarch64", "win-x86-64", "win-x86", "darwin")

0 commit comments

Comments
 (0)