mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-18 08:56:41 +00:00
Add a CalDAV Calendar plugin that syncs tasks with calendar events via the CalDAV/WebDAV protocol, supporting self-hosted servers like Nextcloud. Plugin features: - CalDAV PROPFIND/REPORT for calendar discovery and event fetching - iCal parsing and serialization with RFC 5545 compliance - Two-way sync with field mappings (title, notes, dates, duration) - Time-block integration for auto-creating calendar events - Multi-calendar support with compound IDs Host-side changes: - Add generic request() method to PluginHttp for WebDAV methods - Add allowPrivateNetwork manifest flag (bundled plugins only) - Add dynamic loadOptions support for config field dropdowns - Add backfill effect for existing scheduled tasks - Generify translation keys (LOAD_OPTIONS instead of LOAD_CALENDARS) Security: - SSRF protection via origin validation in resolveHref - allowPrivateNetwork gated by _isPluginBundled check - XML parse error detection in CalDAV response parsing - Description rendered as plain text (not markdown) Correctness: - TZID conversion uses formatToParts (no local timezone contamination) - modifyICalEvent scoped to VEVENT block (preserves VTIMEZONE) - responseType: 'text' on all CalDAV PUT/DELETE calls - CR characters handled in iCal text escaping - Trailing CRLF added to modifyICalEvent output per RFC 5545
54 lines
1.3 KiB
JavaScript
54 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { build } = require('esbuild');
|
|
|
|
const ROOT_DIR = path.join(__dirname, '..');
|
|
const SRC_DIR = path.join(ROOT_DIR, 'src');
|
|
const DIST_DIR = path.join(ROOT_DIR, 'dist');
|
|
|
|
async function buildPlugin() {
|
|
console.log('Building caldav-calendar-provider...');
|
|
|
|
if (fs.existsSync(DIST_DIR)) {
|
|
fs.rmSync(DIST_DIR, { recursive: true });
|
|
}
|
|
fs.mkdirSync(DIST_DIR);
|
|
|
|
// Build TypeScript to IIFE bundle
|
|
await build({
|
|
entryPoints: [path.join(SRC_DIR, 'plugin.ts')],
|
|
bundle: true,
|
|
outfile: path.join(DIST_DIR, 'plugin.js'),
|
|
platform: 'browser',
|
|
target: 'es2020',
|
|
format: 'iife',
|
|
define: {
|
|
'process.env.NODE_ENV': '"production"',
|
|
},
|
|
logLevel: 'info',
|
|
minify: true,
|
|
sourcemap: false,
|
|
});
|
|
|
|
// Copy manifest.json
|
|
fs.copyFileSync(
|
|
path.join(SRC_DIR, 'manifest.json'),
|
|
path.join(DIST_DIR, 'manifest.json'),
|
|
);
|
|
|
|
// Copy icon.svg if present
|
|
const iconSrc = path.join(ROOT_DIR, 'icon.svg');
|
|
if (fs.existsSync(iconSrc)) {
|
|
fs.copyFileSync(iconSrc, path.join(DIST_DIR, 'icon.svg'));
|
|
console.log('Copied icon.svg');
|
|
}
|
|
|
|
console.log('Build complete!');
|
|
}
|
|
|
|
buildPlugin().catch((err) => {
|
|
console.error('Build failed:', err);
|
|
process.exit(1);
|
|
});
|