mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-08-26 11:32:02 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 054e9cc1ec |
@@ -457,7 +457,7 @@ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtow
|
||||
> 注意: netdisk-fast-download.service中的ExecStart的路径改为实际路径
|
||||
```shell
|
||||
cd ~
|
||||
wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v0.4.2/netdisk-fast-download-linux-amd64.zip
|
||||
wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v0.4.5/netdisk-fast-download-linux-amd64.zip
|
||||
unzip netdisk-fast-download.zip
|
||||
cd netdisk-fast-download
|
||||
bash service-install.sh
|
||||
|
||||
@@ -162,13 +162,18 @@ public class CommonUtil {
|
||||
try (var is = CommonUtil.class.getClassLoader().getResourceAsStream("app.properties")) {
|
||||
if (is != null) {
|
||||
properties.load(is);
|
||||
if (!properties.isEmpty()) {
|
||||
appVersion = properties.getProperty("app.version") + "build" + properties.getProperty("build");
|
||||
String version = properties.getProperty("app.version");
|
||||
String build = properties.getProperty("build");
|
||||
if (version != null && !version.contains("${")) {
|
||||
appVersion = version + "build" + (build == null || build.contains("${") ? "" : build);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("读取app.properties失败", e);
|
||||
}
|
||||
if (appVersion == null) {
|
||||
appVersion = "unknown";
|
||||
}
|
||||
}
|
||||
return appVersion;
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@
|
||||
<lombok.version>1.18.38</lombok.version>
|
||||
<slf4j.version>2.0.16</slf4j.version>
|
||||
<commons-lang3.version>3.18.0</commons-lang3.version>
|
||||
<jackson.version>2.18.6</jackson.version>
|
||||
<jackson.version>2.18.9</jackson.version>
|
||||
<logback.version>1.5.32</logback.version>
|
||||
<junit.version>4.13.2</junit.version>
|
||||
</properties>
|
||||
|
||||
@@ -368,9 +368,12 @@ public abstract class PanBase implements IPanTool, Closeable {
|
||||
// 检查响应头中的Content-Encoding是否为gzip
|
||||
String contentEncoding = res.getHeader("Content-Encoding");
|
||||
try {
|
||||
if ("gzip".equalsIgnoreCase(contentEncoding)) {
|
||||
if ("gzip".equalsIgnoreCase(contentEncoding) && res.body() instanceof Buffer gzipBody
|
||||
&& gzipBody.length() >= 2
|
||||
&& (gzipBody.getByte(0) & 0xff) == 0x1f
|
||||
&& (gzipBody.getByte(1) & 0xff) == 0x8b) {
|
||||
// 如果是gzip压缩的响应体,解压(只解压一次,缓存结果)
|
||||
String decompressed = decompressGzip((Buffer) res.body());
|
||||
String decompressed = decompressGzip(gzipBody);
|
||||
return new JsonObject(decompressed);
|
||||
} else {
|
||||
return res.bodyAsJsonObject();
|
||||
|
||||
@@ -119,8 +119,18 @@ public class HttpResponseHelper {
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean looksLikeGzip(Buffer compressed) {
|
||||
return compressed != null && compressed.length() >= 2
|
||||
&& (compressed.getByte(0) & 0xff) == 0x1f
|
||||
&& (compressed.getByte(1) & 0xff) == 0x8b;
|
||||
}
|
||||
|
||||
// -------------------- gzip --------------------
|
||||
private static String decompressGzip(Buffer compressed) throws IOException {
|
||||
// Vert.x 可能已解压但仍带 Content-Encoding: gzip,再走 GZIPInputStream 会变成 ZipException
|
||||
if (!looksLikeGzip(compressed)) {
|
||||
return compressed.toString(StandardCharsets.UTF_8);
|
||||
}
|
||||
try (ByteArrayInputStream bais = new ByteArrayInputStream(compressed.getBytes());
|
||||
GZIPInputStream gzis = new GZIPInputStream(bais);
|
||||
InputStreamReader isr = new InputStreamReader(gzis, StandardCharsets.UTF_8);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<revision>0.4.4</revision>
|
||||
<revision>0.4.5</revision>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nfd-web",
|
||||
"version": "0.4.2",
|
||||
"version": "0.4.5",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
||||
@@ -30,6 +30,16 @@
|
||||
<groupId>cn.qaiu</groupId>
|
||||
<artifactId>parser</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
||||
@@ -463,11 +463,14 @@ public class ParserApi {
|
||||
// 获取版本号
|
||||
@RouteMapping("/build-version")
|
||||
public String getVersion() {
|
||||
return CommonUtil.getAppVersion()
|
||||
String version = CommonUtil.getAppVersion();
|
||||
if (version == null || version.isBlank()) {
|
||||
return "unknown";
|
||||
}
|
||||
return version
|
||||
.replace("-", "")
|
||||
.replace("Z", "")
|
||||
.replace("T", "_")
|
||||
.replace("-", "")
|
||||
.replace(":", "");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user