Skip to content

Commit b222f41

Browse files
MacDuenico
authored andcommitted
Help: Replace file:// URLs with launch:// URLs
LibWeb already thinks it knows how to handle `file://` URLs, so does not call into the client to handle the URL scheme. Replacing these with `launch://` means LibWeb will call into `handle_custom_scheme`, which allows the Help app to process these requests.
1 parent b2153a9 commit b222f41

Some content is hidden

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

43 files changed

+48
-45
lines changed

Base/usr/share/man/man1/Applications/3DFileViewer.md

+1-1

Base/usr/share/man/man1/Applications/About.md

+1-1

Base/usr/share/man/man1/Applications/AnalogClock.md

+1-1

Base/usr/share/man/man1/Applications/Assistant.md

+2-2

Base/usr/share/man/man1/Applications/Browser.md

+1-1

Base/usr/share/man/man1/Applications/Calculator.md

+1-1

Base/usr/share/man/man1/Applications/Calendar.md

+1-1

Base/usr/share/man/man1/Applications/CatDog.md

+1-1

Base/usr/share/man/man1/Applications/CertificateSettings.md

+1-1

Base/usr/share/man/man1/Applications/CharacterMap.md

+1-1

Base/usr/share/man/man1/Applications/CrashReporter.md

+1-1

Base/usr/share/man/man1/Applications/Eyes.md

+1-1

Base/usr/share/man/man1/Applications/FontEditor.md

+1-1

Base/usr/share/man/man1/Applications/GMLPlayground.md

+1-1

Base/usr/share/man/man1/Applications/Help.md

+1-1

Base/usr/share/man/man1/Applications/HexEditor.md

+1-1

Base/usr/share/man/man1/Applications/ImageViewer.md

+1-1

Base/usr/share/man/man1/Applications/Magnifier.md

+1-1

Base/usr/share/man/man1/Applications/Mail.md

+1-1

Base/usr/share/man/man1/Applications/Maps.md

+1-1

Base/usr/share/man/man1/Applications/MouseSettings.md

+1-1

Base/usr/share/man/man1/Applications/PixelPaint.md

+1-1

Base/usr/share/man/man1/Applications/Presenter.md

+1-1

Base/usr/share/man/man1/Applications/Profiler.md

+1-1

Base/usr/share/man/man1/Applications/SQLStudio.md

+1-1

Base/usr/share/man/man1/Applications/Screenshot.md

+1-1

Base/usr/share/man/man1/Applications/Terminal.md

+1-1

Base/usr/share/man/man1/Applications/TextEditor.md

+1-1

Base/usr/share/man/man6/2048.md

+1-1

Base/usr/share/man/man6/BrickGame.md

+1-1

Base/usr/share/man/man6/Chess.md

+1-1

Base/usr/share/man/man6/ColorLines.md

+1-1

Base/usr/share/man/man6/FlappyBug.md

+1-1

Base/usr/share/man/man6/Flood.md

+1-1

Base/usr/share/man/man6/GameOfLife.md

+1-1

Base/usr/share/man/man6/Hearts.md

+1-1

Base/usr/share/man/man6/MasterWord.md

+1-1

Base/usr/share/man/man6/Minesweeper.md

+1-1

Base/usr/share/man/man6/Snake.md

+1-1

Base/usr/share/man/man6/Solitaire.md

+1-1

Base/usr/share/man/man6/Spider.md

+1-1

Userland/Applications/Help/MainWidget.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,11 @@ ErrorOr<void> MainWidget::initialize(GUI::Window& window)
118118

119119
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
120120
m_web_view->use_native_user_style_sheet();
121-
m_web_view->handle_custom_scheme = [this](auto& url) {
122-
if (url.scheme() == "file") {
121+
m_web_view->handle_custom_scheme = [this](auto& custom_url) {
122+
auto url = custom_url;
123+
if (url.scheme() == "launch") {
124+
// Treat "launch://" URLs as "file://" for use with Desktop::Launcher.
125+
url.set_scheme("file"_string);
123126
auto path = LexicalPath { URL::percent_decode(url.serialize_path()) };
124127
if (!path.is_child_of(Manual::manual_base_path)) {
125128
open_external(url);

Userland/Utilities/markdown-check.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
209209
m_file_links.append({ file, ByteString(), StringCollector::from(*link_node.text) });
210210
return RecursionDecision::Recurse;
211211
}
212-
if (url.scheme() == "file") {
212+
if (url.scheme() == "file" || url.scheme() == "launch") {
213213
auto file_path = URL::percent_decode(url.serialize_path());
214214
if (file_path.contains("man"sv) && file_path.ends_with(".md"sv)) {
215215
warnln("Inter-manpage link without the help:// scheme: {}\nPlease use help URLs of the form 'help://man/<section>/<subsection...>/<page>'", href);

0 commit comments

Comments
 (0)