Skip to content

Commit d35d7ce

Browse files
authored
Merge branch 'dev' into refactor/profile
2 parents d39afc1 + c0e271b commit d35d7ce

81 files changed

Lines changed: 866 additions & 2218 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/23-feature.yml.disabled

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@ body:
1717
required: true
1818
- label: "我已知悉本项目的开发者均为不带薪志愿者,社区不对这类 Issue 的完成时间作出任何保证,并有足够的耐心等待社区开发者的处理,同时已知悉如果我作出催促、质问或类似的举动,这个 Issue 可能会被直接关闭"
1919
required: true
20-
- type: input
21-
id: "yml-2"
22-
attributes:
23-
label: "官方版原 Issue 编号"
24-
description: "如果这个 Issue 是从官方版转交过来的,请将原 Issue 标题旁的**编号**输入到下方预设文本的`#`后,不要输入任何其他非数字字符。**若不是,请清空下方输入框。**"
25-
value: "- Meloong-Git/PCL2#"
2620
- type: textarea
27-
id: "yml-3"
21+
id: "yml-2"
2822
attributes:
2923
label: 描述
3024
description: "详细描述你想添加的功能具体是怎样的。"
3125
validations:
3226
required: true
3327
- type: textarea
34-
id: "yml-4"
28+
id: "yml-3"
3529
attributes:
3630
label: 原因
3731
description: "详细描述你为什么需要这项功能,这有助于开发者评估它的优先度。"

.github/ISSUE_TEMPLATE/24-improve.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,15 @@ body:
2525
required: true
2626
- label: "我已知悉社区不对这类 Issue 的完成时间作出任何保证,并有足够的耐心等待社区开发者的处理,同时已知悉如果我作出催促、质问或类似的举动,这个 Issue 可能会被直接关闭"
2727
required: true
28-
- type: input
29-
id: "yml-2"
30-
attributes:
31-
label: "官方版原 Issue 编号"
32-
description: "如果这个 Issue 是从官方版转交过来的,请将原 Issue 标题旁的**编号**输入到下方预设文本的`#`后,不要输入任何其他非数字字符。**若不是,请清空下方输入框。**"
33-
value: "- Meloong-Git/PCL2#"
3428
- type: textarea
35-
id: "yml-3"
29+
id: "yml-2"
3630
attributes:
3731
label: 描述
3832
description: "详细描述具体需要优化哪些地方,要改成怎样的。"
3933
validations:
4034
required: true
4135
- type: textarea
42-
id: "yml-4"
36+
id: "yml-3"
4337
attributes:
4438
label: 原因
4539
description: "详细描述你为什么需要这项优化,这有助于开发者评估它的优先度。"

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ contact_links:
99
- name: 主页预设反馈
1010
url: https://github.com/Meloong-Git/PCL2/discussions/categories/自定义主页
1111
about: 提交与预设的主页(设置 → 个性化 → 主页预设)中的具体内容相关的反馈
12-
- name: 帮助文档反馈
13-
url: https://github.com/PCL-Community/PCL2CEHelp/issues
14-
about: 提交与 PCL CE 帮助文档(更多 → 帮助)中的具体内容相关的反馈
1512
- name: 提问 / 讨论
1613
url: https://github.com/PCL-Community/PCL2-CE/discussions/new
1714
about: 想问问或谈谈关于社区版的事情...

.github/workflows/release-beta_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
if: ${{ github.event.release.prerelease }}
3434
steps:
3535
- name: Checkout all
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@v6
3737
with:
3838
fetch-depth: 0
3939

.github/workflows/release-stable_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
if: ${{ !github.event.release.prerelease }}
3434
steps:
3535
- name: Checkout all
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@v6
3737
with:
3838
fetch-depth: 0
3939

.github/workflows/reusable-build.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222

2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v6
2626

2727
- name: Set Describe
2828
run: |
@@ -34,19 +34,6 @@ jobs:
3434
with:
3535
dotnet-version: 10.0.x
3636

37-
- name: Update Help
38-
continue-on-error: true
39-
run: |
40-
cd ..
41-
git clone https://github.com/PCL-Community/PCL2CEHelp.git -b master --single-branch --depth 1
42-
cd PCL2CEHelp
43-
rm -f ./* || true
44-
zip -r Help.zip . -x "./.*/*"
45-
cp -f Help.zip "${{ github.workspace }}/Plain Craft Launcher 2/Resources/Help.zip"
46-
cd ..
47-
rm -rf PCL2CEHelp
48-
cd "${{ github.workspace }}"
49-
5037
- name: Build Project
5138
env:
5239
PCL_WRITE_SECRET: '1'
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
using PCL.Core.ViewModel.Homepage;
3+
4+
namespace PCL.Core.Test;
5+
6+
[TestClass]
7+
public class HomepageNewsViewModelTest
8+
{
9+
[DataTestMethod]
10+
[DataRow("https://www.minecraft.net/zh-hans/article/example")]
11+
[DataRow("http://minecraft.net/news")]
12+
[DataRow("https://net-secondary.web.minecraft-services.net/api/v1.0/zh-cn/search")]
13+
[DataRow("https://learn.microsoft.com/gaming/")]
14+
public void IsSafeNewsLink_AllowsExpectedWebHosts(string url)
15+
{
16+
Assert.IsTrue(NewsViewModel.IsSafeNewsLink(url));
17+
}
18+
19+
[DataTestMethod]
20+
[DataRow(null)]
21+
[DataRow("")]
22+
[DataRow("calc.exe")]
23+
[DataRow("C:\\Windows\\System32\\calc.exe")]
24+
[DataRow("file:///C:/Windows/System32/calc.exe")]
25+
[DataRow("minecraft://open")]
26+
[DataRow("\\\\evil.example\\share\\payload.exe")]
27+
[DataRow("https://minecraft.net.evil.example/news")]
28+
[DataRow("https://evil.example/news")]
29+
public void IsSafeNewsLink_BlocksShellAndUnexpectedTargets(string? url)
30+
{
31+
Assert.IsFalse(NewsViewModel.IsSafeNewsLink(url));
32+
}
33+
}

PCL.Core/App/Basics.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using System.Diagnostics;
34
using System.IO;
45
using System.Reflection;
@@ -157,7 +158,19 @@ public static void OpenPath(string path, string? workingDirectory = null)
157158
UseShellExecute = true,
158159
CreateNoWindow = true
159160
};
160-
Process.Start(psi);
161+
try
162+
{
163+
Process.Start(psi);
164+
}
165+
catch (Win32Exception ex) when (ex.NativeErrorCode == 1155 && File.Exists(path))
166+
{
167+
Process.Start(new ProcessStartInfo
168+
{
169+
FileName = "notepad.exe",
170+
Arguments = $"\"{path}\"",
171+
UseShellExecute = false
172+
});
173+
}
161174
}
162175
#endregion
163176

PCL.Core/App/Config.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ partial class HideConfigGroup
451451

452452
// 子页面 工具
453453
[ConfigItem<bool>("UiHiddenToolsGameLink", false, ConfigSource.Local)] public partial bool ToolsGameLink { get; set; } // 新增
454-
[ConfigItem<bool>("UiHiddenToolsHelp", false, ConfigSource.Local)] public partial bool ToolsHelp { get; set; } // 新增
455454
[ConfigItem<bool>("UiHiddenToolsTest", false, ConfigSource.Local)] public partial bool ToolsTest { get; set; } // 新增
456455

457456
// 子页面 实例设置
@@ -492,11 +491,6 @@ partial class HideConfigGroup
492491
/// </summary>
493492
[ConfigItem<JvmPreferredIpStack>("LaunchPreferredIpStack", JvmPreferredIpStack.Default)] public partial JvmPreferredIpStack PreferredIpStack { get; set; }
494493

495-
/// <summary>
496-
/// 启动前优化内存。
497-
/// </summary>
498-
[ConfigItem<bool>("LaunchArgumentRam", false)] public partial bool OptimizeMemory { get; set; }
499-
500494
/// <summary>
501495
/// 附加 JVM 参数。
502496
/// </summary>

PCL.Core/App/Essentials/StartupService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ private static void _ParseCommandLineArgs()
116116
IEnumerable<SubcommandDefinition> subcommands = [
117117
("update", [("execute"), ("success"), ("failed")]),
118118
("activate", []),
119-
("memory", []),
120119
("promote", []),
121120
];
122121
Context.Debug("正在解析命令行参数...");

0 commit comments

Comments
 (0)