Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: redirect to default page (#6638)

Kilu.He6bbaad59a4ec
diff --git a/frontend/appflowy_web_app/deploy/nginx.conf b/frontend/appflowy_web_app/deploy/nginx.conf
index 2ae55fae7b..11a8744ad9 100644
--- a/frontend/appflowy_web_app/deploy/nginx.conf
+++ b/frontend/appflowy_web_app/deploy/nginx.conf
@@ -63,6 +63,12 @@ http {
access_log off;
}
+ location /appflowy.ico {
+ root /usr/share/nginx/html;
+ expires 30d;
+ access_log off;
+ }
+
location /og-image.png {
root /usr/share/nginx/html;
expires 30d;
diff --git a/frontend/appflowy_web_app/deploy/server.ts b/frontend/appflowy_web_app/deploy/server.ts
index 35d5e09570..db79e5c1fb 100644
--- a/frontend/appflowy_web_app/deploy/server.ts
+++ b/frontend/appflowy_web_app/deploy/server.ts
@@ -136,9 +136,9 @@ const createServer = async (req: Request) => {
const publishInfo = data?.data?.info;
if (publishInfo) {
- const newURL = `/${publishInfo.namespace}/${publishInfo.publish_name}`;
+ const newURL = `/${encodeURIComponent(publishInfo.namespace)}/${encodeURIComponent(publishInfo.publish_name)}`;
- logger.info('Redirecting to default page: ', newURL);
+ logger.info(`Redirecting to default page in: ${JSON.stringify(publishInfo)}`);
timer();
return new Response(null, {
status: 302,
@@ -159,7 +159,7 @@ const createServer = async (req: Request) => {
let title = 'AppFlowy';
const url = `https://${hostname}${reqUrl.pathname}`;
let image = '/og-image.png';
- let favicon = '/appflowy.svg';
+ let favicon = '/appflowy.ico';
try {
if (metaData && metaData.view) {
@@ -202,6 +202,7 @@ const createServer = async (req: Request) => {
$('title').text(title);
$('link[rel="icon"]').attr('href', favicon);
+ $('link[rel="canonical"]').attr('href', url);
setOrUpdateMetaTag($, 'meta[name="description"]', 'name', description);
setOrUpdateMetaTag($, 'meta[property="og:title"]', 'property', title);
setOrUpdateMetaTag($, 'meta[property="og:description"]', 'property', description);
diff --git a/frontend/appflowy_web_app/index.html b/frontend/appflowy_web_app/index.html
index 48fa2a1b2b..257f2a42c8 100644
--- a/frontend/appflowy_web_app/index.html
+++ b/frontend/appflowy_web_app/index.html
@@ -2,14 +2,32 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
- <link rel="icon" type="image/svg+xml" href="/appflowy.svg" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link
+ rel="icon"
+ type="image/svg+xml"
+ href="/appflowy.ico"
+ />
+ <link
+ rel="canonical"
+ href="https://appflowy.com"
+ />
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1.0"
+ >
<title>AppFlowy</title>
<meta
name="description"
content="AppFlowy is an AI collaborative workspace where you achieve more without losing control of your data"
/>
- <meta property="og:title" content="AppFlowy" />
+ <meta
+ property="og:title"
+ content="AppFlowy"
+ />
+ <meta
+ property="og:site_name"
+ content="AppFlowy"
+ >
<meta
property="og:description"
content="AppFlowy is an AI collaborative workspace where you achieve more without losing control of your data"
@@ -18,9 +36,18 @@
property="og:image"
content="/og-image.png"
/>
- <meta property="og:url" content="https://appflowy.com" />
- <meta name="twitter:card" content="summary_large_image" />
- <meta name="twitter:title" content="AppFlowy" />
+ <meta
+ property="og:url"
+ content="https://appflowy.com"
+ />
+ <meta
+ name="twitter:card"
+ content="summary_large_image"
+ />
+ <meta
+ name="twitter:title"
+ content="AppFlowy"
+ />
<meta
name="twitter:description"
content="AppFlowy is an AI collaborative workspace where you achieve more without losing control of your data"
@@ -29,13 +56,25 @@
name="twitter:image"
content="/og-image.png"
/>
- <meta name="twitter:site" content="@appflowy" />
- <meta name="twitter:creator" content="@appflowy" />
- <link href="https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap" rel="stylesheet">
+ <meta
+ name="twitter:site"
+ content="@appflowy"
+ />
+ <meta
+ name="twitter:creator"
+ content="@appflowy"
+ />
+ <link
+ href="https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&display=swap"
+ rel="stylesheet"
+ >
</head>
<body id="body">
<div id="root"></div>
-<script type="module" src="/src/main.tsx"></script>
+<script
+ type="module"
+ src="/src/main.tsx"
+></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
diff --git a/frontend/appflowy_web_app/public/appflowy.ico b/frontend/appflowy_web_app/public/appflowy.ico
new file mode 100644
index 0000000000..42570b2d50
Binary files /dev/null and b/frontend/appflowy_web_app/public/appflowy.ico differ
diff --git a/frontend/appflowy_web_app/src/components/editor/components/toolbar/selection-toolbar/utils.ts b/frontend/appflowy_web_app/src/components/editor/components/toolbar/selection-toolbar/utils.ts
index 4268a638fd..ed396a81bb 100644
--- a/frontend/appflowy_web_app/src/components/editor/components/toolbar/selection-toolbar/utils.ts
+++ b/frontend/appflowy_web_app/src/components/editor/components/toolbar/selection-toolbar/utils.ts
@@ -11,7 +11,11 @@ export function getRangeRect () {
const focusOffset = domSelection.focusOffset;
let domRange = rangeCount > 0 ? domSelection.getRangeAt(0) : undefined;
- if (focusNode && anchorNode && anchorNode.parentElement?.getBoundingClientRect().top !== focusNode.parentElement?.getBoundingClientRect().top) {
+ const anchorTop = anchorNode?.parentElement?.getBoundingClientRect().top;
+ const focusTop = focusNode?.parentElement?.getBoundingClientRect().top;
+ const diff = Math.abs((anchorTop || 0) - (focusTop || 0));
+
+ if (focusNode && anchorNode && diff > 20) {
const newRange = document.createRange();
newRange.setStart(focusNode, focusOffset);