Better darkmode and chart.js start

This commit is contained in:
krzysztof Płaczek
2026-01-01 10:34:28 +01:00
parent 59c76c8414
commit 1535d450f3
16 changed files with 553 additions and 1685 deletions

26
download_posts.php Normal file → Executable file
View File

@@ -1,9 +1,29 @@
<?php
if (!file_exists('public/posts_2023.json')) {
file_put_contents('public/posts_2023.json', file_get_contents('https://bookmeter.xyz/api/posts?edition=2023'));
file_put_contents('public/posts_2023.json', download_posts('https://bookmeter.xyz/api/posts?edition=2023'));
}
if (!file_exists('public/posts_2024.json')) {
file_put_contents('public/posts_2024.json', file_get_contents('https://bookmeter.xyz/api/posts?edition=2024'));
file_put_contents('public/posts_2024.json', download_posts('https://bookmeter.xyz/api/posts?edition=2024'));
}
if (!file_exists('public/posts_2025.json')) {
file_put_contents('public/posts_2025.json', download_posts('https://bookmeter.xyz/api/posts?edition=2025'));
}
file_put_contents('public/posts_2026.json', download_posts('https://bookmeter.xyz/api/posts?edition=2026'));
if (is_dir('dist')) {
copy('public/posts_2026.json', 'dist/posts_2026.json');
copy('public/posts_2025.json', 'dist/posts_2025.json');
copy('public/posts_2024.json', 'dist/posts_2024.json');
copy('public/posts_2023.json', 'dist/posts_2023.json');
}
function download_posts(string $url): false|string
{
$posts = file_get_contents($url);
$posts = json_decode($posts, true);
array_walk($posts, function (&$item) {
unset($item['image']);
});
return json_encode($posts);
}
file_put_contents('public/posts_2025.json', file_get_contents('https://bookmeter.xyz/api/posts?edition=2025'));