Skip to content

Commit

Permalink
fix(module): update version to 5.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
abgox committed Dec 18, 2024
1 parent 1f3ea13 commit 37a7d0c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 20 deletions.
10 changes: 10 additions & 0 deletions module/CHANGELOG-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
<a href="./CHANGELOG-CN.md">简体中文</a>
</p>

## 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)

- 优化菜单的显示,让菜单项和命令帮助的显示更合理。
Expand Down
24 changes: 24 additions & 0 deletions module/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
9 changes: 9 additions & 0 deletions module/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
<a href="./CHANGELOG.md">English</a>
</p>

## 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.
Expand Down
2 changes: 1 addition & 1 deletion module/PSCompletions/PSCompletions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{
RootModule = 'PSCompletions.psm1'

ModuleVersion = '5.2.2'
ModuleVersion = '5.2.3'

GUID = '00929632-527d-4dab-a5b3-21197faccd05'

Expand Down
12 changes: 6 additions & 6 deletions module/PSCompletions/core/init.ps1
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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')
}
}

Expand Down Expand Up @@ -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")
Expand Down
15 changes: 9 additions & 6 deletions module/PSCompletions/core/utils/Core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions module/PSCompletions/core/utils/Desktop.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion module/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.2
5.2.3

0 comments on commit 37a7d0c

Please sign in to comment.