Skip to content

Commit

Permalink
Set User-Agent for plugin downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Nov 13, 2023
1 parent 94f101d commit aa84d16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ internal abstract class PluginDownloadServiceImpl : PluginDownloadService {
try {
connection.instanceFollowRedirects = true
connection.setRequestProperty("Accept", "application/octet-stream")
connection.setRequestProperty("User-Agent", Constants.USER_AGENT)

if (ctx.targetFile.isRegularFile()) {
if (ctx.version.lastUpdateCheck > 0 && ctx.version.hash?.check(ctx.targetFile) != false) {
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/main/kotlin/xyz/jpenilla/runtask/util/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ internal object Constants {
const val GITHUB_PLUGIN_DIR = "github"
const val URL_PLUGIN_DIR = "url"

const val USER_AGENT = "run-task"

object Plugins {
const val SHADOW_PLUGIN_ID = "com.github.johnrengelman.shadow"
const val SHADOW_JAR_TASK_NAME = "shadowJar"
Expand Down

0 comments on commit aa84d16

Please sign in to comment.