Fix opml import form

This commit is contained in:
Tyler Hallada 2024-01-31 22:32:54 -05:00
parent 2e5ff1337c
commit 457aafbfe3
2 changed files with 5 additions and 12 deletions

View File

@ -33,7 +33,7 @@ pub async fn opml(
imports.insert(import_id.as_uuid(), receiver);
}
let import_stream = format!("connnect:/import/{}/stream swap:message", import_id);
let import_stream = format!("connect:/import/{}/stream swap:message", import_id);
return Ok((
StatusCode::CREATED,
html! {

View File

@ -3,9 +3,13 @@ use maud::{html, Markup, PreEscaped};
pub fn opml_import_form() -> Markup {
html! {
form
action="/import/opml"
method="post"
id="opml-import-form"
hx-post="/import/opml"
hx-encoding="multipart/form-data"
hx-target="#opml-import-form"
hx-swap="outerHTML"
class="flex flex-row gap-6 items-end justify-between"
{
div class="grow w-full" {
@ -22,16 +26,5 @@ pub fn opml_import_form() -> Markup {
button type="submit" class="py-2 px-4 font-medium rounded-md border border-gray-200" { "Import Feeds" }
}
}
progress id="opml-upload-progress" max="100" value="0" hidden="true" {}
script {
(PreEscaped(r#"
htmx.on('#opml-import-form', 'htmx:xhr:progress', function (evt) {
htmx.find('#opml-upload-progress').setAttribute(
'value',
evt.detail.loaded / evt.detail.total * 100,
);
});
"#))
}
}
}