From e1107f9b80a1c32ad38b60e14c2eafdaa33edc3f Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sat, 23 Mar 2024 00:04:52 -0700 Subject: fix(web): ignore style tag --- src/modules/web.rs | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) (limited to 'src/modules') diff --git a/src/modules/web.rs b/src/modules/web.rs index 02354cd..2a0bce6 100644 --- a/src/modules/web.rs +++ b/src/modules/web.rs @@ -15,9 +15,10 @@ // Copyright (C) 2022-2023 Fuwn // SPDX-License-Identifier: GPL-3.0-only -use windmark::response::Response; - -use crate::{response::success, route::track_mount}; +use { + crate::{response::success, route::track_mount}, + windmark::response::Response, +}; fn error(message: &str, context: &windmark::context::RouteContext) -> Response { success( @@ -29,23 +30,18 @@ fn error(message: &str, context: &windmark::context::RouteContext) -> Response { } pub fn module(router: &mut windmark::router::Router) { - track_mount( - router, - "/web", - "World Wide Web to Gemini Gateway", - |context| { - success( - &r"# World Wide Web to Gemini Gateway + track_mount(router, "/web", "World Wide Web to Gemini Gateway", |context| { + success( + &r"# World Wide Web to Gemini Gateway To use this gateway, simply append the address of your target resource to the end of the current route, minus the protocol. To visit the web version of this exact page, , you would visit . => /web/fuwn.me/web Try it!", - &context, - ) - }, - ); + &context, + ) + }); track_mount( router, "/web/*url", @@ -57,16 +53,10 @@ To visit the web version of this exact page, , you would vi if let Some(url_choice) = context.parameters.get("url") { url_choice } else { - return error( - "Looks like you didn't provide a URL!", - &context, - ); + return error("Looks like you didn't provide a URL!", &context); } )) else { - return error( - "The URL you provided is invalid.", - &context, - ); + return error("The URL you provided is invalid.", &context); }; let mut contents = vec![]; let website = if let Ok(website) = reqwest::get(url.clone()).await { @@ -149,8 +139,8 @@ To visit the web version of this exact page, , you would vi "li" => { contents.push(format!("* {}\n", tag.inner_text(parser))); } - "html" | "head" | "script" | "link" | "title" | "body" | "ul" => { - } + "html" | "head" | "script" | "link" | "title" | "body" | "ul" + | "style" => {} _ => { text = tag.inner_text(parser).to_string(); -- cgit v1.2.3