diff --git a/src/components/media.jsx b/src/components/media.jsx
index e73a8a4e..709291e8 100644
--- a/src/components/media.jsx
+++ b/src/components/media.jsx
@@ -74,7 +74,7 @@ function Media({
altIndex,
onClick = () => {},
}) {
- const {
+ let {
blurhash,
description,
meta,
@@ -84,10 +84,17 @@ function Media({
url,
type,
} = media;
+ if (/no\-preview\./i.test(previewUrl)) {
+ previewUrl = null;
+ }
const { original = {}, small, focus } = meta || {};
- const width = showOriginal ? original?.width : small?.width;
- const height = showOriginal ? original?.height : small?.height;
+ const width = showOriginal
+ ? original?.width
+ : small?.width || original?.width;
+ const height = showOriginal
+ ? original?.height
+ : small?.height || original?.height;
const mediaURL = showOriginal ? url : previewUrl || url;
const remoteMediaURL = showOriginal
? remoteUrl
@@ -290,7 +297,11 @@ function Media({
}}
onError={(e) => {
const { src } = e.target;
- if (src === mediaURL && mediaURL !== remoteMediaURL) {
+ if (
+ src === mediaURL &&
+ remoteMediaURL &&
+ mediaURL !== remoteMediaURL
+ ) {
e.target.src = remoteMediaURL;
}
}}
@@ -473,14 +484,26 @@ function Media({
/>
) : (
<>
-
+ {previewUrl ? (
+
+ ) : (
+
+ )}
diff --git a/src/pages/account-statuses.jsx b/src/pages/account-statuses.jsx
index e91e8fa6..75ff6e31 100644
--- a/src/pages/account-statuses.jsx
+++ b/src/pages/account-statuses.jsx
@@ -151,7 +151,7 @@ function AccountStatuses() {
}
}
- const results = [];
+ let results = [];
if (firstLoad) {
const { value } = await masto.v1.accounts
.$select(id)
@@ -192,6 +192,26 @@ function AccountStatuses() {
}
const { value, done } = await accountStatusesIterator.current.next();
if (value?.length) {
+ // Check if value is same as pinned post (results)
+ // If the index for every post is the same, means API might not support pinned posts
+ if (results.length) {
+ let pinnedStatusesIds = [];
+ if (results[0]?.type === 'pinned') {
+ pinnedStatusesIds = results[0].id;
+ } else {
+ pinnedStatusesIds = results
+ .filter((status) => status._pinned)
+ .map((status) => status.id);
+ }
+ const containsAllPinned = pinnedStatusesIds.every((postId) =>
+ value.some((status) => status.id === postId),
+ );
+ if (containsAllPinned) {
+ // Remove pinned posts
+ results = [];
+ }
+ }
+
results.push(...value);
value.forEach((item) => {
diff --git a/src/pages/following.jsx b/src/pages/following.jsx
index d5def903..0192788a 100644
--- a/src/pages/following.jsx
+++ b/src/pages/following.jsx
@@ -71,7 +71,8 @@ function Following({ title, path, id, ...props }) {
.next();
let { value } = results;
console.log('checkForUpdates', latestItem.current, value);
- if (value?.length) {
+ const valueContainsLatestItem = value[0]?.id === latestItem.current; // since_id might not be supported
+ if (value?.length && !valueContainsLatestItem) {
latestItem.current = value[0].id;
value = dedupeBoosts(value, instance);
value = filteredItems(value, 'home');
diff --git a/src/pages/hashtag.jsx b/src/pages/hashtag.jsx
index 251de1da..ec7809ad 100644
--- a/src/pages/hashtag.jsx
+++ b/src/pages/hashtag.jsx
@@ -109,8 +109,9 @@ function Hashtags({ media: mediaView, columnMode, ...props }) {
})
.next();
let { value } = results;
- value = filteredItems(value, 'public');
- if (value?.length) {
+ const valueContainsLatestItem = value[0]?.id === latestItem.current; // since_id might not be supported
+ if (value?.length && !valueContainsLatestItem) {
+ value = filteredItems(value, 'public');
return true;
}
return false;
diff --git a/src/pages/list.jsx b/src/pages/list.jsx
index 16ba66f0..3524c547 100644
--- a/src/pages/list.jsx
+++ b/src/pages/list.jsx
@@ -63,8 +63,9 @@ function List(props) {
since_id: latestItem.current,
});
let { value } = results;
- value = filteredItems(value, 'home');
- if (value?.length) {
+ const valueContainsLatestItem = value[0]?.id === latestItem.current; // since_id might not be supported
+ if (value?.length && !valueContainsLatestItem) {
+ value = filteredItems(value, 'home');
return true;
}
return false;
diff --git a/src/pages/mentions.jsx b/src/pages/mentions.jsx
index da6e5ae0..d9bfe407 100644
--- a/src/pages/mentions.jsx
+++ b/src/pages/mentions.jsx
@@ -95,7 +95,9 @@ function Mentions({ columnMode, ...props }) {
latestConversationItem.current,
value,
);
- if (value?.length) {
+ const valueContainsLatestItem =
+ value[0]?.id === latestConversationItem.current; // since_id might not be supported
+ if (value?.length && !valueContainsLatestItem) {
latestConversationItem.current = value[0].lastStatus.id;
return true;
}
diff --git a/src/pages/public.jsx b/src/pages/public.jsx
index 089d084a..f4e10b38 100644
--- a/src/pages/public.jsx
+++ b/src/pages/public.jsx
@@ -63,8 +63,9 @@ function Public({ local, columnMode, ...props }) {
})
.next();
let { value } = results;
- value = filteredItems(value, 'public');
- if (value?.length) {
+ const valueContainsLatestItem = value[0]?.id === latestItem.current; // since_id might not be supported
+ if (value?.length && !valueContainsLatestItem) {
+ value = filteredItems(value, 'public');
return true;
}
return false;
diff --git a/src/utils/get-instance-status-url.js b/src/utils/get-instance-status-url.js
index 042e8583..33c05691 100644
--- a/src/utils/get-instance-status-url.js
+++ b/src/utils/get-instance-status-url.js
@@ -6,6 +6,7 @@ const statusPostRegexes = [
/\/notes\/([^\/]+)/i, // Misskey, Firefish
/^\/(?:notice|objects)\/([a-z0-9-]+)/i, // Pleroma
/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i, // Mastodon
+ /^\/p\/[^\/]+\/([^\/]+)/i, // Pixelfed
];
export function getInstanceStatusObject(url) {