aaden-cli 1.6.124 → 1.6.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AadenDeploy/windowsDesktop.sh +36 -12
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -103,9 +103,31 @@ public static class AadenIdle {
|
|
|
103
103
|
}
|
|
104
104
|
[AadenIdle]::Seconds()
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
# 最新版本:先读 S3(POS-36,发版 workflow 上传,和 GitHub Release 同一份 latest.yml);
|
|
107
|
+
# S3 读不到才退回 GitHub Releases(仓库改私有前的退路)。S3 的 latest.yml 带 sha512,下载后校验
|
|
108
|
+
function Get-LatestDesktop {
|
|
107
109
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
108
|
-
|
|
110
|
+
$base = 'https://aaden-backend.s3.eu-central-1.amazonaws.com/desktop/win/'
|
|
111
|
+
try {
|
|
112
|
+
$res = Invoke-WebRequest ($base + 'latest.yml') -UseBasicParsing -TimeoutSec 30
|
|
113
|
+
$yml = [Text.Encoding]::UTF8.GetString($res.RawContentStream.ToArray())
|
|
114
|
+
$version = [regex]::Match($yml, '(?m)^version:\s*(\S+)').Groups[1].Value
|
|
115
|
+
$name = [regex]::Match($yml, '(?m)^path:\s*(\S+)').Groups[1].Value
|
|
116
|
+
$sha512 = [regex]::Match($yml, '(?m)^sha512:\s*(\S+)').Groups[1].Value
|
|
117
|
+
$size = [regex]::Match($yml, '(?m)^\s+size:\s*(\d+)').Groups[1].Value
|
|
118
|
+
if ($version -and $name -and $sha512) {
|
|
119
|
+
return [pscustomobject]@{ Source = 's3'; Version = $version; Name = $name; Url = $base + $name; Sha512 = $sha512; Size = [long]$size }
|
|
120
|
+
}
|
|
121
|
+
} catch { }
|
|
122
|
+
$r = Invoke-RestMethod 'https://api.github.com/repos/innerken-gmbh/aaden-vue-app/releases/latest' -UseBasicParsing -TimeoutSec 30
|
|
123
|
+
$asset = $r.assets | Where-Object { $_.name -like '*.exe' } | Select-Object -First 1
|
|
124
|
+
if (-not $asset) { throw "release $($r.tag_name) has no .exe" }
|
|
125
|
+
[pscustomobject]@{ Source = 'github'; Version = $r.tag_name.TrimStart('v'); Name = $asset.name; Url = $asset.browser_download_url; Sha512 = $null; Size = [long]$asset.size }
|
|
126
|
+
}
|
|
127
|
+
function Get-Sha512Base64($path) {
|
|
128
|
+
$hex = (Get-FileHash $path -Algorithm SHA512).Hash
|
|
129
|
+
$bytes = [byte[]](0..($hex.Length / 2 - 1) | ForEach-Object { [Convert]::ToByte($hex.Substring($_ * 2, 2), 16) })
|
|
130
|
+
[Convert]::ToBase64String($bytes)
|
|
109
131
|
}
|
|
110
132
|
EOF
|
|
111
133
|
|
|
@@ -128,7 +150,7 @@ $pending = Join-Path $env:LOCALAPPDATA 'aaden-updater\pending'
|
|
|
128
150
|
if (Test-Path $pending) { "updater_pending=$((Get-ChildItem $pending | ForEach-Object { $_.Name }) -join ',')" } else { 'updater_pending=none' }
|
|
129
151
|
$startup = [Environment]::GetFolderPath('Startup')
|
|
130
152
|
"startup_run_hidden=$(Test-Path (Join-Path $startup 'run_hidden.vbs'))"
|
|
131
|
-
try { $
|
|
153
|
+
try { $l = Get-LatestDesktop; "latest=$($l.Version) source=$($l.Source)" } catch { "latest=? $_" }
|
|
132
154
|
EOF
|
|
133
155
|
|
|
134
156
|
read -r -d '' PS_UPDATE <<'EOF'
|
|
@@ -140,17 +162,19 @@ if ($other.Count) { "ABORT: Aaden Desktop is running in another session ($(($oth
|
|
|
140
162
|
$idle = Get-IdleSeconds
|
|
141
163
|
"idle_seconds=$idle"
|
|
142
164
|
if ($idle -lt __MIN_IDLE__) { "BUSY: last keyboard/mouse input $idle s ago (< __MIN_IDLE__ s), not touching it"; exit 22 }
|
|
143
|
-
$
|
|
144
|
-
$latest = $
|
|
145
|
-
"latest=$latest"
|
|
165
|
+
$l = Get-LatestDesktop
|
|
166
|
+
$latest = $l.Version
|
|
167
|
+
"latest=$latest source=$($l.Source)"
|
|
146
168
|
if ($current -eq $latest) { 'UP_TO_DATE'; exit 0 }
|
|
147
|
-
$
|
|
148
|
-
|
|
149
|
-
$file = Join-Path $env:TEMP $asset.name
|
|
150
|
-
Invoke-WebRequest $asset.browser_download_url -OutFile $file -UseBasicParsing -TimeoutSec 900
|
|
169
|
+
$file = Join-Path $env:TEMP $l.Name
|
|
170
|
+
Invoke-WebRequest $l.Url -OutFile $file -UseBasicParsing -TimeoutSec 900
|
|
151
171
|
$size = (Get-Item $file).Length
|
|
152
|
-
"downloaded $($
|
|
153
|
-
if ($size -ne $
|
|
172
|
+
"downloaded $($l.Name) $size bytes"
|
|
173
|
+
if ($l.Size -and $size -ne $l.Size) { "ABORT: size mismatch, expected $($l.Size)"; exit 23 }
|
|
174
|
+
if ($l.Sha512) {
|
|
175
|
+
if ((Get-Sha512Base64 $file) -ne $l.Sha512) { 'ABORT: sha512 mismatch, not installing'; exit 23 }
|
|
176
|
+
'sha512 ok'
|
|
177
|
+
}
|
|
154
178
|
# 下载可能要几分钟,动手前再确认一次没人在用
|
|
155
179
|
$idle = Get-IdleSeconds
|
|
156
180
|
if ($idle -lt __MIN_IDLE__) { "BUSY after download: last input $idle s ago, not touching it"; exit 22 }
|
package/dist/index.js
CHANGED
|
@@ -19355,7 +19355,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
|
|
|
19355
19355
|
/***/ ((module) => {
|
|
19356
19356
|
|
|
19357
19357
|
"use strict";
|
|
19358
|
-
module.exports = {"i8":"1.6.
|
|
19358
|
+
module.exports = {"i8":"1.6.125"};
|
|
19359
19359
|
|
|
19360
19360
|
/***/ })
|
|
19361
19361
|
|