From da2ef95f8390baa2f4e3a4bd0e2049885133093a Mon Sep 17 00:00:00 2001 From: octospacc Date: Sun, 26 Jan 2025 01:44:39 +0100 Subject: [PATCH] Auto-Backup $'Sun Jan 26 2025 01:06:41 GMT+0100 (Central European Standard Time)' --- .../Root/Main/Server/Scripts/BackupAll.zx.mjs | 39 ++++++++++++++++++- Server/Root/etc/nginx/nginx.conf | 2 + .../etc/nginx/sites-available/WinDog.conf | 2 +- .../Root/etc/nginx/sites-available/kirby.conf | 26 +++++++++++++ .../etc/nginx/sites-available/proxatore.conf | 25 ++++++++++++ .../Root/etc/nginx/sites-available/root.conf | 33 +++------------- .../systemd/system/FreshRSS-actualize.timer | 2 +- 7 files changed, 98 insertions(+), 31 deletions(-) create mode 100644 Server/Root/etc/nginx/sites-available/kirby.conf create mode 100644 Server/Root/etc/nginx/sites-available/proxatore.conf diff --git a/Server/Root/Main/Server/Scripts/BackupAll.zx.mjs b/Server/Root/Main/Server/Scripts/BackupAll.zx.mjs index 9b89406..b25c1d2 100755 --- a/Server/Root/Main/Server/Scripts/BackupAll.zx.mjs +++ b/Server/Root/Main/Server/Scripts/BackupAll.zx.mjs @@ -145,7 +145,8 @@ Jobs.Cloud_Doku = async () => { await GitPullPush(); }; -Jobs.Cloud_Memos = async () => { +// NOTE: embedded media is not handled (neither included nor downloaded) +Jobs.archivioctt_Memos = async () => { EnsureFolder('./archivioctt-Git/docs/memos'); await $`rm -f * || true`; await stream.Readable.fromWeb((await fetch('https://memos.octt.eu.org/memos.api.v1.MemoService/ExportMemos', { @@ -162,6 +163,34 @@ Jobs.Cloud_Memos = async () => { await GitPullPush(); }; +// NOTE: post tags, post location, and media license are not handled; media is not redownloaded +Jobs.archivioctt_Pixelfed = async () => { + EnsureFolder('./archivioctt-Git/docs/pictures/posts'); + const allPosts = []; + for (const identity of ["liminalgici.spacc.eu.org:664033260845064193"]) { + let offset = ''; + const [instance, account] = identity.split(':'); + while (true) { + const posts = (await (await fetch(`https://${instance}/api/pixelfed/v1/accounts/${account}/statuses?only_media=true&max_id=${offset}`)).json()); + if (posts.length > 0) { + offset = posts.slice(-1)[0].id; + allPosts.push(...posts); + } else { + break; + } + } + } + for (const post of allPosts) { + fs.writeFileSync(`${post.id}.md`, `--- +canonical_url: ${post.url} +date: ${post.created_at} +tags: ${post.tags.map(tag => `\n - ${tag.name}`).join('')} +--- +\n${post.content.replaceAll('
', '')} +\n${post.media_attachments.map(media => `![${media.description}](${media.url})`).join('\n\n')}`); + } +}; + Jobs.Mixed_OctospaccAltervista = async () => { await AltervistaFullBackup('octospacc.altervista.org'); cd('../microblog-mirror'); @@ -280,9 +309,15 @@ const Main = async () => { await Work('Cloud_SpaccBBSNodeBB'); await Work('Cloud_liminalgici'); await Work('Cloud_Doku'); - await Work('Cloud_Memos'); await Work('Cloud_SpaccCraft'); await Work('Cloud_Private'); + + //await Work('archivioctt_Memos'); + //await Work('archivioctt_Pixelfed'); + //await Work('archivioctt_WordPress'); + // POST https://public-api.wordpress.com/rest/v1.1/sites/SITEID/exports/start + // GET https://public-api.wordpress.com/rest/v1.1/sites/SITEID/exports/0? + // ... {status:"running"} ... {status:"finished","attachment_url":"...zip"} }; //////////////////////////////////////////////////////////////////////////////// diff --git a/Server/Root/etc/nginx/nginx.conf b/Server/Root/etc/nginx/nginx.conf index 9b2a0e1..90f26b3 100644 --- a/Server/Root/etc/nginx/nginx.conf +++ b/Server/Root/etc/nginx/nginx.conf @@ -17,6 +17,8 @@ http { ## # Basic Settings ## + fastcgi_buffers 16 16k; + fastcgi_buffer_size 32k; sendfile on; tcp_nopush on; diff --git a/Server/Root/etc/nginx/sites-available/WinDog.conf b/Server/Root/etc/nginx/sites-available/WinDog.conf index 3d425ae..25974ed 100644 --- a/Server/Root/etc/nginx/sites-available/WinDog.conf +++ b/Server/Root/etc/nginx/sites-available/WinDog.conf @@ -10,7 +10,7 @@ server { location / { proxy_http_version 1.1; proxy_buffering off; - proxy_pass http://localhost:30264; + proxy_pass http://127.0.0.1:30264; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; diff --git a/Server/Root/etc/nginx/sites-available/kirby.conf b/Server/Root/etc/nginx/sites-available/kirby.conf new file mode 100644 index 0000000..253d403 --- /dev/null +++ b/Server/Root/etc/nginx/sites-available/kirby.conf @@ -0,0 +1,26 @@ +server { + listen 80; + index index.php index.html; + server_name test.octt.eu.org; + root /Main/Server/www/kirby; + + default_type text/plain; + add_header X-Content-Type-Options nosniff; + + rewrite ^/(content|site|kirby)/(.*)$ /error last; + rewrite ^/\.(?!well-known/) /error last; + rewrite ^/(?!app\.webmanifest)[^/]+$ /index.php last; + + location / { + try_files $uri $uri/ /index.php$is_args$args; + } + + location ~* \.php$ { + try_files $uri =404; + fastcgi_pass php; + include fastcgi.conf; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SERVER_PORT 80; + } +} diff --git a/Server/Root/etc/nginx/sites-available/proxatore.conf b/Server/Root/etc/nginx/sites-available/proxatore.conf new file mode 100644 index 0000000..2f7022b --- /dev/null +++ b/Server/Root/etc/nginx/sites-available/proxatore.conf @@ -0,0 +1,25 @@ +server { + listen 80; + listen 443 ssl; + server_name proxatore.octt.eu.org; + ssl_certificate /etc/letsencrypt/live/proxatore.octt.eu.org/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/proxatore.octt.eu.org/privkey.pem; + ssl_prefer_server_ciphers on; + + root /Main/Server/www/root; + + location / { + include fastcgi_params; + fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; # Adjust PHP version and socket path as needed + fastcgi_index Proxatore.php; + fastcgi_param SCRIPT_FILENAME $document_root/Proxatore.php; + } + + access_log /var/log/nginx/proxatore.access.log; + error_log /var/log/nginx/proxatore.error.log; + + # Optional: Restrict file access + location ~ /\.(?!well-known).* { + deny all; + } +} diff --git a/Server/Root/etc/nginx/sites-available/root.conf b/Server/Root/etc/nginx/sites-available/root.conf index 116f71e..6d677fc 100644 --- a/Server/Root/etc/nginx/sites-available/root.conf +++ b/Server/Root/etc/nginx/sites-available/root.conf @@ -8,32 +8,6 @@ server { rewrite ^ $scheme://hlb0.octt.eu.org$request_uri? permanent; } -server { - listen 80; - listen 81; - error_page 403 = /error.php?code=403; - error_page 404 = /error.php?code=404; - error_page 500 = /error.php?code=500; - access_log /var/log/nginx/root.access.log; - error_log /var/log/nginx/root.error.log; - location / { - root /Main/Server/www/root; - if ($request_uri ~ ^([^.\?]*[^/])$) { - return 301 $1/; - } - try_files $uri $uri/ $uri.html =404; - autoindex off; - location ~ ^.+?\.php(/.*)?$ { - fastcgi_pass php; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - set $path_info $fastcgi_path_info; - fastcgi_param PATH_INFO $path_info; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - } - } -} - server { listen 80; listen 81; @@ -56,7 +30,7 @@ server { if ($request_uri ~ ^([^.\?]*[^/])$) { return 301 $1/; } - try_files $uri $uri/ $uri.html =404; + try_files $uri $uri/ $uri.html $uri.json =404; autoindex off; #error_page 404 = /404.html; #rewrite ^/(\?.*)?$ index.html$1 permanent; @@ -70,6 +44,11 @@ server { } } + #location /api/v1/oembed/ { + # proxy_pass http://127.0.0.1:8061/oembed$is_args$args; + # sub_filter '"type":"link",' '"type":"rich","html":"

test 123

",'; + #} + location /Drive/ { root /Main/Server/www; autoindex on; diff --git a/Server/Root/etc/systemd/system/FreshRSS-actualize.timer b/Server/Root/etc/systemd/system/FreshRSS-actualize.timer index a95a9cd..151f916 100644 --- a/Server/Root/etc/systemd/system/FreshRSS-actualize.timer +++ b/Server/Root/etc/systemd/system/FreshRSS-actualize.timer @@ -3,7 +3,7 @@ Description=FreshRSS get new content [Timer] OnBootSec=30s -OnCalendar=*:0/20 +OnCalendar=*:0/10 [Install] WantedBy=timers.target