Skip to content

Commit c00286d

Browse files
authored
Merge pull request #842 from freyacodes/dev
release v3.7.5
2 parents 1c8003a + f21d6bf commit c00286d

File tree

13 files changed

+119
-32
lines changed

13 files changed

+119
-32
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ on:
77
workflow_call:
88
secrets:
99
DOCKER_USERNAME:
10+
required: false
1011
DOCKER_TOKEN:
12+
required: false
1113
DOCKER_REGISTRY:
14+
required: false
1215
DOCKER_IMAGE:
16+
required: false
1317

1418
jobs:
1519
build:
@@ -43,25 +47,33 @@ jobs:
4347
path: LavalinkServer/build/libs/Lavalink.jar
4448

4549
- name: Docker Meta
46-
if: env.DOCKER_USERNAME && env.DOCKER_TOKEN && env.DOCKER_REGISTRY && env.DOCKER_IMAGE
4750
id: meta
4851
uses: docker/metadata-action@v4
4952
with:
50-
images: ${{ env.DOCKER_IMAGE }}
53+
images: |
54+
ghcr.io/${{ github.repository }}
55+
${{ env.DOCKER_IMAGE }}
5156
tags: |
5257
type=ref,event=branch
53-
type=ref,event=tag
5458
type=ref,event=pr
59+
type=semver,pattern={{version}}
60+
type=semver,pattern={{major}}.{{minor}}
61+
type=semver,pattern={{major}}
5562
type=sha,prefix=
5663
5764
- name: Set up QEMU
58-
if: env.DOCKER_USERNAME && env.DOCKER_TOKEN && env.DOCKER_REGISTRY && env.DOCKER_IMAGE
5965
uses: docker/setup-qemu-action@v2
6066

6167
- name: Set up Docker Buildx
62-
if: env.DOCKER_USERNAME && env.DOCKER_TOKEN && env.DOCKER_REGISTRY && env.DOCKER_IMAGE
6368
uses: docker/setup-buildx-action@v2
6469

70+
- name: Login to GitHub Container Registry
71+
uses: docker/login-action@v2
72+
with:
73+
registry: ghcr.io
74+
username: ${{ github.repository_owner }}
75+
password: ${{ secrets.GITHUB_TOKEN }}
76+
6577
- name: Log in to docker registry
6678
if: env.DOCKER_USERNAME && env.DOCKER_TOKEN && env.DOCKER_REGISTRY && env.DOCKER_IMAGE
6779
uses: docker/login-action@v2
@@ -71,7 +83,6 @@ jobs:
7183
password: ${{ env.DOCKER_TOKEN }}
7284

7385
- name: Build and Push
74-
if: env.DOCKER_USERNAME && env.DOCKER_TOKEN && env.DOCKER_REGISTRY && env.DOCKER_IMAGE
7586
uses: docker/build-push-action@v3
7687
with:
7788
file: LavalinkServer/docker/Dockerfile

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
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+
## 3.7.5
7+
* Fix `endTime` in `Player Update` endpoint only applying when playing a new track
8+
* Fix errors when doing multiple session resumes
9+
* Update lavaplayer to `1.4.0` see [here](https://github.com/Walkyst/lavaplayer-fork/releases/tag/1.4.0) for more info
10+
11+
> **Note**
12+
> Lavalink Docker images are now found in the GitHub Container Registry instead of DockerHub
13+
614
## 3.7.4
715
* Fix an issue where Lavalink would not destroy a session when a client disconnects
816

IMPLEMENTATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ Request:
694694
| encodedTrack? * | ?string | The encoded track base64 to play. `null` stops the current track |
695695
| identifier? * | string | The track identifier to play |
696696
| position? | int | The track position in milliseconds |
697-
| endTime? | int | The track end time in milliseconds |
697+
| endTime? | ?int | The track end time in milliseconds (must be > 0) |
698698
| volume? | int | The player volume from 0 to 1000 |
699699
| paused? | bool | Whether the player is paused |
700700
| filters? | [Filters](#filters) object | The new filters to apply. This will override all previously applied filters |

LavalinkServer/build.gradle.kts

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.ajoberstar.grgit.Grgit
21
import org.apache.tools.ant.filters.ReplaceTokens
32
import org.springframework.boot.gradle.tasks.bundling.BootJar
43
import org.springframework.boot.gradle.tasks.run.BootRun
@@ -16,7 +15,6 @@ apply(plugin = "kotlin")
1615
apply(plugin = "kotlin-spring")
1716

1817
description = "Play audio to discord voice channels"
19-
version = versionFromTag()
2018

2119
application {
2220
mainClass.set("lavalink.server.Launcher")
@@ -123,16 +121,37 @@ tasks {
123121
}
124122
}
125123

126-
@SuppressWarnings("GrMethodMayBeStatic")
127-
fun versionFromTag(): String = Grgit.open(mapOf("currentDir" to project.rootDir)).use { git ->
128-
val headTag = git.tag
129-
.list()
130-
.find { it.commit.id == git.head().id }
131-
132-
val clean = git.status().isClean || System.getenv("CI") != null
133-
if (!clean) {
134-
println("Git state is dirty, setting version as snapshot.")
124+
publishing {
125+
publications {
126+
create<MavenPublication>("LavalinkServer") {
127+
from(project.components["java"])
128+
129+
pom {
130+
name.set("Lavalink Server")
131+
description.set("Lavalink Server")
132+
url.set("https://github.com/freyacodes/lavalink")
133+
134+
licenses {
135+
license {
136+
name.set("The MIT License")
137+
url.set("https://github.com/freyacodes/Lavalink/blob/master/LICENSE")
138+
}
139+
}
140+
141+
developers {
142+
developer {
143+
id.set("freyacodes")
144+
name.set("Freya Arbjerg")
145+
url.set("https://www.arbjerg.dev")
146+
}
147+
}
148+
149+
scm {
150+
connection.set("scm:git:ssh://github.com/freyacodes/lavalink.git")
151+
developerConnection.set("scm:git:ssh://github.com/freyacodes/lavalink.git")
152+
url.set("https://github.com/freyacodes/lavalink")
153+
}
154+
}
155+
}
135156
}
136-
137-
return if (headTag != null && clean) headTag.name else "${git.head().id}-SNAPSHOT"
138157
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class SocketContext(
206206
fun resume(session: WebSocketSession) {
207207
sessionPaused = false
208208
this.session = session
209+
sendMessage(Message.ReadyEvent(true, sessionId))
209210
log.info("Replaying ${resumeEventQueue.size} events")
210211

211212
// Bulk actions are not guaranteed to be atomic, so we need to do this imperatively

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ class SocketServer(
103103
if (resumeKey != null) resumable = resumableSessions.remove(resumeKey)
104104

105105
if (resumable != null) {
106+
session.attributes["sessionId"] = resumable.sessionId
106107
contextMap[resumable.sessionId] = resumable
107108
resumable.resume(session)
108109
log.info("Resumed session with key $resumeKey")
109110
resumable.eventEmitter.onWebSocketOpen(true)
110-
resumable.sendMessage(Message.ReadyEvent(true, resumable.sessionId))
111111
return
112112
}
113113

@@ -130,9 +130,8 @@ class SocketServer(
130130
objectMapper
131131
)
132132
contextMap[sessionId] = socketContext
133-
socketContext.eventEmitter.onWebSocketOpen(false)
134133
socketContext.sendMessage(Message.ReadyEvent(false, sessionId))
135-
134+
socketContext.eventEmitter.onWebSocketOpen(false)
136135
if (clientName != null) {
137136
log.info("Connection successfully established from $clientName")
138137
return

LavalinkServer/src/main/java/lavalink/server/player/PlayerRestHandler.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ class PlayerRestHandler(
7979
}
8080
}
8181

82+
playerUpdate.endTime.takeIfPresent {
83+
if (it != null && it <= 0) {
84+
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "End time must be greater than 0")
85+
}
86+
}
87+
8288
val player = context.getPlayer(guildId)
8389

8490
playerUpdate.voice.takeIfPresent {
@@ -118,6 +124,12 @@ class PlayerRestHandler(
118124
SocketServer.sendPlayerUpdate(context, player)
119125
}
120126

127+
playerUpdate.endTime.takeIf { it.isPresent && !playerUpdate.encodedTrack.isPresent && !playerUpdate.identifier.isPresent }
128+
?.let {
129+
val marker = it.value?.let { endTime -> TrackMarker(endTime, TrackEndMarkerHandler(player)) }
130+
player.track?.setMarker(marker)
131+
}
132+
121133
playerUpdate.filters.takeIfPresent {
122134
player.filters = FilterChain.parse(it, filterExtensions)
123135
SocketServer.sendPlayerUpdate(context, player)
@@ -166,7 +178,7 @@ class PlayerRestHandler(
166178
}
167179

168180
playerUpdate.endTime.takeIfPresent { endTime ->
169-
if (endTime > 0) {
181+
if (endTime != null) {
170182
track.setMarker(TrackMarker(endTime, TrackEndMarkerHandler(player)))
171183
}
172184
}

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,4 @@ Put an `application.yml` file in your working directory. ([Example here](https:/
111111

112112
Run with `java -jar Lavalink.jar`
113113

114-
Docker images are available on the [Docker Hub](https://hub.docker.com/r/fredboat/lavalink/).
115-
116-
[![Docker Pulls](https://img.shields.io/docker/pulls/fredboat/lavalink.svg)](https://hub.docker.com/r/fredboat/lavalink/)
114+
Docker images can be found under [packages](https://github.com/freyacodes/Lavalink/pkgs/container/lavalink) with old builds prior to `v3.7.4` being available on [Docker Hub](https://hub.docker.com/r/fredboat/lavalink/).

build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
import org.ajoberstar.grgit.Grgit
23

34
buildscript {
45
repositories {
@@ -21,6 +22,7 @@ buildscript {
2122

2223
allprojects {
2324
group = "lavalink"
25+
version = versionFromTag()
2426

2527
repositories {
2628
mavenCentral() // main maven repo
@@ -50,3 +52,17 @@ subprojects {
5052
options.compilerArgs.add("-Xlint:deprecation")
5153
}
5254
}
55+
56+
@SuppressWarnings("GrMethodMayBeStatic")
57+
fun versionFromTag(): String = Grgit.open(mapOf("currentDir" to project.rootDir)).use { git ->
58+
val headTag = git.tag
59+
.list()
60+
.find { it.commit.id == git.head().id }
61+
62+
val clean = git.status().isClean || System.getenv("CI") != null
63+
if (!clean) {
64+
println("Git state is dirty, setting version as snapshot.")
65+
}
66+
67+
return if (headTag != null && clean) headTag.name else "${git.head().id}-SNAPSHOT"
68+
}

plugin-api/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ plugins {
77

88
val archivesBaseName = "plugin-api"
99
group = "dev.arbjerg.lavalink"
10-
version = "3.6.1"
1110

1211
dependencies {
1312
api(libs.spring.boot)

0 commit comments

Comments
 (0)