Skip to content

Commit fd637c0

Browse files
fix: use rsync filter rules to correctly include bundled plugins
The previous .distignore used ! negation syntax which only works with .gitignore, not rsync --exclude-from. This caused all plugins to be excluded from release packages, resulting in the Updater deleting them. New .rsync-filter uses proper rsync filter syntax: - + pattern (include) - - pattern (exclude) - Processed in order, first match wins Bundled plugins now correctly included: - open-library - z39-server - api-book-scraper - digital-library - dewey-editor
1 parent a27ab0d commit fd637c0

File tree

5 files changed

+395
-38
lines changed

5 files changed

+395
-38
lines changed

.rsync-filter

Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
# ========================================
2+
# Pinakes - rsync Filter Rules
3+
# Used by build-release.sh to create distribution packages
4+
# CRITICAL: In rsync, INCLUDES must come BEFORE EXCLUDES
5+
# Format: + (include), - (exclude), processed in order
6+
# ========================================
7+
8+
# ========================================
9+
# EXPLICIT INCLUDES (must come first!)
10+
# ========================================
11+
12+
# Keep .env.example
13+
+ .env.example
14+
15+
# Keep README and LICENSE
16+
+ README.md
17+
+ LICENSE.md
18+
19+
# Keep installer SQL files
20+
+ installer/
21+
+ installer/database/
22+
+ installer/database/*.sql
23+
+ installer/database/migrations/
24+
+ installer/database/migrations/*.sql
25+
26+
# Keep storage directory structure and htaccess files
27+
+ storage/
28+
+ storage/.htaccess
29+
+ storage/logs/
30+
+ storage/logs/.gitkeep
31+
+ storage/cache/
32+
+ storage/cache/.gitkeep
33+
+ storage/backups/
34+
+ storage/backups/.gitkeep
35+
+ storage/backups/.htaccess
36+
+ storage/uploads/
37+
+ storage/uploads/.gitkeep
38+
+ storage/uploads/.htaccess
39+
+ storage/uploads/plugins/
40+
+ storage/uploads/plugins/.gitkeep
41+
+ storage/tmp/
42+
+ storage/tmp/.gitkeep
43+
+ storage/calendar/
44+
+ storage/calendar/.gitkeep
45+
+ storage/calendar/.htaccess
46+
47+
# Keep bundled plugins (CRITICAL!)
48+
+ storage/plugins/
49+
+ storage/plugins/.gitkeep
50+
+ storage/plugins/open-library/
51+
+ storage/plugins/open-library/**
52+
+ storage/plugins/z39-server/
53+
+ storage/plugins/z39-server/**
54+
+ storage/plugins/api-book-scraper/
55+
+ storage/plugins/api-book-scraper/**
56+
+ storage/plugins/digital-library/
57+
+ storage/plugins/digital-library/**
58+
+ storage/plugins/dewey-editor/
59+
+ storage/plugins/dewey-editor/**
60+
61+
# Keep public uploads structure
62+
+ public/uploads/
63+
+ public/uploads/.gitkeep
64+
+ public/uploads/copertine/
65+
+ public/uploads/copertine/**
66+
67+
# Keep backups structure
68+
+ backups/
69+
+ backups/.gitkeep
70+
+ backups/.htaccess
71+
72+
# ========================================
73+
# EXCLUDES (come after includes)
74+
# ========================================
75+
76+
# Version control
77+
- .git/
78+
- .gitignore
79+
- .gitattributes
80+
- .gitmodules
81+
82+
# IDE and AI assistant folders
83+
- .gemini/
84+
- .qoder/
85+
- .claude/
86+
- .vscode/
87+
- .idea/
88+
- .cursor/
89+
- CLAUDE.md
90+
- claude.md
91+
- .project
92+
- .buildpath
93+
- .settings/
94+
- *.sublime-*
95+
- *.swp
96+
- *.swo
97+
- *~
98+
99+
# Server & development directories (root level)
100+
- /server/
101+
- /sito/
102+
- /internal/
103+
- /documents/
104+
105+
# Scripts - exclude dev-only files, keep maintenance.php
106+
- scripts/clean-git-history.sh
107+
- scripts/copy-vendor-assets.js
108+
- scripts/export-email-templates-to-installer.php
109+
110+
# Development dependencies
111+
- node_modules/
112+
- /frontend/
113+
- .phpunit.result.cache
114+
- .phpunit.cache/
115+
- tests/
116+
- test/
117+
- coverage/
118+
- .nyc_output/
119+
- .coverage
120+
- htmlcov/
121+
- .playwright-mcp/
122+
123+
# Development files
124+
- *.log
125+
- *.tmp
126+
- *.temp
127+
- *.cache
128+
- .DS_Store
129+
- .DS_Store?
130+
- ._*
131+
- .Spotlight-V100
132+
- .Trashes
133+
- ehthumbs.db
134+
- Thumbs.db
135+
- desktop.ini
136+
- .env
137+
- .env.local
138+
- .env.production
139+
- .installed
140+
- config.local.php
141+
- config.local.sample.php
142+
- internal/
143+
- todo.md
144+
- updater.md
145+
- .distignore
146+
- .rsync-filter
147+
- error_log
148+
- npm-debug.log*
149+
- yarn-debug.log*
150+
- yarn-error.log*
151+
152+
# Temporary scripts
153+
- clean-*.sh
154+
- convert-*.php
155+
- export-*.php
156+
- fix-*.php
157+
- debug_*.php
158+
- test_*.php
159+
- migration-*.php
160+
161+
# Release artifacts
162+
- /releases/
163+
- /build/
164+
- build-tmp/
165+
- /migrations/
166+
167+
# CI/CD & documentation (except README/LICENSE already included)
168+
- .github/
169+
- docs/
170+
- *.md
171+
- .travis.yml
172+
- .circleci/
173+
- azure-pipelines.yml
174+
- .gitlab-ci.yml
175+
176+
# Backup & archive files
177+
- *.bak
178+
- *.backup
179+
- *.old
180+
- *backup*
181+
- backup_*.sql
182+
- old.sql
183+
- *.zip
184+
- *.tar
185+
- *.tar.gz
186+
- *.rar
187+
- *.7z
188+
- Archive.zip
189+
190+
# SQL files (except installer already included)
191+
- *.sql
192+
193+
# Security files
194+
- .htpasswd
195+
- *.pem
196+
- *.key
197+
- *.cert
198+
- *.crt
199+
- *.p12
200+
201+
# Root level directories to exclude
202+
- /backups/*
203+
- /cache/
204+
- /tmp/
205+
- /temp/
206+
207+
# Storage user data (structure already included above)
208+
- storage/logs/*
209+
- storage/cache/*
210+
- storage/backups/*
211+
- storage/tmp/*
212+
- storage/calendar/*
213+
- storage/uploads/*
214+
- storage/settings.json
215+
- storage/*.log
216+
217+
# Exclude non-bundled plugins
218+
- storage/plugins/*
219+
220+
# Public uploads user content
221+
- public/uploads/settings/
222+
- public/uploads/*

app/Routes/web.php

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,39 +2432,31 @@
24322432
->withHeader('Cache-Control', 'public, max-age=3600');
24332433
});
24342434

2435-
// Serve ICS calendar file for external calendar sync
2436-
$app->get('/storage/calendar/library-calendar.ics', function ($request, $response) use ($app) {
2437-
$icsPath = __DIR__ . '/../../storage/calendar/library-calendar.ics';
2438-
2439-
// Generate ICS if it doesn't exist
2440-
if (!file_exists($icsPath)) {
2441-
try {
2442-
$db = $app->getContainer()->get('db');
2443-
$maintenanceService = new \App\Support\MaintenanceService($db);
2444-
$maintenanceService->generateIcsCalendar();
2445-
} catch (\Throwable $e) {
2446-
error_log('ICS generation error: ' . $e->getMessage());
2447-
}
2448-
}
2449-
2450-
// Check if file exists now
2451-
if (!file_exists($icsPath) || !is_file($icsPath)) {
2452-
$response->getBody()->write(__('Calendario non disponibile'));
2453-
return $response->withStatus(404);
2454-
}
2455-
2456-
$content = file_get_contents($icsPath);
2457-
if ($content === false) {
2458-
$response->getBody()->write(__('Errore lettura calendario'));
2435+
// Serve ICS calendar file for external calendar sync (dynamic generation)
2436+
// Supports both legacy path and new clean URL
2437+
$calendarHandler = function ($request, $response) use ($app) {
2438+
try {
2439+
$db = $app->getContainer()->get('db');
2440+
$generator = new \App\Support\IcsGenerator($db);
2441+
$content = $generator->generate();
2442+
2443+
$response->getBody()->write($content);
2444+
return $response
2445+
->withHeader('Content-Type', 'text/calendar; charset=utf-8')
2446+
->withHeader('Content-Disposition', 'inline; filename="library-calendar.ics"')
2447+
->withHeader('Cache-Control', 'public, max-age=300'); // Cache 5 min
2448+
} catch (\Throwable $e) {
2449+
\App\Support\SecureLogger::error('ICS generation error', ['error' => $e->getMessage()]);
2450+
$response->getBody()->write(__('Errore generazione calendario'));
24592451
return $response->withStatus(500);
24602452
}
2453+
};
24612454

2462-
$response->getBody()->write($content);
2463-
return $response
2464-
->withHeader('Content-Type', 'text/calendar; charset=utf-8')
2465-
->withHeader('Content-Disposition', 'attachment; filename="library-calendar.ics"')
2466-
->withHeader('Cache-Control', 'no-cache, must-revalidate');
2467-
});
2455+
// New clean URL (preferred)
2456+
$app->get('/calendar/events.ics', $calendarHandler);
2457+
2458+
// Legacy URL for backward compatibility
2459+
$app->get('/storage/calendar/library-calendar.ics', $calendarHandler);
24682460

24692461
// Public API endpoint for book search (protected by API key)
24702462
$app->get('/api/public/books/search', function ($request, $response) use ($app) {

0 commit comments

Comments
 (0)