-
-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Plugin Update Checker #1121
base: dev
Are you sure you want to change the base?
Conversation
LavalinkServer/build.gradle.kts
Outdated
@@ -65,6 +65,7 @@ dependencies { | |||
implementation(libs.kotlin.reflect) | |||
implementation(libs.logback) | |||
implementation(libs.sentry.logback) | |||
implementation(libs.semver) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this lib really needed? we already have a way to parse semver in
fun fromSemver(semver: String): Version { |
you would just need to add a method to compare them which should be easy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I didnt see this thanks!
val connection = URL(basePath).openConnection() as HttpURLConnection | ||
connection.inputStream.bufferedReader().use { | ||
val lines = it.readLines() | ||
for (line in lines) { | ||
val regex = "<latest>(.*?)</latest>".toRegex() | ||
val match = regex.find(line) | ||
val latest = match?.groups?.get(1)?.value | ||
if (latest != null) { | ||
val latestVersion = latest.toVersion() | ||
val currentVersion = declaration.version.toVersion() | ||
|
||
if(latestVersion > currentVersion) { | ||
log.warn("A newer version of ${declaration.name} was found: $latestVersion. " + | ||
"The current version is $currentVersion.") | ||
} else { | ||
log.info("Plugin ${declaration.name} is up to date") | ||
} | ||
break | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please not regex XML?
With #1049 we want to parse the maven-metadata.xml
anyway
3c3b547
to
26bf4bf
Compare
Adds a plugin update checker function to
PluginManager.kt
that runs on application startupCloses #1044
The function checks the maven repository of each plugin declaration and searches the maven metadata file for the latest version. If then compares the latest version and current version installed and writes to the console if the user needs to update. The 3rd party library "semver" is used as a dependency to compare versions.