Nevermind, i found a solution. And for those who maybe need this, you need to edit a JS file in the extension folder. Located vendor\datlechin\flarum-link-preview\js\dist\forum.js
and you can replace this code with current codes in this file:
(() => {
var e = {
n: (t) => {
var n = t && t.__esModule ? () => t.default : () => t;
return e.d(n, { a: n }), n;
},
d: (t, n) => {
for (var a in n) e.o(n, a) && !e.o(t, a) && Object.defineProperty(t, a, { enumerable: !0, get: n[a] });
},
o: (e, t) => Object.prototype.hasOwnProperty.call(e, t),
r: (e) => {
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
},
},
t = {};
(() => {
"use strict";
e.r(t);
const n = flarum.core.compat["forum/app"];
var a = e.n(n);
const r = flarum.core.compat["common/extend"],
i = flarum.core.compat["forum/components/CommentPost"];
var o = e.n(i);
a().initializers.add("datlechin/flarum-link-preview", function () {
(0, r.extend)(o().prototype, "oncreate", function () {
for (
var e = this.element.querySelectorAll(".Post-body a[rel]"),
t = function (t) {
var n = e[t],
a = n.getAttribute("href");
if (!((n.classList.contains("PostMention") && n.classList.contains("UserMention")) || a !== n.textContent)) {
var r = document.createElement("div");
r.classList.add("LinkPreview"), n.parentNode.insertBefore(r, n), r.appendChild(n), n.remove();
var i = document.createElement("div");
i.classList.add("LinkPreview-image"), r.appendChild(i);
var o = document.createElement("img");
i.appendChild(o);
var d = document.createElement("div");
d.classList.add("LinkPreview-main"), r.appendChild(d);
var l = document.createElement("div");
l.classList.add("LinkPreview-title"), d.appendChild(l);
var c = document.createElement("a");
(c.target = "_blank"), (c.rel = "nofollow external usg noopener"), l.appendChild(c);
var s = document.createElement("div");
s.classList.add("LinkPreview-description"), d.appendChild(s);
var m = document.createElement("div");
m.classList.add("LinkPreview-domain"), d.appendChild(m);
var p = document.createElement("a");
(p.href = a), (p.target = "_blank"), (p.rel = "nofollow external usg noopener");
var u = a.split("/")[2].replace("www.", ""),
v = a.split("/")[0] + "//" + u,
f = document.createElement("img");
(f.src = "https://www.google.com/s2/favicons?sz=64&domain_url=" + v), m.appendChild(f), (p.textContent = u), m.appendChild(p), (p.href = v);
var h = document.createElement("i");
h.classList.add("fa", "fa-spinner", "fa-spin"),
i.appendChild(h),
fetch("https://meta-grabber.herokuapp.com?url=" + a, { method: "GET", mode: "cors", credentials: "omit" })
.then(function (e) {
return h.remove(), e.json();
})
.then(function (e) {
(o.src = e.image ? e.image : "https://www.google.com/s2/favicons?sz=64&domain_url=" + u),
(c.href = e.url ? e.url : a),
(c.textContent = e.title ? e.title : u),
(s.textContent = e.description ? e.description : ""),
(p.textContent = e.site_name ? e.site_name : u);
});
}
},
n = 0;
n < e.length;
n++
)
t(n);
});
});
})(),
(module.exports = t);
})();
//# sourceMappingURL=forum.js.map
Or a minify version:
(()=>{var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const n=flarum.core.compat["forum/app"];var r=e.n(n);const a=flarum.core.compat["common/extend"],o=flarum.core.compat["forum/components/CommentPost"];var i=e.n(o);r().initializers.add("datlechin/flarum-link-preview",(function(){(0,a.extend)(i().prototype,"oncreate",(function(){for(var e=this.element.querySelectorAll(".Post-body a[rel]"),t=function(t){var n=e[t],r=n.getAttribute("href");if(!(n.classList.contains("PostMention")&&n.classList.contains("UserMention")||r!==n.textContent)){var a=document.createElement("div");a.classList.add("LinkPreview"),n.parentNode.insertBefore(a,n),a.appendChild(n),n.remove();var o=document.createElement("div");o.classList.add("LinkPreview-image"),a.appendChild(o);var i=document.createElement("img");o.appendChild(i);var d=document.createElement("div");d.classList.add("LinkPreview-main"),a.appendChild(d);var l=document.createElement("div");l.classList.add("LinkPreview-title"),d.appendChild(l);var c=document.createElement("a");c.target="_blank",c.rel="nofollow external usg noopener",l.appendChild(c);var s=document.createElement("div");s.classList.add("LinkPreview-description"),d.appendChild(s);var m=document.createElement("div");m.classList.add("LinkPreview-domain"),d.appendChild(m);var p=document.createElement("a");p.href=r,p.target="_blank",p.rel="nofollow external usg noopener";var u=r.split("/")[2].replace("www.",""),v=r.split("/")[0]+"//"+u,f=document.createElement("img");f.src="https://www.google.com/s2/favicons?sz=64&domain_url="+v,m.appendChild(f),p.textContent=u,m.appendChild(p),p.href=v;var h=document.createElement("i");h.classList.add("fa","fa-spinner","fa-spin"),o.appendChild(h),fetch("https://meta-grabber.herokuapp.com?url="+r,{method:"GET",mode:"cors",credentials:"omit"}).then((function(e){return h.remove(),e.json()})).then((function(e){i.src=e.image?e.image:"https://www.google.com/s2/favicons?sz=64&domain_url="+u,c.href=e.url?e.url:r,c.textContent=e.title?e.title:u,s.textContent=e.description?e.description:"",p.textContent=e.site_name?e.site_name:u}))}},n=0;n<e.length;n++)t(n)}))}))})(),module.exports=t})();
Then clear forum's cache and here you go 😃