mirror of
https://github.com/SerenityOS/serenity
synced 2026-04-25 17:15:42 +02:00
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.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
 3D File Viewer
|
||||
|
||||
[Open](file:///bin/3DFileViewer)
|
||||
[Open](launch:///bin/3DFileViewer)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 About - About SerenityOS
|
||||
|
||||
[Open](file:///bin/About)
|
||||
[Open](launch:///bin/About)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Analog Clock
|
||||
|
||||
[Open](file:///bin/AnalogClock)
|
||||
[Open](launch:///bin/AnalogClock)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Assistant - Serenity Assistant
|
||||
|
||||
[Open](file:///bin/Assistant)
|
||||
[Open](launch:///bin/Assistant)
|
||||
|
||||
## Synopsis
|
||||
|
||||
@@ -18,5 +18,5 @@ $ Assistant
|
||||
|
||||
- Enter a URL to open it in [Browser](help://man/1/Applications/Browser), e.g. `serenityos.org`.
|
||||
- Perform quick calculations by typing the equal sign (=) followed by a mathematical expression, e.g. `=22*101`. Press `Return` to copy the result.
|
||||
- Run commands in [Terminal](help://man/1/Applications/Terminal) by prefixing them with a dollar sign ($), e.g. `$ uname -a`.
|
||||
- Run commands in [Terminal](help://man/1/Applications/Terminal) by prefixing them with a dollar sign (\$), e.g. `$ uname -a`.
|
||||
- Launch applications with arguments, e.g. launch [Pixel Paint](help://man/1/Applications/PixelPaint) with a file: `pp image.png`.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Browser - Serenity WWW Browser
|
||||
|
||||
[Open](file:///bin/Browser)
|
||||
[Open](launch:///bin/Browser)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Calculator - Serenity calculator
|
||||
|
||||
[Open](file:///bin/Calculator)
|
||||
[Open](launch:///bin/Calculator)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Calendar - Serenity calendar
|
||||
|
||||
[Open](file:///bin/Calendar)
|
||||
[Open](launch:///bin/Calendar)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 CatDog - A helpful companion
|
||||
|
||||
[Open](file:///bin/CatDog)
|
||||
[Open](launch:///bin/CatDog)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Certificate Settings
|
||||
|
||||
[Open](file:///bin/CertificateSettings)
|
||||
[Open](launch:///bin/CertificateSettings)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Character Map - Unicode character viewer
|
||||
|
||||
[Open](file:///bin/CharacterMap)
|
||||
[Open](launch:///bin/CharacterMap)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 CrashReporter - information about crashed programs
|
||||
|
||||
[Open](file:///bin/CrashReporter)
|
||||
[Open](launch:///bin/CrashReporter)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Eyes - follow the mouse LibGUI demo
|
||||
|
||||
[Open](file:///bin/Eyes)
|
||||
[Open](launch:///bin/Eyes)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 FontEditor - Serenity font editor
|
||||
|
||||
[Open](file:///bin/FontEditor)
|
||||
[Open](launch:///bin/FontEditor)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 GML Playground - GUI Markup Language (GML) editor
|
||||
|
||||
[Open](file:///bin/GMLPlayground)
|
||||
[Open](launch:///bin/GMLPlayground)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Help - digital manual
|
||||
|
||||
[Open](file:///bin/Help)
|
||||
[Open](launch:///bin/Help)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Hex Editor - Binary file editor
|
||||
|
||||
[Open](file:///bin/HexEditor)
|
||||
[Open](launch:///bin/HexEditor)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Image Viewer - SerenityOS image viewer
|
||||
|
||||
[Open](file:///bin/ImageViewer)
|
||||
[Open](launch:///bin/ImageViewer)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Magnifier - Magnifier application
|
||||
|
||||
[Open](file:///bin/Magnifier)
|
||||
[Open](launch:///bin/Magnifier)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Mail - Serenity e-mail client
|
||||
|
||||
[Open](file:///bin/Mail)
|
||||
[Open](launch:///bin/Mail)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Maps
|
||||
|
||||
[Open](file:///bin/Maps)
|
||||
[Open](launch:///bin/Maps)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Mouse Settings - Mouse settings application
|
||||
|
||||
[Open](file:///bin/MouseSettings)
|
||||
[Open](launch:///bin/MouseSettings)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Pixel Paint - Image Editor
|
||||
|
||||
[Open](file:///bin/PixelPaint)
|
||||
[Open](launch:///bin/PixelPaint)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Presenter - Present slides to an audience
|
||||
|
||||
[Open](file:///bin/Presenter)
|
||||
[Open](launch:///bin/Presenter)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Profiler - Serenity process profiler
|
||||
|
||||
[Open](file:///bin/Profiler)
|
||||
[Open](launch:///bin/Profiler)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 SQL Studio - SerenityOS SQL Manager
|
||||
|
||||
[Open](file:///bin/SQLStudio)
|
||||
[Open](launch:///bin/SQLStudio)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Screenshot
|
||||
|
||||
[Open](file:///bin/Screenshot)
|
||||
[Open](launch:///bin/Screenshot)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Terminal - Serenity terminal emulator
|
||||
|
||||
[Open](file:///bin/Terminal)
|
||||
[Open](launch:///bin/Terminal)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 TextEditor - SerenityOS text editor
|
||||
|
||||
[Open](file:///bin/TextEditor)
|
||||
[Open](launch:///bin/TextEditor)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 2048
|
||||
|
||||
[Open](file:///bin/2048)
|
||||
[Open](launch:///bin/2048)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 BrickGame
|
||||
|
||||
[Open](file:///bin/BrickGame)
|
||||
[Open](launch:///bin/BrickGame)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Chess
|
||||
|
||||
[Open](file:///bin/Chess)
|
||||
[Open](launch:///bin/Chess)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Color Lines
|
||||
|
||||
[Open](file:///bin/ColorLines)
|
||||
[Open](launch:///bin/ColorLines)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Flappy Bug
|
||||
|
||||
[Open](file:///bin/FlappyBug)
|
||||
[Open](launch:///bin/FlappyBug)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Flood
|
||||
|
||||
[Open](file:///bin/Flood)
|
||||
[Open](launch:///bin/Flood)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 GameOfLife
|
||||
|
||||
[Open](file:///bin/GameOfLife)
|
||||
[Open](launch:///bin/GameOfLife)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Hearts - The Hearts card game
|
||||
|
||||
[Open](file:///bin/Hearts)
|
||||
[Open](launch:///bin/Hearts)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 MasterWord
|
||||
|
||||
[Open](file:///bin/MasterWord)
|
||||
[Open](launch:///bin/MasterWord)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Minesweeper
|
||||
|
||||
[Open](file:///bin/Minesweeper)
|
||||
[Open](launch:///bin/Minesweeper)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Snake
|
||||
|
||||
[Open](file:///bin/Snake)
|
||||
[Open](launch:///bin/Snake)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Solitaire - The Solitaire card game
|
||||
|
||||
[Open](file:///bin/Solitaire)
|
||||
[Open](launch:///bin/Solitaire)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
 Spider - The Spider card game
|
||||
|
||||
[Open](file:///bin/Spider)
|
||||
[Open](launch:///bin/Spider)
|
||||
|
||||
## Synopsis
|
||||
|
||||
|
||||
@@ -118,8 +118,11 @@ ErrorOr<void> MainWidget::initialize(GUI::Window& window)
|
||||
|
||||
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
|
||||
m_web_view->use_native_user_style_sheet();
|
||||
m_web_view->handle_custom_scheme = [this](auto& url) {
|
||||
if (url.scheme() == "file") {
|
||||
m_web_view->handle_custom_scheme = [this](auto& custom_url) {
|
||||
auto url = custom_url;
|
||||
if (url.scheme() == "launch") {
|
||||
// Treat "launch://" URLs as "file://" for use with Desktop::Launcher.
|
||||
url.set_scheme("file"_string);
|
||||
auto path = LexicalPath { URL::percent_decode(url.serialize_path()) };
|
||||
if (!path.is_child_of(Manual::manual_base_path)) {
|
||||
open_external(url);
|
||||
|
||||
@@ -209,7 +209,7 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
|
||||
m_file_links.append({ file, ByteString(), StringCollector::from(*link_node.text) });
|
||||
return RecursionDecision::Recurse;
|
||||
}
|
||||
if (url.scheme() == "file") {
|
||||
if (url.scheme() == "file" || url.scheme() == "launch") {
|
||||
auto file_path = URL::percent_decode(url.serialize_path());
|
||||
if (file_path.contains("man"sv) && file_path.ends_with(".md"sv)) {
|
||||
warnln("Inter-manpage link without the help:// scheme: {}\nPlease use help URLs of the form 'help://man/<section>/<subsection...>/<page>'", href);
|
||||
|
||||
Reference in New Issue
Block a user