diff --git a/1.10-mcp931/build.properties b/1.10-mcp931/build.properties index f645a32..3fd6c55 100644 --- a/1.10-mcp931/build.properties +++ b/1.10-mcp931/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.10 +minecraft_full_versions=1.10,1.10.1,1.10.2 #forge gradle needs forge version forge_mc_version=1.10.2 forge_version=12.18.2.2099 diff --git a/1.11-test/build.properties b/1.11-test/build.properties index 8bd4ea7..643b399 100644 --- a/1.11-test/build.properties +++ b/1.11-test/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.11 +minecraft_full_versions=1.11 #forge gradle needs forge version forge_mc_version=1.11 forge_version=13.19.0.2153 diff --git a/1.7.10-mcp908/build.gradle b/1.7.10-mcp908/build.gradle index 132e5e7..9efa71c 100644 --- a/1.7.10-mcp908/build.gradle +++ b/1.7.10-mcp908/build.gradle @@ -48,6 +48,13 @@ minecraft { replace '@MOD_VERSION@', rootConfig.version replace '@MOD_FULL_VERSION@', project.version replaceIn 'CustomSkinLoader.java' + + replace '@MC_VERSION@', config.minecraft_version + replace '@MC_FULL_VERSIONS@', config.minecraft_full_versions + replace '@FORGE_VERSION@', config.forge_version + replace '@GIT_VERSION@', System.getenv("GIT_VERSION") + replace '@BUILD_URL@', System.getenv("BUILD_URL") + replaceIn 'BuildInfo.json' } jar { diff --git a/1.7.10-mcp908/build.properties b/1.7.10-mcp908/build.properties index 4dba761..1cb9843 100644 --- a/1.7.10-mcp908/build.properties +++ b/1.7.10-mcp908/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.7.10 +minecraft_full_versions=1.7.9,1.7.10 #forge gradle needs forge version forge_mc_version=1.7.10 forge_version=10.13.4.1558-1.7.10 diff --git a/1.8-mcp910/build.properties b/1.8-mcp910/build.properties index cf0d83d..6378d18 100644 --- a/1.8-mcp910/build.properties +++ b/1.8-mcp910/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.8 +minecraft_full_versions=1.8 #forge gradle needs forge version forge_mc_version=1.8 forge_version=11.14.4.1563 diff --git a/1.8.8-mcp918/build.properties b/1.8.8-mcp918/build.properties index c68caa2..c63817e 100644 --- a/1.8.8-mcp918/build.properties +++ b/1.8.8-mcp918/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.8.8 +minecraft_full_versions=1.8.4,1.8.5,1.8.6,1.8.7,1.8.8,1.8.9 #forge gradle needs forge version forge_mc_version=1.8.9 forge_version=11.15.1.1722 diff --git a/1.9-mcp924/build.properties b/1.9-mcp924/build.properties index 333d6dc..ace6552 100644 --- a/1.9-mcp924/build.properties +++ b/1.9-mcp924/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.9 +minecraft_full_versions=1.9 #forge gradle needs forge version forge_mc_version=1.9 forge_version=12.16.1.1887 diff --git a/1.9.4-mcp928/build.properties b/1.9.4-mcp928/build.properties index 945910e..0eed985 100644 --- a/1.9.4-mcp928/build.properties +++ b/1.9.4-mcp928/build.properties @@ -1,4 +1,5 @@ minecraft_version=1.9.4 +minecraft_full_versions=1.9.3,1.9.4 #forge gradle needs forge version forge_mc_version=1.9.4 forge_version=12.17.0.1976 diff --git a/Common/BuildInfo.json b/Common/BuildInfo.json new file mode 100644 index 0000000..e851b2e --- /dev/null +++ b/Common/BuildInfo.json @@ -0,0 +1,10 @@ +{ + "name": "CustomSkinLoader", + "version": "@MOD_VERSION@", + "fullVersion": "@MOD_FULL_VERSION@", + "mcVersion": "@MC_VERSION@", + "mcFullVersions": "@MC_FULL_VERSIONS@", + "forgeVersion": "@FORGE_VERSION@", + "gitVersion": "@GIT_VERSION@", + "buildUrl": "@BUILD_URL@" +} \ No newline at end of file diff --git a/Common/customskinloader/config/SkinSiteProfile.java b/Common/customskinloader/config/SkinSiteProfile.java index 711b277..fc1f7dc 100644 --- a/Common/customskinloader/config/SkinSiteProfile.java +++ b/Common/customskinloader/config/SkinSiteProfile.java @@ -10,6 +10,7 @@ public class SkinSiteProfile { public String root; public CustomSkinAPIPlusPrivacy privacy; + public Boolean checkPNG;//Not suitable for local skin public String skin; public String model; public String cape; @@ -47,7 +48,9 @@ public class SkinSiteProfile { SkinSiteProfile ssp=new SkinSiteProfile(); ssp.name=name; ssp.type="Legacy"; + ssp.checkPNG=false; ssp.skin=skin; + ssp.model="default"; ssp.cape=cape; ssp.elytra=elytra; return ssp; diff --git a/Common/customskinloader/loader/LegacyLoader.java b/Common/customskinloader/loader/LegacyLoader.java index 1ddcadf..0a667f3 100644 --- a/Common/customskinloader/loader/LegacyLoader.java +++ b/Common/customskinloader/loader/LegacyLoader.java @@ -30,7 +30,7 @@ public class LegacyLoader implements ProfileLoader.IProfileLoader { if(skinFile.exists()&&skinFile.isFile()) profile.skinUrl=HttpTextureUtil.getLocalLegacyFakeUrl(skin, HttpTextureUtil.getHash(skin, skinFile.length(), skinFile.lastModified())); }else{ - HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(skin).setUserAgent(ssp.userAgent).setLoadContent(false).setCacheTime(60)); + HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(skin).setUserAgent(ssp.userAgent).setCheckPNG(ssp.checkPNG!=null&&ssp.checkPNG!=false).setLoadContent(false).setCacheTime(60)); if(responce.success) profile.skinUrl=HttpTextureUtil.getLegacyFakeUrl(skin); } @@ -43,7 +43,7 @@ public class LegacyLoader implements ProfileLoader.IProfileLoader { if(capeFile.exists()&&capeFile.isFile()) profile.capeUrl=HttpTextureUtil.getLocalLegacyFakeUrl(cape, HttpTextureUtil.getHash(cape, capeFile.length(), capeFile.lastModified())); }else{ - HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(cape).setUserAgent(ssp.userAgent).setLoadContent(false).setCacheTime(60)); + HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(cape).setUserAgent(ssp.userAgent).setCheckPNG(ssp.checkPNG!=null&&ssp.checkPNG!=false).setLoadContent(false).setCacheTime(60)); if(responce.success) profile.capeUrl=HttpTextureUtil.getLegacyFakeUrl(cape); } @@ -55,7 +55,7 @@ public class LegacyLoader implements ProfileLoader.IProfileLoader { if(elytraFile.exists()&&elytraFile.isFile()) profile.elytraUrl=HttpTextureUtil.getLocalLegacyFakeUrl(elytra, HttpTextureUtil.getHash(elytra, elytraFile.length(), elytraFile.lastModified())); }else{ - HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(elytra).setUserAgent(ssp.userAgent).setLoadContent(false).setCacheTime(60)); + HttpResponce responce=HttpRequestUtil.makeHttpRequest(new HttpRequest(elytra).setUserAgent(ssp.userAgent).setCheckPNG(ssp.checkPNG!=null&&ssp.checkPNG!=false).setLoadContent(false).setCacheTime(60)); if(responce.success) profile.elytraUrl=HttpTextureUtil.getLegacyFakeUrl(elytra); } diff --git a/Common/customskinloader/loader/jsonapi/CustomSkinAPIPlus.java b/Common/customskinloader/loader/jsonapi/CustomSkinAPIPlus.java index 8a7b9b7..1b20390 100644 --- a/Common/customskinloader/loader/jsonapi/CustomSkinAPIPlus.java +++ b/Common/customskinloader/loader/jsonapi/CustomSkinAPIPlus.java @@ -2,10 +2,8 @@ package customskinloader.loader.jsonapi; import java.io.File; import java.util.UUID; -import java.util.prefs.Preferences; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; import com.google.gson.Gson; diff --git a/Common/customskinloader/utils/HttpRequestUtil.java b/Common/customskinloader/utils/HttpRequestUtil.java index 85a8afd..6f5da3e 100644 --- a/Common/customskinloader/utils/HttpRequestUtil.java +++ b/Common/customskinloader/utils/HttpRequestUtil.java @@ -25,6 +25,7 @@ public class HttpRequestUtil { public String userAgent=null; public String payload=null; public boolean loadContent=true; + public boolean checkPNG=false; public int cacheTime=600;//-1=No Cache 0=Always Cache t=Default Cache Time(second) public File cacheFile=null;//Default Cache File @@ -44,6 +45,10 @@ public class HttpRequestUtil { this.loadContent=loadContent; return this; } + public HttpRequest setCheckPNG(boolean checkPNG){ + this.checkPNG=checkPNG; + return this; + } public HttpRequest setCacheTime(int cacheTime){ this.cacheTime=cacheTime; return this; @@ -137,6 +142,11 @@ public class HttpRequestUtil { //Load Content InputStream is="gzip".equals(c.getContentEncoding())?new GZIPInputStream(c.getInputStream()):c.getInputStream(); byte [] bytes = IOUtils.toByteArray(is); + if(request.checkPNG&&(bytes.length<=4||bytes[1]!=(byte)'P'||bytes[2]!=(byte)'N'||bytes[3]!=(byte)'G')){ + CustomSkinLoader.logger.info("Failed to request (Not Standard PNG)"); + responce.success=false; + return responce; + } if(request.cacheFile!=null){ FileUtils.writeByteArrayToFile(request.cacheFile, bytes); if(cacheInfoFile!=null){ diff --git a/build.properties b/build.properties index 88d2309..bc40cd7 100644 --- a/build.properties +++ b/build.properties @@ -3,4 +3,4 @@ group=customskinloader version=14.6 dev_version= #RELEASE: snapshot=0 -snapshot=1 \ No newline at end of file +snapshot=0 \ No newline at end of file diff --git a/common.gradle b/common.gradle index 241b9d0..921504a 100644 --- a/common.gradle +++ b/common.gradle @@ -42,6 +42,13 @@ minecraft { replace '@MOD_VERSION@', rootProject.ext.config.version replace '@MOD_FULL_VERSION@', project.version replaceIn 'CustomSkinLoader.java' + + replace '@MC_VERSION@', config.minecraft_version + replace '@MC_FULL_VERSIONS@', config.minecraft_full_versions + replace '@FORGE_VERSION@', config.forge_version + replace '@GIT_VERSION@', System.getenv("GIT_VERSION") + replace '@BUILD_URL@', System.getenv("BUILD_URL") + replaceIn 'BuildInfo.json' } jar {