Co-Pilot / 辅助式
更新于 24 days ago

bwl-flyer-generator

Bbwl21
0.0k
bwl21/bwl-flyer-generator
76
Agent 评分

💡 摘要

该项目提供了一个用于创建ChurchTools扩展的模板管理功能的基础框架。

🎯 适合人群

希望自定义ChurchTools体验的教会管理员。为ChurchTools构建扩展的开发者。需要管理教会活动模板的设计师。与ChurchTools集成的技术团队。

🤖 AI 吐槽:看起来很能打,但别让配置把人劝退。

安全分析中风险

风险:Medium。建议检查:是否执行 shell/命令行指令;是否发起外网请求(SSRF/数据外发);文件读写范围与路径穿越风险;依赖锁定与供应链风险。以最小权限运行,并在生产环境启用前审计代码与依赖。

ChurchTools Extension Boilerplate

This project provides a boilerplate for building your own extension for ChurchTools.

Getting Started

Prerequisites

  • Node.js (version compatible with the project)
  • npm or yarn

Installation

  1. Clone the repository
  2. Install dependencies:
    npm install

Optional: Using Dev Container

This project includes a dev container configuration. If you use VS Code with the "Dev Containers" extension, you can:

  1. Clone the repository
  2. Open it in VS Code
  3. Click the Remote Indicator in the bottom-left corner of VS Code status bar
  4. Select "Reopen in Container"

The container includes the tools mentioned in the prerequisites pre-installed and also runs npm install on startup.

Configuration

Copy .env-example to .env and fill in your data.

In the .env file, configure the necessary constants for your project. This file is included in .gitignore to prevent sensitive data from being committed to version control.

Development and Deployment

Development Server

Start a development server with hot-reload:

npm run dev

Note: For local development, make sure to configure CORS in your ChurchTools instance to allow requests from your local development server (typically http://localhost:5173). This can be done in the ChurchTools admin settings under: "System Settings" > "Integrations" > "API" > "Cross-Origin Resource Sharing"

If login works in Chrome but not in Safari, the issue is usually that Safari has stricter cookie handling:

  • Safari blocks Secure; SameSite=None cookies on http://localhost (Chrome allows them in dev).
  • Safari also blocks cookies if the API is on another domain (third‑party cookies).

Fix:

  1. Use a Vite proxy so API calls go through your local server (/api → https://xyz.church.tools). This makes cookies look first‑party.
  2. Run your dev server with HTTPS. You can generate a local trusted certificate with mkcert.

With proxy + HTTPS, Safari will accept and store cookies just like Chrome.

Building for Production

To create a production build:

npm run build

Preview Production Build

To preview the production build locally:

npm run preview

Deployment

To build and package your extension for deployment:

npm run deploy

This command will:

  1. Build the project
  2. Package it using the scripts/package.js script

You can find the package in the releases directory.

Features

Template Administration

The extension includes a template administration interface accessible via the "Admin – Vorlagen" tab. This allows you to:

  • Edit Templates: Use the integrated pdfme Designer to modify template layouts
  • Template Synchronization: Keep template properties consistent across different formats
  • Import/Export: Share template sets as ZIP files with automatic timestamping

Template Synchronization

The sync feature helps maintain consistency across multiple template formats (A5 portrait, A5 landscape, etc.):

  1. Select Main Template: Choose which template serves as the source of truth
  2. View Differences: See property differences between templates (colors, alignment, etc.)
  3. Sync Properties: Apply properties from the main template to all other templates

The sync panel shows:

  • Number of differences per template
  • Detailed diff view showing which properties differ
  • One-click sync to apply changes

Properties that can be synced include:

  • fontColor - Text color
  • color - Background/border color
  • alignment - Text alignment
  • type - Field type
  • borderWidth - Border width

Important: When you sync templates, missing fields from the main template are automatically added to other templates. This ensures all templates have the same fields.

Template Persistence

All template changes are automatically saved to browser localStorage:

  • Custom Badge: Shows when using modified templates
  • Default Badge: Shows when using original templates
  • Reset Button: Appears when using custom templates, allows reverting to defaults
  • Automatic Save: Changes are saved when:
    • Editing a template in the Designer
    • Synchronizing templates
    • Uploading a template set

The Flyer Generator automatically uses your custom templates if available, falling back to defaults otherwise.

Appointment Mapping

Each template can have its own mapping configuration to automatically fill form fields from ChurchTools appointments:

Configure Mapping:

  1. Go to Admin → Vorlagen
  2. Click "Mapping" button for a template
  3. Map appointment fields to template fields:
    • title → Titel
    • datetime → Datum + Uhrzeit (formatted)
    • description → Beschreibung
    • address → Adresse (komplett)
    • link → Link
    • And many more...
  4. Click "Speichern"

Use Mapping:

  1. In Flyer Generator, click "📅 Termin laden"
  2. Search and select an appointment
  3. Form fields are automatically filled based on mapping
  4. Adjust data if needed and generate PDFs

The mapping is stored with the template in localStorage and persists across sessions.

Import/Export Template Sets

Export (Download):

  • Click "ZIP herunterladen" to export all current templates
  • Filename format: {name}-{custom/standard}-{date}.zip
  • Example: default-church-flyers-custom-2025-12-29.zip
  • Contains: manifest.json + individual template JSON files

Import (Upload):

  • Click "ZIP hochladen" to import a template set
  • Automatically saves to localStorage
  • Replaces all current templates
  • Supports both manifest-based and individual JSON files

Reset:

  • "Zurücksetzen" button appears when using custom templates
  • Clears localStorage and restores factory defaults

API

Following endpoints are available. Permissions are possible per route. Types are documented in ct-types.d.ts (CustomModuleCreate, CustomModuleDataCategoryCreate, CustomModuleDataValueCreate)

GET /custommodules get all extensions
GET /custommodules/{extensionkey} get an extensions by its key
GET /custommodules/{moduleId} get an extension by its ID

GET /custommodules/{moduleId}/customdatacategories
POST /custommodules/{moduleId}/customdatacategories
PUT /custommodules/{moduleId}/customdatacategories/{dataCategoryId}
DELETE /custommodules/{moduleId}/customdatacategories/{dataCategoryId}

GET /custommodules/{moduleId}/customdatacategories/{dataCategoryId}/customdatavalues
POST /custommodules/{moduleId}/customdatacategories/{dataCategoryId}/customdatavalues
PUT /custommodules/{moduleId}/customdatacategories/{dataCategoryId}/customdatavalues/{valueId}
DELETE /custommodules/{moduleId}/customdatacategories/{dataCategoryId}/customdatavalues/{valueId}

Support

For questions about the ChurchTools API, visit the Forum.

五维分析
清晰度8/10
创新性6/10
实用性9/10
完整性8/10
可维护性7/10
优缺点分析

优点

  • 全面的模板管理功能。
  • 支持模板集的导入/导出。
  • 自动将更改保存在localStorage中。

缺点

  • 本地开发需要配置CORS。
  • 对高级功能的文档有限。
  • 依赖ChurchTools API以实现完整功能。

相关技能

pytorch

S
toolCode Lib / 代码库
92/ 100

“它是深度学习的瑞士军刀,但祝你好运能从47种安装方法里找到那个不会搞崩你系统的那一个。”

agno

S
toolCode Lib / 代码库
90/ 100

“它承诺成为智能体领域的Kubernetes,但得看开发者有没有耐心学习又一个编排层。”

nuxt-skills

S
toolCo-Pilot / 辅助式
90/ 100

“这本质上是一份组织良好的小抄,能把你的 AI 助手变成一只 Nuxt 框架的复读机。”

免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。

版权归原作者所有 bwl21.