@aivin-labs/cli 1.0.31 → 1.0.32
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/bin/cli.mjs
CHANGED
|
@@ -842,7 +842,12 @@ program
|
|
|
842
842
|
return;
|
|
843
843
|
}
|
|
844
844
|
const next = normalizeServerUrl(target);
|
|
845
|
-
if (next === current)
|
|
845
|
+
if (next === current) {
|
|
846
|
+
// An explicit selection should persist even when the value currently comes only from
|
|
847
|
+
// AIVIN_BASE_URL or the built-in default; desktop launchers read server.json themselves.
|
|
848
|
+
if (!readActiveServer()) setActiveServer(next);
|
|
849
|
+
return console.log(`Đang dùng ${serverLabel(next)} (${next}).`);
|
|
850
|
+
}
|
|
846
851
|
const holder = lockHolder();
|
|
847
852
|
if (holder) {
|
|
848
853
|
const { proceed } = await inquirer.prompt([{
|
|
@@ -670,6 +670,14 @@ namespace AivinDesktop {
|
|
|
670
670
|
});
|
|
671
671
|
}
|
|
672
672
|
|
|
673
|
+
static int CompareVersions(string left, string right) {
|
|
674
|
+
string a = (left ?? "").Trim().TrimStart('v', 'V').Split('-')[0].Split('+')[0];
|
|
675
|
+
string b = (right ?? "").Trim().TrimStart('v', 'V').Split('-')[0].Split('+')[0];
|
|
676
|
+
Version av, bv;
|
|
677
|
+
if (Version.TryParse(a, out av) && Version.TryParse(b, out bv)) return av.CompareTo(bv);
|
|
678
|
+
return string.Compare(left, right, StringComparison.OrdinalIgnoreCase);
|
|
679
|
+
}
|
|
680
|
+
|
|
673
681
|
void Refresh() {
|
|
674
682
|
bool paired = HasPairedServer();
|
|
675
683
|
bool paused = File.Exists(PausedFile);
|
|
@@ -700,10 +708,14 @@ namespace AivinDesktop {
|
|
|
700
708
|
if (isUpdating) {
|
|
701
709
|
updateItem.Text = cfg.T("updateUpdating");
|
|
702
710
|
updateItem.Enabled = false;
|
|
703
|
-
} else if (!string.IsNullOrEmpty(siteLatest) &&
|
|
711
|
+
} else if (!string.IsNullOrEmpty(siteLatest) && CompareVersions(siteLatest, ver) > 0) {
|
|
704
712
|
updateItem.Text = "★ " + cfg.T("updateAvailable").Replace("{version}", siteLatest);
|
|
705
713
|
updateItem.Font = new Font(updateItem.Font, FontStyle.Bold);
|
|
706
714
|
updateItem.Enabled = true;
|
|
715
|
+
} else if (!string.IsNullOrEmpty(siteLatest)) {
|
|
716
|
+
updateItem.Text = "✓ " + cfg.T("updateUpToDate") + " (" + ver + ")";
|
|
717
|
+
updateItem.Font = new Font(updateItem.Font, FontStyle.Regular);
|
|
718
|
+
updateItem.Enabled = true;
|
|
707
719
|
} else {
|
|
708
720
|
updateItem.Text = cfg.T("updateCheckNow") + " (" + ver + ")";
|
|
709
721
|
updateItem.Font = new Font(updateItem.Font, FontStyle.Regular);
|
|
@@ -831,6 +843,9 @@ namespace AivinDesktop {
|
|
|
831
843
|
}
|
|
832
844
|
}
|
|
833
845
|
} catch { }
|
|
846
|
+
if (api == "https://api.aivin.vn") return "https://brain.aivin.vn";
|
|
847
|
+
if (api == "https://beta-api.aivin.vn") return "https://beta.aivin.vn";
|
|
848
|
+
if (api == "https://api.aivin.cloud") return "https://brain.aivin.cloud";
|
|
834
849
|
return "https://brain.aivin.cloud";
|
|
835
850
|
}
|
|
836
851
|
|
|
@@ -866,7 +881,7 @@ namespace AivinDesktop {
|
|
|
866
881
|
// Unknown default browsers keep their own profile/session via the normal URL handler.
|
|
867
882
|
if (exe == null && progId.Length == 0) exe = BrowserPath("edge") ?? BrowserPath("chrome");
|
|
868
883
|
if (exe != null) {
|
|
869
|
-
ProcessStartInfo app = new ProcessStartInfo(exe, "--app=\"" + url + "\"");
|
|
884
|
+
ProcessStartInfo app = new ProcessStartInfo(exe, "--app=\"" + url + "\" --start-maximized");
|
|
870
885
|
app.UseShellExecute = false;
|
|
871
886
|
Process.Start(app);
|
|
872
887
|
return;
|
|
@@ -563,7 +563,7 @@ $script:topTimer.Start()
|
|
|
563
563
|
# change: the bot sits at the anchor inside it, the boxes (ask box, bubble, activity panel) are laid out around the bot (ArrangeBoxes).
|
|
564
564
|
$wa = [Windows.SystemParameters]::WorkArea
|
|
565
565
|
$script:cx = if ($cfg.x -ne $null) { [double]$cfg.x } else { $wa.Right - 76 }
|
|
566
|
-
$script:cy = if ($cfg.y -ne $null) { [double]$cfg.y } else { $
|
|
566
|
+
$script:cy = if ($cfg.y -ne $null) { [double]$cfg.y } else { [Windows.SystemParameters]::PrimaryScreenHeight - ${MASCOT_BOX.h - MASCOT_CENTER.y} }
|
|
567
567
|
# Bot center inside the window (DIPs).
|
|
568
568
|
$script:mx = ${WINDOW.w / 2}; $script:my = ${WINDOW.h - ROOT_MARGIN - (MASCOT_BOX.h - MASCOT_CENTER.y)}
|
|
569
569
|
function DeviceScale {
|