diff --git a/module/CHANGELOG-CN.md b/module/CHANGELOG-CN.md index fc4d714..f15f730 100644 --- a/module/CHANGELOG-CN.md +++ b/module/CHANGELOG-CN.md @@ -3,6 +3,16 @@ 简体中文
+## 5.2.3 (2024/12/18) + +- 对于语言为 `zh-CN` 或设置为 `zh-CN` 的用户,之前默认会使用 Gitee 源 `https://gitee.com/abgox/PSCompletions/raw/main` +- 但是 Gitee 源经常将版本号文件(如 `5.2.2`) 或者 16 位的 Guid 当做违规内容,这会让 `PSCompletions` 的功能受限。 +- 因此,现在使用 `https://abgox.github.io/PSCompletions` 作为模块和补全更新的默认首选源。 +- 现在尝试的顺序是: + 1. `https://abgox.github.io/PSCompletions` + 2. `https://gitee.com/abgox/PSCompletions/raw/main` + 3. `https://github.com/abgox/PSCompletions/raw/main` + ## 5.2.2 (2024/12/18) - 优化菜单的显示,让菜单项和命令帮助的显示更合理。 diff --git a/module/CHANGELOG.json b/module/CHANGELOG.json index faf0fc6..57f69c6 100644 --- a/module/CHANGELOG.json +++ b/module/CHANGELOG.json @@ -1,4 +1,28 @@ [ + { + "version": "5.2.3", + "info": { + "zh-CN": [ + "更新(2024/12/18)\n", + "- 对于语言为 zh-CN 或设置为 zh-CN 的用户,之前默认会使用 Gitee 源 https://gitee.com/abgox/PSCompletions/raw/main\n", + "- 但是 Gitee 源经常将版本号文件(如 5.2.2) 或者 16 位的 Guid 当做违规内容,这会让 PSCompletions 的功能受限。\n", + "- 因此,现在使用 https://abgox.github.io/PSCompletions 作为模块和补全更新的默认首选源。\n", + "- 现在尝试的顺序是:\n", + " 1. https://abgox.github.io/PSCompletions\n", + " 2. https://gitee.com/abgox/PSCompletions/raw/main\n", + " 3. https://github.com/abgox/PSCompletions/raw/main\n" + ], + "en-US": [ + "Update(2024/12/18)\n", + "- Use <@Magenta>https://abgox.github.io/PSCompletions<@Blue> as the primary source for module and completion updates.\n", + "- This is a fix specifically for those users whose language is <@Magenta>zh-CN<@Blue> or set to <@Magenta>zh-CN<@Blue>.\n", + "- The order to try now is:\n", + " 1. https://abgox.github.io/PSCompletions\n", + " 2. https://github.com/abgox/PSCompletions/raw/main\n", + " 3. https://gitee.com/abgox/PSCompletions/raw/main\n" + ] + } + }, { "version": "5.2.2", "info": { diff --git a/module/CHANGELOG.md b/module/CHANGELOG.md index b61ed15..64b2db0 100644 --- a/module/CHANGELOG.md +++ b/module/CHANGELOG.md @@ -3,6 +3,15 @@ English +## 5.2.3 (2024/12/18) + +- Use `https://abgox.github.io/PSCompletions` as the primary source for module and completion updates. +- This is a fix specifically for those users whose language is `zh-CN` or set to `zh-CN`. +- The order to try now is: + 1. `https://abgox.github.io/PSCompletions` + 2. `https://github.com/abgox/PSCompletions/raw/main` + 3. `https://gitee.com/abgox/PSCompletions/raw/main` + ## 5.2.2 (2024/12/18) - Optimize the display of menus, making the menu items and command help more reasonable. diff --git a/module/PSCompletions/PSCompletions.psd1 b/module/PSCompletions/PSCompletions.psd1 index 585ab80..f548ee6 100644 --- a/module/PSCompletions/PSCompletions.psd1 +++ b/module/PSCompletions/PSCompletions.psd1 @@ -9,7 +9,7 @@ @{ RootModule = 'PSCompletions.psm1' - ModuleVersion = '5.2.2' + ModuleVersion = '5.2.3' GUID = '00929632-527d-4dab-a5b3-21197faccd05' diff --git a/module/PSCompletions/core/init.ps1 b/module/PSCompletions/core/init.ps1 index 9329283..42ebd2e 100644 --- a/module/PSCompletions/core/init.ps1 +++ b/module/PSCompletions/core/init.ps1 @@ -1,7 +1,7 @@ using namespace System.Management.Automation $_ = Split-Path $PSScriptRoot -Parent New-Variable -Name PSCompletions -Value @{ - version = '5.2.2' + version = '5.2.3' path = @{ root = $_ completions = Join-Path $_ 'completions' @@ -1059,11 +1059,11 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod init_data { else { if ($PSCompletions.language -eq 'zh-CN') { $PSCompletions.url = 'https://gitee.com/abgox/PSCompletions/raw/main' - $PSCompletions.urls = @('https://gitee.com/abgox/PSCompletions/raw/main', 'https://raw.githubusercontent.com/abgox/PSCompletions/main') + $PSCompletions.urls = @('https://abgox.github.io/PSCompletions', 'https://gitee.com/abgox/PSCompletions/raw/main', 'https://github.com/abgox/PSCompletions/raw/main') } else { - $PSCompletions.url = 'https://raw.githubusercontent.com/abgox/PSCompletions/main' - $PSCompletions.urls = @('https://raw.githubusercontent.com/abgox/PSCompletions/main', 'https://gitee.com/abgox/PSCompletions/raw/main') + $PSCompletions.url = 'https://github.com/abgox/PSCompletions/raw/main' + $PSCompletions.urls = @('https://abgox.github.io/PSCompletions', 'https://github.com/abgox/PSCompletions/raw/main', 'https://gitee.com/abgox/PSCompletions/raw/main') } } @@ -1250,11 +1250,11 @@ if (!(Test-Path $PSCompletions.path.temp)) { } if ($PSUICulture -eq 'zh-CN') { $language = 'zh-CN' - $urls = @('https://gitee.com/abgox/PSCompletions/raw/main', 'https://raw.githubusercontent.com/abgox/PSCompletions/main') + $urls = @('https://gitee.com/abgox/PSCompletions/raw/main', 'https://github.com/abgox/PSCompletions/raw/main') } else { $language = 'en-US' - $urls = @('https://raw.githubusercontent.com/abgox/PSCompletions/main', 'https://gitee.com/abgox/PSCompletions/raw/main') + $urls = @('https://github.com/abgox/PSCompletions/raw/main', 'https://gitee.com/abgox/PSCompletions/raw/main') } $PSCompletions.ensure_dir("$($PSCompletions.path.completions)/psc") diff --git a/module/PSCompletions/core/utils/Core.ps1 b/module/PSCompletions/core/utils/Core.ps1 index 3f99af7..3e161e6 100644 --- a/module/PSCompletions/core/utils/Core.ps1 +++ b/module/PSCompletions/core/utils/Core.ps1 @@ -233,9 +233,10 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod start_job { } # check version + $urls = @('https://pscompletions.pages.dev/version.txt', 'https://abgox.github.io/PSCompletions/module/version.txt') + $PSCompletions.urls try { if ($PSCompletions.config.enable_module_update -eq 1) { - foreach ($url in $PSCompletions.urls) { + foreach ($url in $urls) { try { $response = Invoke-WebRequest -Uri "$url/module/version.txt" break @@ -244,11 +245,13 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod start_job { } $content = $response.Content.Trim() - $versions = @($PSCompletions.version, $content) | Sort-Object { [Version] $_ } - if ($versions[-1] -ne $PSCompletions.version) { - $data = get_raw_content $PSCompletions.path.data | ConvertFrom-Json -AsHashtable - $data.config.enable_module_update = $versions[-1] - $data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8 + if ($content -match "^[\d\.]+$") { + $versions = @($PSCompletions.version, $content) | Sort-Object { [Version] $_ } + if ($versions[-1] -ne $PSCompletions.version) { + $data = get_raw_content $PSCompletions.path.data | ConvertFrom-Json -AsHashtable + $data.config.enable_module_update = $versions[-1] + $data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8 + } } } } diff --git a/module/PSCompletions/core/utils/Desktop.ps1 b/module/PSCompletions/core/utils/Desktop.ps1 index b1d8d7a..3b66959 100644 --- a/module/PSCompletions/core/utils/Desktop.ps1 +++ b/module/PSCompletions/core/utils/Desktop.ps1 @@ -298,9 +298,10 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod start_job { } # check version + $urls = @('https://pscompletions.pages.dev/version.txt', 'https://abgox.github.io/PSCompletions/module/version.txt') + $PSCompletions.urls try { if ($PSCompletions.config.enable_module_update -eq 1) { - foreach ($url in $PSCompletions.urls) { + foreach ($url in $urls) { try { $response = Invoke-WebRequest -Uri "$url/module/version.txt" break @@ -309,11 +310,13 @@ Add-Member -InputObject $PSCompletions -MemberType ScriptMethod start_job { } $content = $response.Content.Trim() - $versions = @($PSCompletions.version, $content) | Sort-Object { [Version] $_ } - if ($versions[-1] -ne $PSCompletions.version) { - $data = get_raw_content $PSCompletions.path.data | ConvertFrom_JsonToHashtable - $data.config.enable_module_update = $versions[-1] - $data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8 + if ($content -match "^[\d\.]+$") { + $versions = @($PSCompletions.version, $content) | Sort-Object { [Version] $_ } + if ($versions[-1] -ne $PSCompletions.version) { + $data = get_raw_content $PSCompletions.path.data | ConvertFrom_JsonToHashtable + $data.config.enable_module_update = $versions[-1] + $data | ConvertTo-Json -Depth 100 -Compress | Out-File $PSCompletions.path.data -Force -Encoding utf8 + } } } } diff --git a/module/version.txt b/module/version.txt index ce7f2b4..c0baecb 100644 --- a/module/version.txt +++ b/module/version.txt @@ -1 +1 @@ -5.2.2 +5.2.3