mirror of
https://github.com/PaperMC/Waterfall.git
synced 2025-02-26 08:41:28 +01:00
36 lines
2.0 KiB
Diff
36 lines
2.0 KiB
Diff
From e8b830735afa54b82ac3ebbc9a64601a4dbfb360 Mon Sep 17 00:00:00 2001
|
|
From: Tux <write@imaginarycode.com>
|
|
Date: Thu, 19 May 2016 11:34:52 -0700
|
|
Subject: [PATCH] Fetch modules from the Waterfall API endpoint
|
|
|
|
Don't fetch from the BungeeCord CI, as that only has their modules
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/module/JenkinsModuleSource.java b/proxy/src/main/java/net/md_5/bungee/module/JenkinsModuleSource.java
|
|
index 064639f3..6a6661a5 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/module/JenkinsModuleSource.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/module/JenkinsModuleSource.java
|
|
@@ -19,11 +19,19 @@ public class JenkinsModuleSource implements ModuleSource
|
|
ProxyServer.getInstance().getLogger().info( "Attempting to Jenkins download module " + module.getName() + " v" + version.getBuild() );
|
|
try
|
|
{
|
|
- URL website = new URL( "https://ci.md-5.net/job/BungeeCord/" + version.getBuild() + "/artifact/module/" + module.getName().replace( '_', '-' ) + "/target/" + module.getName() + ".jar" );
|
|
+ final String url = String.format(
|
|
+ "https://api.papermc.io/v2/projects/%1$s/versions/%2$s/builds/%3$s/downloads/%4$s-%2$s-%3$s.jar",
|
|
+ "waterfall",
|
|
+ net.md_5.bungee.api.ProxyServer.getInstance().getVersion().split(":")[2].split("-")[0],
|
|
+ version.getBuild(),
|
|
+ module.getName()
|
|
+ );
|
|
+ URL website = new URL( url );
|
|
URLConnection con = website.openConnection();
|
|
// 15 second timeout at various stages
|
|
con.setConnectTimeout( 15000 );
|
|
con.setReadTimeout( 15000 );
|
|
+ con.setRequestProperty( "User-Agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36" );
|
|
|
|
Files.write( ByteStreams.toByteArray( con.getInputStream() ), module.getFile() );
|
|
ProxyServer.getInstance().getLogger().info( "Download complete" );
|
|
--
|
|
2.47.0
|
|
|