Skip to content

Commit c6f88f3

Browse files
committed
Add favicon and meta
1 parent 2f164da commit c6f88f3

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

include/ff.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ namespace ff {
4141
{"/img/announcements.svg", "/etc/ff/img/announcements.svg"},
4242
{"/fonts/font.woff2", "/etc/ff/fonts/font.woff2"},
4343
{"/audio/click.wav", "/etc/ff/audio/click.wav"},
44+
{"/img/favicon.ico", "/etc/ff/img/favicon.ico"},
4445
};
4546
int64_t max_request_size{250 * 1024 * 1024}; // 250mb
4647
std::string site_url{"https://forwarderfactory.com"};

js/ff.js

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,6 +3076,46 @@ async function draw_article(type, forwarder, id) {
30763076
thumbnail.id = 'view_floating_window_banner_thumbnail';
30773077
thumbnail.style.cursor = 'pointer';
30783078

3079+
document.title = forwarder.meta.title || 'Forwarder Details';
3080+
document.title = forwarder?.meta?.title || 'No title provided';
3081+
3082+
const meta_description = document.createElement('meta');
3083+
meta_description.name = 'description';
3084+
meta_description.content = forwarder?.meta?.description || 'No description provided';
3085+
meta_description.id = 'view_floating_window_meta_description';
3086+
3087+
const meta_keywords = document.createElement('meta');
3088+
meta_keywords.name = 'keywords';
3089+
meta_keywords.content = forwarder?.categories ? forwarder.categories.join(', ') : 'No categories provided';
3090+
meta_keywords.id = 'view_floating_window_meta_keywords';
3091+
3092+
const meta_author = document.createElement('meta');
3093+
meta_author.name = 'author';
3094+
meta_author.content = forwarder?.meta?.author || 'Unknown Author';
3095+
meta_author.id = 'view_floating_window_meta_author';
3096+
3097+
const og_title = document.createElement('meta');
3098+
og_title.setAttribute('property', 'og:title');
3099+
og_title.content = forwarder?.meta?.title || 'No title provided';
3100+
og_title.id = 'view_floating_window_og_title';
3101+
3102+
const og_description = document.createElement('meta');
3103+
og_description.setAttribute('property', 'og:description');
3104+
og_description.content = forwarder?.meta?.description || 'No description provided';
3105+
og_description.id = 'view_floating_window_og_description';
3106+
3107+
const og_image = document.createElement('meta');
3108+
og_image.setAttribute('property', 'og:image');
3109+
og_image.content = `/download/${forwarder.banner_thumbnail_download_key}`;
3110+
og_image.id = 'view_floating_window_og_image';
3111+
3112+
document.head.appendChild(meta_description);
3113+
document.head.appendChild(meta_keywords);
3114+
document.head.appendChild(meta_author);
3115+
document.head.appendChild(og_title);
3116+
document.head.appendChild(og_description);
3117+
document.head.appendChild(og_image);
3118+
30793119
let banner = null;
30803120
let is_hover = false;
30813121

@@ -3142,7 +3182,6 @@ async function draw_article(type, forwarder, id) {
31423182
view_window.appendChild(thumbnail);
31433183
}
31443184

3145-
31463185
const title = document.createElement('h1');
31473186
if (forwarder.meta.title) {
31483187
title.innerHTML = forwarder.meta.title;
@@ -3154,7 +3193,7 @@ async function draw_article(type, forwarder, id) {
31543193

31553194
const uploader = document.createElement('p');
31563195
uploader.className = 'view_floating_window_uploader';
3157-
if (forwarder.uploader) {
3196+
if (forwarder.uploader && forwarder.uploader !== '') {
31583197
const profile = await get_profile_for_user(forwarder.uploader);
31593198
if (profile.profile_key === '' || profile.profile_key === undefined) {
31603199
const fa = document.createElement('i');
@@ -3226,7 +3265,6 @@ async function draw_article(type, forwarder, id) {
32263265
star.style.marginRight = '5px';
32273266
star.style.width = '20px';
32283267
star.style.height = '20px';
3229-
star.style.cursor = 'pointer';
32303268
star.alt = 'Empty star';
32313269

32323270
if (is_logged_in()) {

0 commit comments

Comments
 (0)