diff --git a/README.md b/README.md index 95b04c7..a67c4d1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # Mastowall 1.1 +Forked from [https://github.com/rstockm/mastowall](https://github.com/rstockm/mastowall) + Mastowall is a social wall application that displays posts from the [Mastodon](https://joinmastodon.org/) social network based on specified hashtags. It was written entirely by [ChatGPT4](https://openai.com/product/gpt-4), guided only by text prompts. -image - +image Try it live: [Mastowall for BDK23](https://tretkowski.de/mastowall/?hashtags=bdk23,netzbegruenung&server=https://gruene.social) @@ -37,6 +38,8 @@ JSON config file: - **Including Replies:** By default, replies are excluded from the wall. However, this behavior can be changed by setting includeReplies to true in the `config.json` file. +- **Configurable Overlay:** By default only the MastoWall is shown. For use with large displays eg during trade shows, conferences, booths, you can enable the Carousel with enlarged display of the 10 most recent posts. Just add `nbstand=1` to the argument in the URL. + ## Technology Stack Mastowall is built using the following technologies: @@ -63,7 +66,7 @@ Mastowall is built using the following technologies: ## Sharing via URL -Mastowall supports URL parameters to easily share specific hashtag configurations and the Mastodon server. Simply append the desired hashtags and the server URL to the URL following this format: `?hashtags=hashtag1,hashtag2,hashtag3&server=serverUrl` +Mastowall supports URL parameters to easily share specific hashtag configurations and the Mastodon server. Simply append the desired hashtags and the server URL to the URL following this format: `?hashtags=hashtag1,hashtag2,hashtag3&server=serverUrl&nbstand=0` Enjoy using Mastowall! diff --git a/config.json b/config.json index 251cbb0..0e72441 100644 --- a/config.json +++ b/config.json @@ -6,7 +6,10 @@ "refreshDuration": 30, "maxAge": 604800, "extraCards": [ - "" + "", + "", + "", + "" ], "includeReplies": true } diff --git a/index.html b/index.html index d144bab..5535d63 100644 --- a/index.html +++ b/index.html @@ -38,11 +38,11 @@
- +
- +
diff --git a/screenshot.jpg b/screenshot.jpg new file mode 100644 index 0000000..c4d8518 Binary files /dev/null and b/screenshot.jpg differ diff --git a/script.js b/script.js index fa94ffb..4031985 100644 --- a/script.js +++ b/script.js @@ -55,6 +55,8 @@ let duration; let refresh; // extra cards text let extraCards; +// toggle Carousel +let withCarousel=false; // fetchConfig fetches the configuration from the config.json file const fetchConfig = async function() { @@ -77,7 +79,10 @@ const fetchConfig = async function() { duration = 10000; refresh = 30000; extraCards = [ - "
" + "", + "", + "", + "" ]; return "https://gruene.social"; } @@ -104,6 +109,14 @@ const updateTimesOnPage = function() { }); }; +// replace certain emojies in some text with images +const replaceEmojies = (text, emojis) => { + emojis.forEach(emoji => { + text = text.replaceAll(`:${emoji.shortcode}:`, ``); + }); + return text; +}; + // displayPost creates and displays a post const displayPost = function(post) { if (existingPosts.includes(post.id) || (!includeReplies && post.in_reply_to_id !== null)) return 0; @@ -115,10 +128,14 @@ const displayPost = function(post) {
-

${DOMPurify.sanitize(post.account.display_name)} @${DOMPurify.sanitize(post.account.acct)}

+

${replaceEmojies(DOMPurify.sanitize(post.account.display_name), post.account.emojis)} @${DOMPurify.sanitize(post.account.acct)}

- ${post.media_attachments[0] ? `` : ''} -

${DOMPurify.sanitize(post.content)}

+ ${post.media_attachments[0] ? + (post.media_attachments[0].url.endsWith('.mp4') ? + `` : + ``) : + ''} +

${replaceEmojies(DOMPurify.sanitize(post.content), post.emojis)}

${post.spoiler_text ? `

${DOMPurify.sanitize(post.spoiler_text)}

` : ''}

${timeAgo(secondsAgo(new Date(post.created_at)))}

@@ -133,7 +150,7 @@ const displayPost = function(post) { const processPosts = function(posts) { posts = posts.filter((post) => { - return secondsAgo(new Date(post.created_at)) < maxAge && post.content.indexOf("nitter.") === -1 + return secondsAgo(new Date(post.created_at)) < maxAge && post.content.indexOf("nitter.") === -1 && post.spoiler_text === "" }); return posts; @@ -185,17 +202,22 @@ const updateCarousel = function(slides, posts) { else { newHTML += `