Skip to content

feat: Add link preview#1259

Open
SiriusCrain wants to merge 1 commit into
vicinaehq:mainfrom
SiriusCrain:feat/add-link-preview
Open

feat: Add link preview#1259
SiriusCrain wants to merge 1 commit into
vicinaehq:mainfrom
SiriusCrain:feat/add-link-preview

Conversation

@SiriusCrain
Copy link
Copy Markdown
Contributor

@SiriusCrain SiriusCrain commented Mar 25, 2026

Closes #1256

slopped with claude

image

Updated design:

image

Copy link
Copy Markdown
Contributor

@bpavuk bpavuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have expertise to evaluate most of C++ code, but some of it does rub me the wrong way, aside from C++ being biblically verbose in general

Comment on lines +4 to +5
<file>migrations/002_add_url_metadata.sql</file>
<file>migrations/003_add_og_image.sql</file>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: could we squash them?

Comment on lines +255 to +265
Image {
visible: root.host.detailOgImageUrl !== ""
source: root.host.detailOgImageUrl
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: 10
fillMode: Image.PreserveAspectFit
sourceSize.width: 500
cache: true
asynchronous: true
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lightly rounding corners would be beneficial for consistency across Vicinae

Comment on lines +4 to +5
#include <libxml/HTMLparser.h>
#include <libxml/tree.h>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unless there is an overwhelmingly massive benefit to interfacing with a C library directly (which I don't see the code below utilizing) I strongly encourage you to have a look at libxml++. idiomatic C++ is much easier to read than "C with classes"-style code, and perhaps we could apply XPath queries here.

Comment on lines +52 to +54
xmlFree(prop);
xmlFree(name);
xmlFree(content);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAII?

auto *text = xmlNodeGetContent(cur);
if (text) {
result.ogTitle = QString::fromUtf8(reinterpret_cast<const char *>(text));
xmlFree(text);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAII?

};

walk(xmlDocGetRootElement(doc));
xmlFreeDoc(doc);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAII? (yet again)

Copy link
Copy Markdown
Contributor

@aurelleb aurelleb Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guess no RAII is fine for now, eventually we will ditch libxml or just wrap it in a C++ class

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventually? why not do it good now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's already in use in other places like this, and I don't yet know what to replace it with. needs some consideration. I don't want to block this PR just because of that
I still have to review this one anyways

@SiriusCrain
Copy link
Copy Markdown
Contributor Author

Sorry for delay, will fix in a week (on vacation right now)

@SiriusCrain SiriusCrain force-pushed the feat/add-link-preview branch from 80d2117 to b43415d Compare April 13, 2026 14:22
@SiriusCrain SiriusCrain force-pushed the feat/add-link-preview branch from b43415d to f7bb33c Compare April 13, 2026 14:29
@SiriusCrain
Copy link
Copy Markdown
Contributor Author

@aurelleb updated

@SiriusCrain SiriusCrain requested a review from aurelleb April 13, 2026 14:35
@vMohammad24
Copy link
Copy Markdown

if this is getting merged, make it optional/opt-out, I don't think its very secure to fetch EVERY link you copy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support embed preview in clipboard

4 participants