diff options
Diffstat (limited to 'src/lpm.lua')
-rw-r--r-- | src/lpm.lua | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/lpm.lua b/src/lpm.lua index cff5562..02738a8 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -459,7 +459,10 @@ local function prompt(message) end function common.get(source, target, checksum) - if not checksum then return system.get(source, target) end + local _, _, protocol, hostname, port, rest = source:find("^(https?)://([^:/?]+):?(%d*)(.*)$") + if not protocol then error("malfomed url " .. source) end + if not port or port == "" then port = protocol == "https" and 443 or 80 end + if not checksum then return system.get(protocol, hostname, port, rest, target) end if not system.stat(CACHEDIR .. PATHSEP .. "files") then common.mkdirp(CACHEDIR .. PATHSEP .. "files") end local cache_path = CACHEDIR .. PATHSEP .. "files" .. PATHSEP .. checksum if not system.stat(cache_path) then @@ -1611,15 +1614,25 @@ Flags have the following effects: "/etc/openssl/certs", -- NetBSD "/var/ssl/certs", -- AIX } - for i, path in ipairs(paths) do - local stat = system.stat(path) - if stat then - system.certs(stat.type, path) - break + if PLATFORM == "windows" then + system.certs("system", TMPDIR .. "certs.crt") + else + for i, path in ipairs(paths) do + local stat = system.stat(path) + if stat then + system.certs(stat.type, path) + break + end end end end + if ARGS[2] == "download" then + local file = common.get("https://raw.githubusercontent.com/adamharrison/lite-xl-simplified/master/manifest.json"); + print(file) + os.exit(0) + end + -- Base setup; initialize default repos if applicable, read them in. Determine Lite XL system binary if not specified, and pull in a list of all local lite-xl's. lpm_repo_init() |