Skip to content

Commit f7a101a

Browse files
committed
Merge branch 'main' into seal-on-main
2 parents a94454d + 1935b4b commit f7a101a

3 files changed

Lines changed: 9 additions & 29 deletions

File tree

acidify-core-js/tsdown.config.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,4 @@ export default defineConfig({
66
clean: true,
77
dts: false,
88
target: false,
9-
plugins: [
10-
{
11-
name: 'hack-eval-require',
12-
transform(code, id) {
13-
const banner =
14-
`import { createRequire as __cr } from "node:module";\n` +
15-
`const require = __cr(import.meta.url);\n`;
16-
const hitRE = /eval\(\s*['"]require['"]\s*\)/
17-
if (!/\.(mjs|js|mts|ts|jsx|tsx)$/.test(id)) return null;
18-
if (!hitRE.test(code)) return null;
19-
if (code.includes("createRequire as __cr") && code.includes("__cr(import.meta.url)")) {
20-
return null;
21-
}
22-
return {
23-
code: banner + code,
24-
map: null,
25-
};
26-
}
27-
}
28-
],
299
});

acidify-core/src/commonMain/kotlin/org/ntqqrev/acidify/internal/context/FlashTransferContext.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import io.ktor.client.*
44
import io.ktor.client.request.*
55
import io.ktor.client.statement.*
66
import io.ktor.http.*
7-
import kotlinx.coroutines.async
87
import kotlinx.io.buffered
98
import kotlinx.io.readTo
109
import org.ntqqrev.acidify.common.MediaSource
@@ -68,6 +67,8 @@ internal class FlashTransferContext(client: AbstractClient) : AbstractContext(cl
6867
sha1StateList = sha1StateList,
6968
body = uploadBuffer
7069
)
70+
val progress = (chunkStart + chunkLength) * 100L / size
71+
logger.d { "FlashTransfer 上传进度: $progress%" }
7172
if (!success) {
7273
return false
7374
}
@@ -84,7 +85,7 @@ internal class FlashTransferContext(client: AbstractClient) : AbstractContext(cl
8485
start: Int,
8586
sha1StateList: List<ByteArray>,
8687
body: ByteArray
87-
): Boolean = client.async {
88+
): Boolean {
8889
val chunkSha1 = body.sha1()
8990
val end = start + body.size - 1
9091
val req = FlashTransferUploadReq(
@@ -117,19 +118,18 @@ internal class FlashTransferContext(client: AbstractClient) : AbstractContext(cl
117118
val responseBytes = response.readRawBytes()
118119
if (!response.status.isSuccess()) {
119120
logger.e { "FlashTransfer 上传块 $start 失败: ${response.status}, ${responseBytes.toHexString()}" }
120-
return@async false
121+
return false
121122
}
122123
val resp = responseBytes.pbDecode<FlashTransferUploadResp>()
123124
val status = resp.status
124125
if (status != "success") {
125126
logger.e { "FlashTransfer 上传块 $start 失败: $status" }
126-
return@async false
127+
return false
127128
}
128-
logger.d { "FlashTransfer 上传块 $start 成功" }
129-
true
129+
return true
130130
} catch (e: Exception) {
131131
logger.e(e) { "FlashTransfer 上传块 $start 异常: ${e.message}" }
132-
false
132+
return false
133133
}
134-
}.await()
134+
}
135135
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ kx-coroutines = "1.11.0"
99
kx-io = "0.9.0"
1010
kx-datetime = "0.8.0-0.6.x-compat"
1111
kx-atomicfu = "0.32.1"
12-
ktor = "3.4.3"
12+
ktor = "3.5.0"
1313

1414
acidify-codec = "0.1.0"
1515
ktfs = "0.2.0"

0 commit comments

Comments
 (0)