From 6ed82a53c1223784d02ebad891a0f2575d87bbd6 Mon Sep 17 00:00:00 2001 From: luozhiya Date: Mon, 6 Jan 2025 18:10:45 +0800 Subject: [PATCH] Object 116 --- lua/fittencode/compression/gzip.lua | 1 + lua/fittencode/config.lua | 31 ++++++++++------------------- lua/fittencode/http/init.lua | 2 +- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/lua/fittencode/compression/gzip.lua b/lua/fittencode/compression/gzip.lua index c865098..1715a30 100644 --- a/lua/fittencode/compression/gzip.lua +++ b/lua/fittencode/compression/gzip.lua @@ -50,6 +50,7 @@ function M.compress(format, input, options) local fw = assert(vim.uv.fs_open(gz, 'r', 438)) local content = vim.uv.fs_read(fw, -1) vim.uv.fs_close(fw) + vim.uv.fs_unlink(gz) Fn.schedule_call(options.on_once, content) else Fn.schedule_call(options.on_error) diff --git a/lua/fittencode/config.lua b/lua/fittencode/config.lua index 5d30957..cbd7408 100644 --- a/lua/fittencode/config.lua +++ b/lua/fittencode/config.lua @@ -172,22 +172,11 @@ local defaults = { level = vim.log.levels.WARN, }, hash = { - sm3 = { - -- SM3 hash - -- Avaiable options: - -- * 'gmssl' - -- * 'cc' - backend = 'md5sum', - gmssl = { - -- Default `gmssl` - command = '', - } - }, md5 = { -- MD5 hash -- Avaiable options: -- * 'md5sum' - -- * 'cc' + -- * 'hash' backend = 'md5sum', md5sum = { -- Default `md5sum` @@ -196,20 +185,22 @@ local defaults = { } }, compress = { - -- Avaiable options: - -- * 'gzip' - -- * 'zlib' (Only available on Linux) - backend = 'gzip', gzip = { - -- Default `gzip` - command = '', - }, + -- Avaiable options: + -- * 'gzip' + -- * 'zlib' (Only available on Linux) + backend = 'gzip', + gzip = { + -- Default `gzip` + command = '', + }, + } }, http = { -- Avaiable options: -- * 'curl' -- * 'libcurl' (Only available on Linux) - backend = 'libcurl', + backend = 'curl', -- 0 (zero) which means request never times out during transfer timeout = 600, -- seconds curl = { diff --git a/lua/fittencode/http/init.lua b/lua/fittencode/http/init.lua index b8194e5..bcda58b 100644 --- a/lua/fittencode/http/init.lua +++ b/lua/fittencode/http/init.lua @@ -9,7 +9,7 @@ local M = {} ---@param options? FittenCode.HTTP.Request function M.fetch(url, options) local fetch - if Config.http.backend == 'libcurl' and Fn.is_linux() then + if Config.http.backend == 'libcurl' then fetch = require('fittencode.http.libcurl').fetch else fetch = require('fittencode.http.curl').fetch