-
Notifications
You must be signed in to change notification settings - Fork 19
修复若干问题,主要是Linux适配引起的回归问题 #70
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
Open
Starrah
wants to merge
7
commits into
MuNET-OSS:main
Choose a base branch
from
Starrah:fix-import-track
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b6a668b
fix: remove MaiLib & SimaiSharp again
Starrah b1a4241
fix: 4d250b86 中将XV2CoreLib替换为AcbCore,但slnx中未做相同更改,导致项目无法from-scratch地编译。
Starrah 2a1ec58
fix: Windows下,开启远程模式模式但从本机访问(如本地debug开发等情况),也会被误判为isPhotino。
Starrah 0b44584
fix: fe4e433 中的修改使得isAbortError的条件判断过于严苛,导致正常的用户关闭窗口等(ImportChartButt…
Starrah 50f436b
fix: 4d250b86 中,把Windows下的MP3兼容模式也给扬了。现在把它加回来,MP3兼容模式仅在Windows下可用。
Starrah 3503ed1
chore: 小小地优化翻译
Starrah 9a06717
fix: 对wav格式的文件也会调用ffmpeg转换。
Starrah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule MaiLib
deleted from
c76e94
Submodule SimaiSharp
deleted from
bcaf93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
诶,那这样的话,export+应用内打开是不是会炸
(至少 Windows 是有 export+应用内打开的操作的,我不记得 Linux 做没做了)
Uh oh!
There was an error while loading. Please reload this page.
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.
首先,原本的代码
return Forbid();是 26530b1 中引入的,并不是我写的;我推测这么做的目的可能是,远程情况下浏览器和后端不运行在一台机器上,很多情况下后端是游戏专机之类的、可能连完整的鼠标键盘都没,因此从后端的机器调用本机的文件选择API、弹出文件选择窗口,前端那边也是看不到,没有意义的。但实际上,在(修改后的)正常的逻辑之下,理论上Export模式应该一定调用的是浏览器侧的文件选择API(因为isPhotino必定工作在非export模式下?见下面讨论),所以这个代码其实只是个Guard;MaiChartManager/MaiChartManager/Front/src/utils/pickDirectory.ts
Lines 23 to 51 in 2a32f30
其次,我这里的修改只是把

return Forbid();改成了return StatusCode(StatusCodes.Status403Forbidden);,因为测试发现,return Forbid();由于一些配置上的原因,无法返回403,而是抛异常导致500。(AI分析如下图)最后,直接回答您的”export+应用内打开是不是会炸“的问题。分两个方面:
pickDirectory.ts中的注释,之所以不这么做是因为WebKitGTK 即使暴露了 window.showDirectoryPicker,其实现也有问题(调用后访问 handle 会抛 "The string did not match the expected pattern"),所以只好退而求其次用后端文件选择作为workaround。所以,问题的关键就是isPhotino是不是保证一定非export模式。 如果是的话则没问题;不然的话,则这里确实是个问题(但也是从 26530b1 就引入了的)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.
好的 我觉得我应该检查一下,就不让 Linux 在 export 模式下再在应用内打开好了
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.
好呀,我觉得可以,因为「选择」这个行为本身也一定是在本机上完成的,因为弹窗只能在本机上弹出来
不过我是希望,如果不是 localhost 的访问,或者不是 photino 而是本机 chromium 之类的,还是用像原先一样的浏览器端直接选择文件夹,而不需要走这个绕一圈(
Uh oh!
There was an error while loading. Please reload this page.
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.
讲一点我的观察,供您参考:
PickImportFolderAPI一定是前端通过pickViaBackend触发的。阅读相关代码容易知道,它一定是在localhost访问的情况下才会触发的(isPhotino内也隐含了isLocalhost的判断的),所以正常情况下并不可能出现“用户在其他机器上远程访问,却在后端机器上弹出了个对话框”的情况。MaiChartManager/MaiChartManager/Front/src/utils/pickDirectory.ts
Lines 23 to 51 in 2a32f30
MaiChartManager/MaiChartManager/Controllers/AssetDir/ImportBrowseController.cs
Lines 6 to 16 in 2a1ec58
PickImportFolder这种只是弹对话框、本身无害的,但也有ListImportDir和ReadImportFile这种可以实现任意文件读取的。 确实可能有明显的安全风险。综上以上大概是我对情况的分析和总结,具体怎么改看您
Uh oh!
There was an error while loading. Please reload this page.
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.
呜呜我一开始分析和判断的有问题,我删了重发了,您以我后面发的为准
就,弹窗本身确实没有什么危害,但麻烦的点在于这套文件操作API里还提供了
ListImportDir和ReadImportFile这种可以实现任意文件读取的大雷。Uh oh!
There was an error while loading. Please reload this page.
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.
对啊,现在就已经是这样的了,只有
isPhotino才pickViaBackend,否则还是前端文件选择MaiChartManager/MaiChartManager/Front/src/utils/pickDirectory.ts
Lines 30 to 51 in 2a32f30
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.
说真的,我最早的 Linux 想法就是纯后端,然后拉起
{google-chrome,chromium,microsoft-edge} --app=http://localhost。其实这样似乎是体验更好的,因为现在 webkit-git 甚至还有一些显示 bug,而 --app 的话,甚至不会有浏览器自带的 chrome(指地址栏、工具栏这些,不是谷歌浏览器)就和 Windows 上体验差不多。但是我觉得可能不是所有人电脑上都有 chromium 系浏览器,而且后来调查发现了 Photino 这个东西,但是我也不知道 webkit-gtk 有这么多不兼容的东西,我就拿这个做了,后来才发现一堆不兼容的坑然后开始填
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.
所以变动性比较小的改动是不是,本地模式还是photino不变,远程模式的话直接xdg-open一个http://,这样应该会调用系统默认浏览器。尽管不是所有人电脑上都有 chromium 系浏览器,但应该所有人电脑上都至少有个浏览器吧,而且大概率会是个支持
window.showDirectoryPicker的浏览器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.
似乎,支持这个的浏览器也就是 chromium 系的浏览器了
不过不支持的他们也有办法自行解决吧,毕竟用 Linux 了应该默认是有能力的了