Вложения файлов со своего сервера доступа пользователя

This commit is contained in:
AidarKC
2026-10-07 11:42:12 +03:00
parent b1c42efa82
commit 7b8e178723
33 changed files with 1960 additions and 496 deletions
+47 -4
View File
@@ -1417,6 +1417,38 @@ async function loadFromApi(route, channelId) {
} catch {
// ignore owner feed lookup failures
}
if (!channel) {
try {
const profileChannels = await authService.listUserProfileChannels(ownerLoginForLookup, 'owned', 500, 0, true);
const deletedRow = (Array.isArray(profileChannels?.channels) ? profileChannels.channels : []).find((item) => (
String(item?.slug || '').trim().toLowerCase() === selector.channelName.toLowerCase()
&& String(item?.ownerLogin || '').trim().toLowerCase() === ownerLoginForLookup.toLowerCase()
));
if (deletedRow) {
channel = {
channel: {
ownerLogin: deletedRow.ownerLogin,
ownerBlockchainName: deletedRow.ownerBlockchainName,
channelName: deletedRow.slug,
displayName: deletedRow.displayName,
avaAr: deletedRow.avatarAr,
deleted: !!deletedRow.deleted,
deletedAtMs: Number(deletedRow.deletedAtMs || 0),
channelRoot: {
blockNumber: Number(deletedRow.rootBlockNumber),
blockHash: normalizeRouteHash(deletedRow.rootBlockHashHex),
},
},
unreadCount: 0,
messagesCount: 0,
readCount: 0,
readStateInitialized: true,
};
}
} catch {
// ignore deleted-channel lookup failures
}
}
}
}
if (!channel?.channel?.ownerBlockchainName || channel?.channel?.channelRoot?.blockNumber == null) {
@@ -1956,6 +1988,9 @@ function renderPostCard(post, {
card.append(createAttachmentCarouselElement(parsedBody.attachments, {
gateway: state.entrySettings.arweaveServer,
messageTimestampMs: post.timestampMs,
authorLogin: post.authorLogin,
solanaEndpoint: state.entrySettings.solanaServer,
fallbackServerLogin: state.entrySettings.shineServerLogin,
}));
}
if (post.isRating) {
@@ -2451,7 +2486,7 @@ export function render({ navigate, route, chrome }) {
className: 'channel-view-topbar topbar--identity',
actions: [
{
label: '⋮',
icon: 'moreVertical',
title: 'Действия канала',
ariaLabel: 'Открыть меню канала',
className: 'channel-header-more-btn',
@@ -2468,7 +2503,7 @@ export function render({ navigate, route, chrome }) {
const aboutRoute = makeShineChannelAboutRoute(routeArgs);
const donateRoute = makeShineChannelDonateRoute(routeArgs);
const items = [];
items.push({ label: 'О канале', iconHtml: iconHtml('info'), action: () => { if (aboutRoute) navigate(aboutRoute); } });
items.push({ label: apiData?.isOwnChannel ? 'Редактировать' : 'О канале', iconHtml: iconHtml(apiData?.isOwnChannel ? 'edit' : 'info'), action: () => { if (aboutRoute) navigate(aboutRoute); } });
if (apiData?.isOwnChannel && !apiData?.isDiary) {
items.push({ label: 'Новая запись', iconHtml: iconHtml('compose'), action: () => activeAddMessage?.() });
}
@@ -2497,7 +2532,7 @@ export function render({ navigate, route, chrome }) {
});
}
}
const aboutIndex = items.findIndex((item) => item.label === 'О канале');
const aboutIndex = items.findIndex((item) => item.label === 'О канале' || item.label === 'Редактировать');
if (aboutIndex > 0) items.unshift(...items.splice(aboutIndex, 2));
return items;
},
@@ -2946,7 +2981,15 @@ export function render({ navigate, route, chrome }) {
restorePosition,
showStatus,
isActive: () => !disposed,
onAddMessage: activeAddMessage = () => {
onAddMessage: activeAddMessage = async () => {
if (apiData?.channel?.deleted) {
const confirmed = await confirmDialog({
title: 'Восстановить канал?',
text: 'Новое сообщение восстановит канал: он перестанет считаться удалённым и снова появится в обычном списке ваших каналов.',
confirmLabel: 'Восстановить и написать',
});
if (!confirmed || disposed) return;
}
openAddMessageModal({
channelName: apiData?.channel?.name || '',
channelTitle: apiData?.channel?.displayTitle || '',