initial commit

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn 2025-01-22 11:14:46 +03:00
commit d9588d6763
Signed by: ngn
GPG Key ID: A3654DF5AD9F641D
4 changed files with 52 additions and 0 deletions

1
README.md Normal file
View File

@ -0,0 +1 @@
This repository contains the news posts for [my website's atom feeed](https://api.ngn.tf/v1/news/en).

12
posts/completed.json Normal file
View File

@ -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."
}
}

12
posts/migration.json Normal file
View File

@ -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."
}
}

27
update.sh Executable file
View File

@ -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 "<title>${post_title}</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