this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix composer not opening for Pleroma instances

Pleroma doesn't have `configuration` in instance API response

+55 -6
+16 -6
src/components/compose.jsx
··· 23 23 getCurrentAccount, 24 24 getCurrentAccountNS, 25 25 getCurrentInstance, 26 + getCurrentInstanceConfiguration, 26 27 } from '../utils/store-utils'; 27 28 import supports from '../utils/supports'; 28 29 import useInterval from '../utils/useInterval'; ··· 119 120 const currentAccount = getCurrentAccount(); 120 121 const currentAccountInfo = currentAccount.info; 121 122 122 - const { configuration } = getCurrentInstance(); 123 + const configuration = getCurrentInstanceConfiguration(); 123 124 console.log('⚙️ Configuration', configuration); 124 125 125 126 const { 126 - statuses: { maxCharacters, maxMediaAttachments, charactersReservedPerUrl }, 127 + statuses: { 128 + maxCharacters, 129 + maxMediaAttachments, 130 + charactersReservedPerUrl, 131 + } = {}, 127 132 mediaAttachments: { 128 - supportedMimeTypes, 133 + supportedMimeTypes = [], 129 134 imageSizeLimit, 130 135 imageMatrixLimit, 131 136 videoSizeLimit, 132 137 videoMatrixLimit, 133 138 videoFrameRateLimit, 134 - }, 135 - polls: { maxOptions, maxCharactersPerOption, maxExpiration, minExpiration }, 136 - } = configuration; 139 + } = {}, 140 + polls: { 141 + maxOptions, 142 + maxCharactersPerOption, 143 + maxExpiration, 144 + minExpiration, 145 + } = {}, 146 + } = configuration || {}; 137 147 138 148 const textareaRef = useRef(); 139 149 const spoilerTextRef = useRef();
+39
src/utils/store-utils.js
··· 81 81 return {}; 82 82 } 83 83 } 84 + 85 + // Massage these instance configurations to match the Mastodon API 86 + // - Pleroma 87 + function getInstanceConfiguration(instance) { 88 + const { 89 + configuration, 90 + maxMediaAttachments, 91 + maxTootChars, 92 + pleroma, 93 + pollLimits, 94 + } = instance; 95 + 96 + const statuses = configuration?.statuses || {}; 97 + if (maxMediaAttachments) { 98 + statuses.maxMediaAttachments ??= maxMediaAttachments; 99 + } 100 + if (maxTootChars) { 101 + statuses.maxCharacters ??= maxTootChars; 102 + } 103 + 104 + const polls = configuration?.polls || {}; 105 + if (pollLimits) { 106 + polls.maxCharactersPerOption ??= pollLimits.maxOptionChars; 107 + polls.maxExpiration ??= pollLimits.maxExpiration; 108 + polls.maxOptions ??= pollLimits.maxOptions; 109 + polls.minExpiration ??= pollLimits.minExpiration; 110 + } 111 + 112 + return { 113 + ...configuration, 114 + statuses, 115 + polls, 116 + }; 117 + } 118 + 119 + export function getCurrentInstanceConfiguration() { 120 + const instance = getCurrentInstance(); 121 + return getInstanceConfiguration(instance); 122 + }