From 1da53ef854d3021374ce0969a7b89e6a2811986d Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 27 Sep 2022 11:23:24 +0100 Subject: [PATCH] Welcome: Get LibWeb to parse Markdown documents for us --- Userland/Applications/Welcome/WelcomeWidget.cpp | 12 +----------- Userland/Applications/Welcome/main.cpp | 4 ++-- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index 0370a2c547..5e327e944a 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -17,9 +17,7 @@ #include #include #include -#include #include -#include WelcomeWidget::WelcomeWidget() { @@ -104,15 +102,7 @@ void WelcomeWidget::open_and_parse_tips_file() void WelcomeWidget::open_and_parse_readme_file() { - auto file = Core::File::construct("/home/anon/README.md"); - if (!file->open(Core::OpenMode::ReadOnly)) - return; - - auto document = Markdown::Document::parse(file->read_all()); - if (document) { - auto html = document->render_to_html(); - m_web_view->load_html(html, URL::create_with_file_protocol("/home/anon/README.md")); - } + m_web_view->load(URL::create_with_file_scheme("/home/anon/README.md")); } void WelcomeWidget::set_random_tip() diff --git a/Userland/Applications/Welcome/main.cpp b/Userland/Applications/Welcome/main.cpp index bea1583f51..8a34f344df 100644 --- a/Userland/Applications/Welcome/main.cpp +++ b/Userland/Applications/Welcome/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, the SerenityOS developers. + * Copyright (c) 2021-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -11,7 +11,6 @@ #include #include #include -#include ErrorOr serenity_main(Main::Arguments arguments) { @@ -22,6 +21,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil("/home", "r")); + TRY(Core::System::unveil("/tmp/user/%uid/portal/filesystemaccess", "rw")); TRY(Core::System::unveil("/tmp/user/%uid/portal/webcontent", "rw")); TRY(Core::System::unveil("/bin/Help", "x")); TRY(Core::System::unveil(nullptr, nullptr));