From db7b14453bfc141eafe6b433147135f057e89868 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 3 Dec 2025 12:36:38 -0800 Subject: follow script automation --- indieweb-micro/content/indie/follows.md | 8 +-- indieweb-micro/make-follow.sh | 64 +++++++++++++++++++++- micro.pinapelz.moe/index.xml | 2 +- micro.pinapelz.moe/indie/follows/index.html | 84 ++--------------------------- micro.pinapelz.moe/indie/index.xml | 2 +- 5 files changed, 68 insertions(+), 92 deletions(-) diff --git a/indieweb-micro/content/indie/follows.md b/indieweb-micro/content/indie/follows.md index 37af2c4..5a2727a 100644 --- a/indieweb-micro/content/indie/follows.md +++ b/indieweb-micro/content/indie/follows.md @@ -9,19 +9,13 @@ This is mostly here for pages that can receive [Webmentions](https://indieweb.or ## Fediverse {{< follow "https://sakurajima.moe/@Mofumatic" "2025-12-03" >}} -{{< follow "https://sakurajima.moe/@anianimalsmoe" "2025-12-03" >}} {{< follow "https://mathstodon.xyz/@tao" "2025-12-03" >}} {{< follow "https://sakurajima.moe/@chikorita157" "2025-12-03" >}} -{{< follow "https://misskey.io/@CAP_Tw" "2025-12-03" >}} -{{< follow "https://misskey.io/@meeeeeeco" "2025-12-03" >}} {{< follow "https://sakurajima.moe/@sakurajima" "2025-12-03" >}} -{{< follow "https://mi.shiromaru.work/@ovoip" "2025-12-03" >}} {{< follow "https://floss.social/@kde" "2025-12-03" >}} -{{< follow "https://misskey.io/@sateralate723" "2025-12-03" >}} -{{< follow "https:///mstdn.social/@BrodieOnLinux" "2025-12-03" >}} +{{< follow "https://mastodon.social/@gamingonlinux" "2025-12-03" >}} ## Bluesky -{{< follow "https://bsky.app/profile/mofu.run" "2025-12-03" >}} {{< follow "https://bsky.app/profile/anew.social" "2025-12-03" >}} > Learn more about the [Indieweb](https://indieweb.org) diff --git a/indieweb-micro/make-follow.sh b/indieweb-micro/make-follow.sh index b72fc9d..b7acb2c 100755 --- a/indieweb-micro/make-follow.sh +++ b/indieweb-micro/make-follow.sh @@ -5,12 +5,21 @@ today=$(date '+%Y-%m-%d') # Check if URL is provided as argument if [ $# -eq 0 ]; then - echo "Usage: $0 " + echo "Usage: $0 [markdown_file]" echo "Example: $0 https://sakurajima.moe/@sakurajima" + echo "Example: $0 @user@site.com content/indie/follows.md" exit 1 fi url="$1" +markdown_file="${2:-content/indie/follows.md}" + +# Handle @user@site.com format by remapping to https://site.com/@user +if [[ $url =~ ^@([^@]+)@(.+)$ ]]; then + username="${BASH_REMATCH[1]}" + domain="${BASH_REMATCH[2]}" + url="https://$domain/@$username" +fi # Append https if not present if [[ ! $url =~ ^https?:// ]]; then @@ -26,5 +35,56 @@ if [[ $url =~ ^https://[^/]+/@[^@]+@([^/]+)$ ]]; then url="https://$remote_domain/@$username" fi +# Determine the category based on URL +if [[ $url =~ ^https://bsky\.app/ ]]; then + category="Bluesky" +elif [[ $url =~ ^https://[^/]+/@[^/]+$ ]]; then + category="Fediverse" +else + category="Indieweb" +fi + # Generate the follow shortcode -echo "{{< follow \"$url\" \"$today\" >}}" +follow_line="{{< follow \"$url\" \"$today\" >}}" + +# If markdown file is provided, append to the appropriate section +if [ "$2" != "" ] || [ -f "$markdown_file" ]; then + if [ ! -f "$markdown_file" ]; then + echo "Error: Markdown file '$markdown_file' not found" + exit 1 + fi + + # Find the line number of the category section + section_line=$(grep -n "^## $category" "$markdown_file" | cut -d: -f1) + + if [ -z "$section_line" ]; then + echo "Error: Section '## $category' not found in $markdown_file" + exit 1 + fi + + # Find the end of the section (next ## header or end of file) + next_section_line=$(tail -n +"$((section_line + 1))" "$markdown_file" | grep -n "^## " | head -1 | cut -d: -f1) + + if [ -z "$next_section_line" ]; then + # No next section found, append at end of file + end_line=$(wc -l < "$markdown_file") + else + # Calculate actual line number of next section + end_line=$((section_line + next_section_line - 1)) + fi + + # Create a temporary file with the new follow added at the end of the section + temp_file=$(mktemp) + head -n "$((end_line - 1))" "$markdown_file" > "$temp_file" + echo "$follow_line" >> "$temp_file" + tail -n +"$end_line" "$markdown_file" >> "$temp_file" + + # Replace the original file + mv "$temp_file" "$markdown_file" + + echo "Added follow to $category section in $markdown_file:" +else + echo "Follow shortcode (not added to file):" +fi + +echo "$follow_line" diff --git a/micro.pinapelz.moe/index.xml b/micro.pinapelz.moe/index.xml index fb946f2..14a1b17 100644 --- a/micro.pinapelz.moe/index.xml +++ b/micro.pinapelz.moe/index.xml @@ -15,7 +15,7 @@ https://micro.pinapelz.moe/indie/follows/ Wed, 03 Dec 2025 01:17:39 -0800yukais@pinapelz.com (Pinapelz) https://micro.pinapelz.moe/indie/follows/ - <p>Here are all the pages/accounts I follow.</p> <p>This is mostly here for pages that can receive <a href="https://indieweb.org/webmention">Webmentions</a> and the <a href="https://fed.brid.gy">Bridgy Fed</a> service.</p> <h2 id="fediverse">Fediverse</h2> <p> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@Mofumatic"> https://sakurajima.moe/@Mofumatic </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@anianimalsmoe"> https://sakurajima.moe/@anianimalsmoe </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://mathstodon.xyz/@tao"> https://mathstodon.xyz/@tao </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@chikorita157"> https://sakurajima.moe/@chikorita157 </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://misskey.io/@CAP_Tw"> https://misskey.io/@CAP_Tw </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://misskey.io/@meeeeeeco"> https://misskey.io/@meeeeeeco </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@sakurajima"> https://sakurajima.moe/@sakurajima </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://mi.shiromaru.work/@ovoip"> https://mi.shiromaru.work/@ovoip </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://floss.social/@kde"> https://floss.social/@kde </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://misskey.io/@sateralate723"> https://misskey.io/@sateralate723 </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https:///mstdn.social/@BrodieOnLinux"> https:///mstdn.social/@BrodieOnLinux </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> </p> <h2 id="bluesky">Bluesky</h2> <p> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://bsky.app/profile/mofu.run"> https://bsky.app/profile/mofu.run </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://bsky.app/profile/anew.social"> https://bsky.app/profile/anew.social </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> </p> + <p>Here are all the pages/accounts I follow.</p> <p>This is mostly here for pages that can receive <a href="https://indieweb.org/webmention">Webmentions</a> and the <a href="https://fed.brid.gy">Bridgy Fed</a> service.</p> <h2 id="fediverse">Fediverse</h2> <p> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@Mofumatic"> https://sakurajima.moe/@Mofumatic </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://mathstodon.xyz/@tao"> https://mathstodon.xyz/@tao </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@chikorita157"> https://sakurajima.moe/@chikorita157 </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://sakurajima.moe/@sakurajima"> https://sakurajima.moe/@sakurajima </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://floss.social/@kde"> https://floss.social/@kde </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://mastodon.social/@gamingonlinux"> https://mastodon.social/@gamingonlinux </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> </p> <h2 id="bluesky">Bluesky</h2> <div class="follow-card"> <a class="follow-target u-follow-of" href="https://bsky.app/profile/anew.social"> https://bsky.app/profile/anew.social </a> <time class="follow-date dt-published" datetime="2025-12-03T00:00:00Z"> 2025-12-03 </time> </div> <blockquote> <p>Learn more about the <a href="https://indieweb.org">Indieweb</a></p> </blockquote> INIU Power Bank Gets Recall diff --git a/micro.pinapelz.moe/indie/follows/index.html b/micro.pinapelz.moe/indie/follows/index.html index aff031e..27d6677 100644 --- a/micro.pinapelz.moe/indie/follows/index.html +++ b/micro.pinapelz.moe/indie/follows/index.html @@ -101,19 +101,6 @@ - - - - -