Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
refactor(posts): drop the frontend URL trim, rely on the backend's clean uri
Paulo Castellano7c79b331f614
diff --git a/resources/js/composables/useLinkCard.ts b/resources/js/composables/useLinkCard.tsindex 17f9b5416..25dda4909 100644--- a/resources/js/composables/useLinkCard.ts+++ b/resources/js/composables/useLinkCard.ts@@ -13,35 +13,19 @@ export interface LinkCard {}/**- * The first http(s) URL in `text`, or null. Trailing sentence punctuation and an- * unmatched closing paren are trimmed so the detected URL matches the link's- * rendered span — this mirrors the backend `UrlDetector`, keeping the preview- * card's URL identical to the one the post actually links to.- */-const firstUrl = (text: string): string | null => {- const match = text.match(/https?:\/\/[^\s]+/);-- if (!match) {- return null;- }-- const url = match[0].replace(/[.,;:!?]$/, '');-- return url.endsWith(')') && !url.includes('(') ? url.slice(0, -1) : url;-};--/**- * Live link-preview card for the composer. Resolves the first link in `content`- * to its OpenGraph card, but only when there is no attached media (media- * suppresses the link card on every platform). Returns the card and a loading- * flag for the editor previews to render.+ * Live link-preview card for the composer. Detects the first link in `content`+ * — a rough match is enough, because the backend re-detects it and returns the+ * exact, trimmed URL as `card.uri` — and resolves its OpenGraph card, but only+ * when no media is attached (media suppresses the link card on every platform).*/export const useLinkCard = (content: Ref<string>, media: Ref<MediaItem[]>) => {const card = ref<LinkCard | null>(null);const loading = ref(false);const http = useHttp<{ url: string }, LinkCard | null>({ url: '' });- const url = computed(() => (media.value.length > 0 ? null : firstUrl(content.value)));+ const url = computed(() =>+ media.value.length > 0 ? null : (content.value.match(/https?:\/\/\S+/)?.[0] ?? null),+ );const fetchCard = async (target: string): Promise<void> => {loading.value = true;