mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] FileAuthSystem slim support
This commit is contained in:
parent
9351f3ca1e
commit
b10535042f
2 changed files with 7 additions and 6 deletions
|
@ -29,7 +29,7 @@ public RequestTextureProvider(String skinURL, String cloakURL) {
|
|||
|
||||
private static Texture getTexture(String url, boolean cloak) throws IOException {
|
||||
try {
|
||||
return new Texture(url, cloak);
|
||||
return new Texture(url, cloak, null);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
return null; // Simply not found
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ private static Texture getTexture(String url, boolean cloak) throws IOException
|
|||
|
||||
private static Texture getTexture(String url, Path local, boolean cloak) throws IOException {
|
||||
try {
|
||||
return new Texture(url, local, cloak);
|
||||
return new Texture(url, local, cloak, null);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
return null; // Simply not found
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public final class Texture extends StreamObject {
|
|||
|
||||
public final Map<String, String> metadata;
|
||||
|
||||
public Texture(String url, boolean cloak) throws IOException {
|
||||
public Texture(String url, boolean cloak, Map<String, String> metadata) throws IOException {
|
||||
this.url = IOHelper.verifyURL(url);
|
||||
|
||||
// Fetch texture
|
||||
|
@ -38,19 +38,20 @@ public Texture(String url, boolean cloak) throws IOException {
|
|||
|
||||
// Get digest of texture
|
||||
digest = SecurityHelper.digest(DIGEST_ALGO, new URL(url));
|
||||
metadata = null; // May be auto-detect?
|
||||
this.metadata = metadata; // May be auto-detect?
|
||||
}
|
||||
|
||||
public Texture(String url, Path local, boolean cloak) throws IOException {
|
||||
public Texture(String url, Path local, boolean cloak, Map<String, String> metadata) throws IOException {
|
||||
this.url = IOHelper.verifyURL(url);
|
||||
try (InputStream input = IOHelper.newInput(local)) {
|
||||
IOHelper.readTexture(input, cloak); // Verify texture
|
||||
}
|
||||
this.digest = SecurityHelper.digest(DIGEST_ALGO, local);
|
||||
this.metadata = null;
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public Texture(String url, byte[] digest) {
|
||||
this.url = IOHelper.verifyURL(url);
|
||||
this.digest = digest == null ? new byte[0] : digest;
|
||||
|
|
Loading…
Reference in a new issue