Merge branch 'main' into open_appflowy_or_download

This commit is contained in:
Zack Fu Zi Xiang 2024-05-04 16:34:16 +08:00
commit 210c0b8e18
No known key found for this signature in database
3 changed files with 13 additions and 24 deletions

View File

@ -389,7 +389,7 @@ async fn logout_handler(
state.session_store.del_user_session(session_id).await?; state.session_store.del_user_session(session_id).await?;
Ok(( Ok((
jar.remove(Cookie::from("session_id")), jar.remove(Cookie::from("session_id")),
htmx_redirect("/web/login"), htmx_redirect("/web"),
)) ))
} }

View File

@ -2,30 +2,16 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Open App or Redirect</title> <title>AppFlowy</title>
<script> <script>
function openApp() { window.onload = function () {
var appUrl = 'appflowy-flutter://'; window.location = 'appflowy-flutter://';
var fallbackUrl = 'https://appflowy.io/download'; // URL to download page };
var timeout = 2000; // 2 seconds
var timer = setTimeout(function () {
window.location = fallbackUrl;
}, timeout);
window.addEventListener('blur', function onWindowBlur() {
clearTimeout(timer); // Clear the timer if user focuses on the new tab/window (app opened)
window.removeEventListener('blur', onWindowBlur);
});
window.location = appUrl; // Try opening the app
}
window.onload = openApp; // Try to open the app right when the page loads
</script> </script>
</head> </head>
<body> <body>
<h1>Opening AppFlowy</h1> <h1>Opening AppFlowy</h1>
<p>If the app does not open, you will be redirected to the <a href="https://appflowy.io/download">download page</a>.</p> <p>If AppFlowy does not open, you can click <a href="appflowy-flutter://">here</a> to launch the app.</p>
<p>If AppFlowy is not installed, you can <a href="https://appflowy.io/download">download AppFlowy manually</a>.</p>
</body> </body>
</html> </html>

View File

@ -55,10 +55,13 @@ impl Mailer {
lettre::Address::new("notify", "appflowy.io")?, lettre::Address::new("notify", "appflowy.io")?,
)) ))
.to(lettre::message::Mailbox::new( .to(lettre::message::Mailbox::new(
Some(param.username), Some(param.username.clone()),
email.parse().unwrap(), email.parse().unwrap(),
)) ))
.subject("AppFlowy Workpace Invitation") .subject(format!(
"Action required: {} invited you to {} in AppFlowy",
param.username, param.workspace_name
))
.header(ContentType::TEXT_HTML) .header(ContentType::TEXT_HTML)
.body(rendered)?; .body(rendered)?;
@ -70,7 +73,7 @@ impl Mailer {
#[derive(serde::Serialize)] #[derive(serde::Serialize)]
pub struct WorkspaceInviteMailerParam { pub struct WorkspaceInviteMailerParam {
pub user_icon_url: String, pub user_icon_url: String,
pub username: String, pub username: String, // Inviter
pub workspace_name: String, pub workspace_name: String,
pub workspace_icon_url: String, pub workspace_icon_url: String,
pub workspace_member_count: String, pub workspace_member_count: String,