From ceb92a4bfc62b9bb4ffbed9ecc422120428ab45b Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 9 Dec 2023 09:35:39 +0800
Subject: [PATCH 1/8] Fix media widening applied to status cards
---
src/components/status.css | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/components/status.css b/src/components/status.css
index 88d884b1a..f2a88ee60 100644
--- a/src/components/status.css
+++ b/src/components/status.css
@@ -712,8 +712,19 @@
/* height: 200px; */
max-height: max(200px, 40vh);
}
-.status.medium .content ~ * .media-container:is(.media-eq2, .media-gt2),
-.status.medium .content ~ .media-container:is(.media-eq2, .media-gt2) {
+.status.medium
+ .content
+ ~ *
+ .media-container:not(.status-card .media-container):is(
+ .media-eq2,
+ .media-gt2
+ ),
+.status.medium
+ .content
+ ~ .media-container:not(.status-card .media-container):is(
+ .media-eq2,
+ .media-gt2
+ ) {
/* 50px = avatar size */
margin-left: calc(-1 * ((50px / 2)));
/*
From a039f84c9d1881d45c4f8a549c80184f04f35bc7 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sat, 9 Dec 2023 15:04:21 +0800
Subject: [PATCH 2/8] Don't 100% the select
Suppose to be max-width but not working for select(s)
---
src/pages/settings.css | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/pages/settings.css b/src/pages/settings.css
index 9a4e6dd50..1c1481d57 100644
--- a/src/pages/settings.css
+++ b/src/pages/settings.css
@@ -66,7 +66,6 @@
#settings-container section select {
padding: 4px;
- width: 100%;
}
#settings-container .radio-group {
From 7dd0b0a4fb18d72561cc37b9f112de4c8f1e73d9 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sun, 10 Dec 2023 19:13:11 +0800
Subject: [PATCH 3/8] Fix for smaller images
---
src/components/status.css | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/components/status.css b/src/components/status.css
index f2a88ee60..70355af40 100644
--- a/src/components/status.css
+++ b/src/components/status.css
@@ -688,6 +688,13 @@
margin-inline: -16px;
max-width: calc(100% + 16px + 16px) !important;
+ figure:before {
+ content: '';
+ display: block;
+ /* padding (16px) - gap (4px) */
+ flex-basis: calc(16px - 4px);
+ }
+
figure figcaption {
padding-inline: 16px !important;
}
From 433d8b3bcc15d58d9c78127c239fb98fefadab59 Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Sun, 10 Dec 2023 19:16:34 +0800
Subject: [PATCH 4/8] Adjustments to welcome and login pages
---
src/index.css | 9 ++++
src/pages/login.css | 2 +-
src/pages/login.jsx | 77 ++++++++++++++++++++++++----------
src/pages/welcome.css | 87 +++++++++++++++-----------------------
src/pages/welcome.jsx | 98 ++++++++++++++++++++++---------------------
5 files changed, 148 insertions(+), 125 deletions(-)
diff --git a/src/index.css b/src/index.css
index b6cdb5cdf..8fcbe4973 100644
--- a/src/index.css
+++ b/src/index.css
@@ -242,6 +242,15 @@ button,
:is(button, .button).plain4:not(:disabled, .disabled):is(:hover, :focus) {
color: var(--text-color);
}
+:is(button, .button).plain5 {
+ background-color: transparent;
+ color: var(--link-color);
+ text-decoration: underline;
+ text-decoration-color: var(--link-faded-color);
+}
+:is(button, .button).plain5:not(:disabled, .disabled):is(:hover, :focus) {
+ text-decoration: underline;
+}
:is(button, .button).light {
background-color: var(--bg-faded-color);
color: var(--text-color);
diff --git a/src/pages/login.css b/src/pages/login.css
index 16873c3b7..d142f67a7 100644
--- a/src/pages/login.css
+++ b/src/pages/login.css
@@ -30,7 +30,7 @@
#instances-suggestions {
margin: 0.2em 0 0;
- padding: 0;
+ padding: 0 0 0 1.2em;
list-style: none;
width: 90vw;
max-width: 40em;
diff --git a/src/pages/login.jsx b/src/pages/login.jsx
index ce5ec8c07..307fb1129 100644
--- a/src/pages/login.jsx
+++ b/src/pages/login.jsx
@@ -3,6 +3,8 @@ import './login.css';
import { useEffect, useRef, useState } from 'preact/hooks';
import { useSearchParams } from 'react-router-dom';
+import logo from '../assets/logo.svg';
+
import Link from '../components/link';
import Loader from '../components/loader';
import instancesListURL from '../data/instances.json?url';
@@ -42,6 +44,7 @@ function Login() {
// }, []);
const submitInstance = (instanceURL) => {
+ if (!instanceURL) return;
store.local.set('instanceURL', instanceURL);
(async () => {
@@ -72,23 +75,18 @@ function Login() {
})();
};
- const onSubmit = (e) => {
- e.preventDefault();
- const { elements } = e.target;
- let instanceURL = elements.instanceURL.value.toLowerCase();
- // Remove protocol from instance URL
- instanceURL = instanceURL.replace(/^https?:\/\//, '').replace(/\/+$/, '');
- // Remove @acct@ or acct@ from instance URL
- instanceURL = instanceURL.replace(/^@?[^@]+@/, '');
- if (!/\./.test(instanceURL)) {
- instanceURL = instancesList.find((instance) =>
- instance.includes(instanceURL),
- );
- }
- submitInstance(instanceURL);
- };
+ const cleanInstanceText = instanceText
+ ? instanceText
+ .replace(/^https?:\/\//, '') // Remove protocol from instance URL
+ .replace(/\/+$/, '') // Remove trailing slash
+ .replace(/^@?[^@]+@/, '') // Remove @?acct@
+ .trim()
+ : null;
+ const instanceTextLooksLikeDomain =
+ /[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(cleanInstanceText) &&
+ !/[\s\/\\@]/.test(cleanInstanceText);
- const instancesSuggestions = instanceText
+ const instancesSuggestions = cleanInstanceText
? instancesList
.filter((instance) => instance.includes(instanceText))
.sort((a, b) => {
@@ -106,10 +104,39 @@ function Login() {
.slice(0, 10)
: [];
+ const selectedInstanceText = instanceTextLooksLikeDomain
+ ? cleanInstanceText
+ : instancesSuggestions?.length
+ ? instancesSuggestions[0]
+ : instanceText
+ ? instancesList.find((instance) => instance.includes(instanceText))
+ : null;
+
+ const onSubmit = (e) => {
+ e.preventDefault();
+ // const { elements } = e.target;
+ // let instanceURL = elements.instanceURL.value.toLowerCase();
+ // // Remove protocol from instance URL
+ // instanceURL = instanceURL.replace(/^https?:\/\//, '').replace(/\/+$/, '');
+ // // Remove @acct@ or acct@ from instance URL
+ // instanceURL = instanceURL.replace(/^@?[^@]+@/, '');
+ // if (!/\./.test(instanceURL)) {
+ // instanceURL = instancesList.find((instance) =>
+ // instance.includes(instanceURL),
+ // );
+ // }
+ // submitInstance(instanceURL);
+ submitInstance(selectedInstanceText);
+ };
+
return (
)}
-
diff --git a/src/pages/welcome.css b/src/pages/welcome.css
index 7c3917442..d65f73b0e 100644
--- a/src/pages/welcome.css
+++ b/src/pages/welcome.css
@@ -1,15 +1,3 @@
-@keyframes shine2 {
- 0% {
- left: -100%;
- }
- 20% {
- left: 100%;
- }
- 100% {
- left: 100%;
- }
-}
-
#welcome {
text-align: center;
background-image: radial-gradient(
@@ -35,45 +23,23 @@
flex-direction: column;
}
+ .hero-content {
+ flex-grow: 1;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ }
+
h1 {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
margin: 0;
padding: 0;
font-size: 5em;
line-height: 1;
letter-spacing: -1px;
- flex-grow: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
position: relative;
- mix-blend-mode: multiply;
-
- @media (prefers-color-scheme: dark) {
- mix-blend-mode: normal;
- }
-
- &:before {
- content: '';
- position: absolute;
- z-index: 2;
- width: 100%;
- height: 100%;
- background-image: linear-gradient(
- 100deg,
- rgba(255, 255, 255, 0) 30%,
- rgba(255, 255, 255, 0.4),
- rgba(255, 255, 255, 0) 70%
- );
- top: 0;
- left: -100%;
- pointer-events: none;
- animation: shine2 5s ease-in-out 1s infinite;
-
- @media (prefers-color-scheme: dark) {
- content: none;
- }
- }
img {
filter: drop-shadow(-1px -1px var(--bg-blur-color))
@@ -99,6 +65,10 @@
font-size: 1.4em;
text-wrap: balance;
opacity: 0.7;
+
+ & ~ p {
+ margin-top: 0;
+ }
}
.hero-container > p {
@@ -148,25 +118,34 @@
}
@media (width > 40em) {
- display: grid;
+ /* display: grid;
grid-template-columns: 1fr 1fr;
- grid-template-rows: 1fr auto;
height: 100vh;
- height: 100svh;
+ height: 100svh; */
+ width: 100%;
.hero-container {
height: auto;
+ max-height: none;
+ position: fixed;
+ left: 0;
+ top: 0;
+ bottom: 0;
+ width: 50%;
+ align-items: flex-end;
+
+ > * {
+ max-width: 40em;
+ width: 100%;
+ }
}
#why-container {
- padding: 32px;
- overflow: auto;
- mask-image: linear-gradient(to top, transparent 16px, black 64px);
- }
+ padding: 32px 32px 32px 8px;
+ margin-left: 50%;
- footer {
- grid-row: 2;
- grid-column: 1 / span 2;
+ /* overflow: auto;
+ mask-image: linear-gradient(to top, transparent 16px, black 64px); */
}
}
diff --git a/src/pages/welcome.jsx b/src/pages/welcome.jsx
index 58882dcbf..5319e60e5 100644
--- a/src/pages/welcome.jsx
+++ b/src/pages/welcome.jsx
@@ -17,29 +17,58 @@ function Welcome() {
return (
@@ -98,33 +127,6 @@ function Welcome() {
-
);
}
From 71454d40a92d7c071e05961f2a2a3c2a64745bba Mon Sep 17 00:00:00 2001
From: Matthieu Rakotojaona
Date: Sun, 10 Dec 2023 20:06:09 +0100
Subject: [PATCH 5/8] Remote media: avoid never-ending loops if it won't work
---
src/components/media.jsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/media.jsx b/src/components/media.jsx
index 52509532e..debb628a2 100644
--- a/src/components/media.jsx
+++ b/src/components/media.jsx
@@ -274,7 +274,7 @@ function Media({
}}
onError={(e) => {
const { src } = e.target;
- if (src === mediaURL) {
+ if (src === mediaURL && mediaURL !== remoteMediaURL) {
e.target.src = remoteMediaURL;
}
}}
@@ -307,7 +307,7 @@ function Media({
}}
onError={(e) => {
const { src } = e.target;
- if (src === mediaURL) {
+ if (src === mediaURL && mediaURL !== remoteMediaURL) {
e.target.src = remoteMediaURL;
}
}}
From 82195a8db0ddcd082b7b8d564b1c81ce8bd4ae9f Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 12 Dec 2023 08:34:06 +0800
Subject: [PATCH 6/8] Debug loop break
---
src/components/background-service.jsx | 1 +
src/pages/following.jsx | 1 +
2 files changed, 2 insertions(+)
diff --git a/src/components/background-service.jsx b/src/components/background-service.jsx
index 6c4b63d17..15647fe1b 100644
--- a/src/components/background-service.jsx
+++ b/src/components/background-service.jsx
@@ -74,6 +74,7 @@ export default memo(function BackgroundService({ isLoggedIn }) {
}
states.notificationsShowNew = true;
}
+ console.log('💥 Streaming notification loop STOPPED');
} catch (e) {
hasStreaming = false;
console.error(e);
diff --git a/src/pages/following.jsx b/src/pages/following.jsx
index c0505fec3..be4090777 100644
--- a/src/pages/following.jsx
+++ b/src/pages/following.jsx
@@ -95,6 +95,7 @@ function Following({ title, path, id, ...props }) {
if (s) s._deleted = true;
}
}
+ console.log('💥 Streaming user loop STOPPED');
}
})();
return () => {
From f213a8e094eebde56b85f783f58c0ce961e70eed Mon Sep 17 00:00:00 2001
From: Lim Chee Aun
Date: Tue, 12 Dec 2023 08:34:43 +0800
Subject: [PATCH 7/8] Fix subfolder hosting not working
Fix wrong `location` used
---
src/app.jsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/app.jsx b/src/app.jsx
index dc46bb453..3e4a6879c 100644
--- a/src/app.jsx
+++ b/src/app.jsx
@@ -261,7 +261,11 @@ function App() {
if (code) {
console.log({ code });
// Clear the code from the URL
- window.history.replaceState({}, document.title, location.pathname || '/');
+ window.history.replaceState(
+ {},
+ document.title,
+ window.location.pathname || '/',
+ );
const clientID = store.session.get('clientID');
const clientSecret = store.session.get('clientSecret');
From 5fef0b3fb5a530921ca0c3d895f8b2b4b0fea70c Mon Sep 17 00:00:00 2001
From: Matthieu Rakotojaona
Date: Tue, 12 Dec 2023 19:18:56 +0100
Subject: [PATCH 8/8] Don't highlight mention when it's prepended by a dot
---
src/components/compose.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/compose.jsx b/src/components/compose.jsx
index 93dd027f0..49537832c 100644
--- a/src/components/compose.jsx
+++ b/src/components/compose.jsx
@@ -108,7 +108,7 @@ function countableText(inputText) {
// https://github.com/mastodon/mastodon/blob/c03bd2a238741a012aa4b98dc4902d6cf948ab63/app/models/account.rb#L69
const USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i;
const MENTION_RE = new RegExp(
- `(^|[^=\\/\\w])(@${USERNAME_RE.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,
+ `(^|[^=\\/\\w.])(@${USERNAME_RE.source}(?:@[\\p{L}\\w.-]+[\\w]+)?)`,
'uig',
);