-
Notifications
You must be signed in to change notification settings - Fork 17
Linux 原生支持(Photino + 跨平台音视频/CLI/打包) #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2028cc3
145a1be
51a1427
dc40923
df78aaa
d4374ca
cc00ec0
e40dbc5
80d40d4
ef12896
061db08
446fa31
d31d2bd
4f0e46b
00dd114
9bb69de
0ebc92f
09a685a
4989992
1032e66
c385e40
3f72f50
26530b1
3969f59
b343aaa
3c594af
b9d872d
2abe59a
fb33bd7
2a32f30
4d250b8
aabcd62
124ae0c
546f23a
f1227e2
a1a63ed
f541c93
92ecb39
d01ba81
b64b248
f8c6aed
631999c
4b11ade
4ec006a
f68ebc1
f7a8d6e
43977d3
16f9f82
2efba1d
7b00474
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| <Project> | ||
| <PropertyGroup Condition="'$(MSBuildProjectName)' == 'MuConvert'"> | ||
| <!-- 仅在 Windows 上构建时,让随 MaiChartManager 一起发布的 MuConvert 为自包含 win-x64, | ||
| 使打包进 Windows 版的 MuConvert.exe 可独立运行(不依赖单独的 dotnet 运行时)。 | ||
| Linux 原生构建则不强制,MuConvert 随主项目按 linux-x64 框架依赖构建。 | ||
| (原先无条件强制 win-x64 是为了在 Linux 上用 Wine 测 Windows 版,已不需要。) --> | ||
| <PropertyGroup Condition="'$(MSBuildProjectName)' == 'MuConvert' and $([MSBuild]::IsOSPlatform('Windows'))"> | ||
| <RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
| <SelfContained>true</SelfContained> | ||
| </PropertyGroup> | ||
| <PropertyGroup> | ||
| <EnableWindowsTargeting>true</EnableWindowsTargeting> | ||
| </PropertyGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| using Windows.Services.Store; | ||
| #if WINDOWS | ||
| using Windows.Services.Store; | ||
| #endif | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace MaiChartManager.Controllers.App; | ||
|
|
@@ -7,6 +9,7 @@ namespace MaiChartManager.Controllers.App; | |
| [Route("MaiChartManagerServlet/[action]Api")] | ||
| public class AppLicenseController : Controller | ||
| { | ||
| #if WINDOWS | ||
| public record RequestPurchaseResult(string? ErrorMessage, StorePurchaseStatus Status); | ||
|
|
||
| [HttpPost] | ||
|
|
@@ -32,4 +35,22 @@ public async Task<bool> VerifyOfflineKey([FromBody] string key) | |
| IapManager.SetOfflineLicenseActive(); | ||
| return true; | ||
| } | ||
| } | ||
| #else | ||
| // Linux:始终已授权——不支持商店 / IAP | ||
| public record RequestPurchaseResult(string? ErrorMessage, int Status); | ||
|
|
||
| [HttpPost] | ||
| public Task<RequestPurchaseResult> RequestPurchase() | ||
| { | ||
| // StorePurchaseStatus.Succeeded = 0 | ||
| return Task.FromResult(new RequestPurchaseResult(null, 0)); | ||
| } | ||
|
|
||
| [HttpPost] | ||
| public Task<bool> VerifyOfflineKey([FromBody] string key) | ||
| { | ||
| // Linux 不做离线密钥验证;始终视为已授权 | ||
| return Task.FromResult(true); | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Prompt for AI agents |
||
| #endif | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ namespace MaiChartManager.Controllers.App; | |
|
|
||
| [ApiController] | ||
| [Route("MaiChartManagerServlet/[action]Api")] | ||
| public class LocaleController(StaticSettings settings, ILogger<LocaleController> logger) : ControllerBase | ||
| public class LocaleController(StaticSettings settings, ILogger<LocaleController> logger, MaiChartManager.Platform.IAppShell appShell) : ControllerBase | ||
| { | ||
| [HttpGet] | ||
| public string GetCurrentLocale() | ||
|
|
@@ -17,6 +17,31 @@ public string GetCurrentLocale() | |
| [HttpPost] | ||
| public void SetLocale([FromBody] string locale) | ||
| { | ||
| AppMain.SetLocale(locale); | ||
| if (locale != "zh" && locale != "zh-TW" && locale != "en") | ||
| { | ||
| throw new ArgumentException("Invalid locale. Must be 'zh', 'zh-TW', or 'en'"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Invalid locale input is handled by throwing an exception, producing error-path responses instead of a client validation response. Return Prompt for AI agents |
||
| } | ||
|
|
||
| StaticSettings.CurrentLocale = locale; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Locale application logic is duplicated across controller/startup paths, increasing drift risk when locale rules change. Centralize this block in one shared method/service and call it here. Prompt for AI agents |
||
| StaticSettings.Config.Locale = locale; | ||
|
|
||
| // 设置 Locale 资源管理器的 Culture(这会影响所有线程) | ||
| var culture = locale switch | ||
| { | ||
| "zh" => new CultureInfo("zh-CN"), | ||
| "zh-TW" => new CultureInfo("zh-TW"), | ||
| _ => new CultureInfo("en-US"), | ||
| }; | ||
| Locale.Culture = culture; | ||
| CultureInfo.CurrentCulture = culture; | ||
| CultureInfo.CurrentUICulture = culture; | ||
|
|
||
| // 给外部依赖库设置Locale | ||
| MuConvert.utils.Utils.SetLocale(new CultureInfo(locale)); | ||
|
|
||
| StaticSettings.Config.Save(); | ||
|
|
||
| // 刷新原生 UI(Windows: 窗口/托盘;Linux: no-op) | ||
| appShell.ReloadLocale(locale); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Linux purchase response changes
statusto numeric, breaking existing string-enum API contract.Prompt for AI agents