initial commit
Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
commit
d9588d6763
1
README.md
Normal file
1
README.md
Normal 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
12
posts/completed.json
Normal 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
12
posts/migration.json
Normal 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
27
update.sh
Executable 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
|
Loading…
x
Reference in New Issue
Block a user