commit d9588d676304b073bd695cb67b1585e98be112d5 Author: ngn Date: Wed Jan 22 11:14:46 2025 +0300 initial commit Signed-off-by: ngn diff --git a/README.md b/README.md new file mode 100644 index 0000000..5a8ef06 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +This repository contains the news posts for [my website's atom feeed](https://api.ngn.tf/v1/news/en). diff --git a/posts/completed.json b/posts/completed.json new file mode 100644 index 0000000..3e68aa4 --- /dev/null +++ b/posts/completed.json @@ -0,0 +1,12 @@ +{ + "id": "completed", + "title": { + "en": "Server migration completed", + "tr": "Sunucu taşıması tamamlandı" + }, + "author": "ngn", + "content": { + "en": "I migrated all the services to my new server. I also updated the onion URLs.", + "tr": "Tüm servisleri yeni sunucuma taşıdım. Onion URL'lerini de güncelledim." + } +} diff --git a/posts/migration.json b/posts/migration.json new file mode 100644 index 0000000..523327a --- /dev/null +++ b/posts/migration.json @@ -0,0 +1,12 @@ +{ + "id": "migration", + "title": { + "en": "Ongoing server migration", + "tr": "Devam eden sunucu taşıması" + }, + "author": "ngn", + "content": { + "en": "I'm currently in the process of moving all the services to my new server, so some of the services are not listed as of now. I'll post another update when I'm done.", + "tr": "Şuan tüm servisleri yeni sunucuma taşıma işlemi sırasındayım, bu yüzden bazı servisler şuan için listelenmiyor. İşim bitince bir güncelleme daha yayınlayacağım." + } +} diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..a52c678 --- /dev/null +++ b/update.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +curl 'https://api.ngn.tf/v1/news/en' --silent -o feed.atom + +if [ $? -ne 0 ]; then + echo "failed to get the feed" + exit 1 +fi + +for p in posts/*; do + post_title="$(jq -r .title.en "${p}")" + + if grep "${post_title}" feed.atom &> /dev/null; then + echo "${p} is already posted, skipping" + continue + fi + + echo "posting ${p}" + admin_script add_news "${p}" + + if [ $? -ne 0 ]; then + echo "failed to post ${p}" + break + fi +done + +rm -f feed.atom