mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Include path in qhash
This commit is contained in:
parent
e0225d3e63
commit
39d3168227
1 changed files with 10 additions and 9 deletions
|
@ -109,6 +109,12 @@ public class URLUtils {
|
||||||
queryPairs.add(List.of("host", host));
|
queryPairs.add(List.of("host", host));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String path = url.getPath();
|
||||||
|
|
||||||
|
if (path.contains("=")) {
|
||||||
|
path = StringUtils.substringBefore(path, "=") + "=" + StringUtils.substringAfter(path, "=").replace("-rj", "-rw");
|
||||||
|
}
|
||||||
|
|
||||||
if (PROXY_HASH_SECRET != null)
|
if (PROXY_HASH_SECRET != null)
|
||||||
try {
|
try {
|
||||||
MessageDigest md = MessageDigest.getInstance("BLAKE3-256");
|
MessageDigest md = MessageDigest.getInstance("BLAKE3-256");
|
||||||
|
@ -117,6 +123,8 @@ public class URLUtils {
|
||||||
md.update(pair.get(1).getBytes(StandardCharsets.UTF_8));
|
md.update(pair.get(1).getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
md.update(path.getBytes(StandardCharsets.UTF_8));
|
||||||
|
|
||||||
md.update(PROXY_HASH_SECRET);
|
md.update(PROXY_HASH_SECRET);
|
||||||
|
|
||||||
queryPairs.add(List.of("qhash", Hex.encodeHexString(md.digest()).substring(0, 8)));
|
queryPairs.add(List.of("qhash", Hex.encodeHexString(md.digest()).substring(0, 8)));
|
||||||
|
@ -124,13 +132,6 @@ public class URLUtils {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String path = url.getPath();
|
|
||||||
|
|
||||||
if (path.contains("=")) {
|
|
||||||
path = StringUtils.substringBefore(path, "=") + "=" + StringUtils.substringAfter(path, "=").replace("-rj", "-rw");
|
|
||||||
}
|
|
||||||
|
|
||||||
String newUrl = proxy + path;
|
String newUrl = proxy + path;
|
||||||
|
|
||||||
StringBuilder qstring = null;
|
StringBuilder qstring = null;
|
||||||
|
@ -142,9 +143,9 @@ public class URLUtils {
|
||||||
qstring.append("&");
|
qstring.append("&");
|
||||||
}
|
}
|
||||||
|
|
||||||
qstring.append(pair.get(0));
|
qstring.append(silentEncode(pair.get(0)));
|
||||||
qstring.append("=");
|
qstring.append("=");
|
||||||
qstring.append(pair.get(1));
|
qstring.append(silentEncode(pair.get(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
newUrl += "?" + qstring;
|
newUrl += "?" + qstring;
|
||||||
|
|
Loading…
Reference in a new issue