Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/18/2026 in Posts

  1. Hi @ryan - I mentioned this here: https://github.com/processwire/processwire-issues/issues/2184#issuecomment-3901936805 but I want to make sure it isn't lost. I really think PW needs a $config->cspNonce that gets injected into all core scripts and can be used by all module developers as well. I am doing this in my config.php $config->cspNonce = base64_encode(random_bytes(16)); but if it was in /wire/config.php we could all use it - in modules and template files. Another possibility is maybe have a core method like: function getNonce(): ?string { return preg_match('#^Content-Security-Policy(?:-Report-Only)?:.*\s(?:script-src|script-src-elem)\s+(?:[^;]+\s)?\'nonce-([\w+/]+=*)\'#mi', implode("\n", headers_list()), $m) ? $m[1] : null; } that finds an existing nonce set for either script-src or script-src-elem and use the result of that to add to core scripts (src file and inline). But I don't think PW should set the CSP itself - I think that should be up to us. Please let me know if you have any thoughts or questions - I've been trying to up my game in the CSP area and this would make life a lot easier because at the moment I can't lock down the PW admin without it so I need separate CSP's for frontend and admin.
    2 points
  2. The idea is to have the _main.php be the base for most of your templates and then on a case-by-case basis disable it per template and specify another appended file, e.g. _rss.php. So I would say no need to change anything in config.php πŸ™‚
    1 point
  3. As long as the output formatting is on you can assume your "$page->title" will return a formatted value and so in your case with the entities encoded thanks to the Textformatter. So no need to escape it again using $sanitizer. $sanitizer is mostly here to clean inputs from user-submitted forms or more broadly whenever you have to save external data you don't have control over.
    1 point
  4. If you check the "Disable automatic append of file: _main.php" setting, then you can specify your "base.php" to be appended in place using the field right above
    1 point
  5. No! they would hold the placeholder reference! Something like <script src="{APACHE_SCP_NONCE}"> Then swapped by apache right before delivery.
    1 point
  6. I solved this once for frontend usage using mod_cspnonce, which created the nonces per request right on Apache. This way I was able to keep using ProCache and not having to manage a CSP list in the header. I guess that for ProcessWire admin purposes, hashes implementation could work better? Also there's the caveat of scripts that generate other scripts, like GTM, which need a special implementations: https://developers.google.com/tag-platform/security/guides/csp
    1 point
  7. Export your ProcessWire site structure as comprehensive, AI-optimized documentation for ChatGPT, Claude, Copilot, and other AI coding assistants. What It Does Context automatically generates complete documentation of your ProcessWire site in formats specifically optimized for working with AI: πŸ“Š Site Structure Complete page hierarchy exported as JSON, TOON, and ASCII tree Shows all relationships, templates, URLs, and metadata Smart collapsing for large page lists πŸ“‹ Templates & Fields All template definitions with complete field configurations Field types, options, requirements, default values Special handling for Repeater, Matrix, Table fields πŸ“¦ Content Samples Real page examples exported for each template Shows actual data formats and field usage Helps AI understand your content patterns πŸ’Ύ Code Snippets Customized selector patterns for your site type Helper functions and utility code API implementation examples πŸ€– AI Prompts Ready-to-use project context file Template creation prompts Debugging assistance prompts Dual Format Export (The Game Changer!) Context exports in two formats simultaneously: JSON Format Standard format for development tools, APIs, and compatibility TOON Format (AI-Optimized) ✨ Token-Oriented Object Notation designed specifically for AI prompts: 30-60% fewer tokens than JSON Significantly reduces API costs Same data, more compact representation No external dependencies - pure PHP Real Savings Example For a typical ProcessWire site with 50 templates: structure.json (15,000 tokens) β†’ structure.toon (8,500 tokens) = 43% savings templates.json (8,000 tokens) β†’ templates.toon (4,000 tokens) = 50% savings samples/*.json (12,000 tokens) β†’ samples/*.toon (6,500 tokens) = 46% savings Cost Impact (Claude Sonnet pricing): JSON export: $0.105 per AI interaction TOON export: $0.057 per AI interaction Save ~$5/month if you use AI assistants 100 times/month Installation cd /site/modules/ git clone https://github.com/mxmsmnv/Context.git Then in admin: Modules β†’ Refresh β†’ Install Or download from ProcessWire Modules Directory Quick Start Setup β†’ Modules β†’ Context β†’ Configure Choose your site type (Blog, E-commerce, Business, Catalog, Generic) βœ… Enable "Export TOON Format" (recommended for AI work!) Enable optional features: βœ… Export Content Samples βœ… Create Code Snippets βœ… Create AI Prompts Click "Export Context for AI" Files appear in /site/assets/context/ Generated Files /site/assets/context/ β”œβ”€β”€ README.md # Complete documentation β”œβ”€β”€ structure.json / .toon # Page hierarchy β”œβ”€β”€ structure.txt # ASCII tree β”œβ”€β”€ templates.json / .toon # All templates & fields β”œβ”€β”€ config.json / .toon # Site configuration β”œβ”€β”€ modules.json / .toon # Installed modules β”œβ”€β”€ classes.json / .toon # Custom Page classes β”‚ β”œβ”€β”€ samples/ # Real content examples β”‚ β”œβ”€β”€ product-samples.json β”‚ └── product-samples.toon # 46% smaller! β”‚ β”œβ”€β”€ snippets/ # Code patterns β”‚ β”œβ”€β”€ selectors.php # Customized for your site type β”‚ β”œβ”€β”€ helpers.php # Utility functions β”‚ └── api-examples.php # REST API examples β”‚ └── prompts/ # AI instructions └── project-context.md # Complete project overview Using with AI Assistants Upload TOON files to save tokens and costs: πŸ“Ž structure.toon πŸ“Ž templates.toon πŸ“Ž prompts/project-context.md Then ask your AI assistant: "Help me create a blog post template with title, body, author, categories, and featured image. Follow the existing patterns from templates.toon" The AI has complete context of your site and can generate code that follows your exact patterns! Site Type Customization Code snippets automatically adapt to your site type: Blog / News / Magazine Post listings, author archives, category filtering Recent posts, popular content, related articles E-commerce / Online Store Product listings, cart logic, order processing Inventory management, payment integration Business / Portfolio / Agency Service pages, team members, case studies Testimonials, project galleries Catalog / Directory / Listings Brand hierarchies, category filters Advanced search, sorting, pagination Generic / Mixed Content General purpose patterns for any site type Features Overview Always Exported (Core) βœ… Complete page tree structure βœ… All templates with field definitions βœ… Site configuration and settings βœ… Installed modules list βœ… Custom Page classes βœ… README with complete documentation Optional (Configurable) βš™οΈ Content samples (1-10 per template) βš™οΈ API JSON schemas βš™οΈ URL routing structure βš™οΈ Performance metrics βš™οΈ Code snippets library βš™οΈ AI prompt templates βš™οΈ IDE integration files (.cursorrules, .claudecode.json) Advanced Settings Auto-update on template/field changes Maximum tree depth (3-20 levels) JSON children limit (prevent huge files) Compact mode for large lists Custom AI instructions Why TOON Format? TOON is specifically designed for AI prompts. Here's the difference: JSON (verbose): { "products": [ {"id": 1, "title": "Dark Chocolate", "price": 12.99}, {"id": 2, "title": "Milk Chocolate", "price": 9.99} ] } TOON (compact): products[2]{id,title,price}: 1,Dark Chocolate,12.99 2,Milk Chocolate,9.99 Same data, 50% fewer tokens! Use Cases πŸ€– AI-Assisted Development Upload your site context to Claude/ChatGPT and get code that follows your exact patterns πŸ“š Developer Onboarding New team members get complete site documentation instantly πŸ”„ Site Migration Export complete site structure for documentation or migration planning πŸ“– Code Standards Maintain consistency across your team with AI that knows your patterns πŸ’° Cost Optimization Reduce AI API costs by 30-60% with TOON format Links GitHub: https://github.com/mxmsmnv/Context TOON Format Spec: https://toonformat.dev Screenshots Example Workflow Export your site Click one button, get complete documentation in both JSON and TOON formats Upload to AI Upload .toon files to Claude/ChatGPT for maximum efficiency Build features faster AI knows your exact site structure, templates, and patterns Save money Use 30-60% fewer tokens on every AI interaction Perfect for ProcessWire developers who use AI coding assistants! The TOON format support makes it significantly more cost-effective to work with Claude, ChatGPT, and similar tools. Questions? Suggestions? Let me know! πŸš€
    1 point
  8. https://github.com/mxmsmnv/Context/commit/1d94aaaf87869b869aff5ec9f7d1f1dea5872437 Adding support .toon files @Peter Knight you may try
    1 point
  9. PromptAI v2.3 β€” Inline Mode, Streaming, Placeholders, and more Hi everyone, It's been a while since the last update for PromptAI, and quite a lot has changed. Here's a summary of what's new since the last public release. Inline Mode The biggest addition is a new Inline Mode that adds magic wand buttons directly next to your fields. Instead of the "Save + Send to AI" workflow, you can now trigger AI processing on individual fields without saving the page first. The response streams in live and replaces the field content β€” but nothing is saved until you hit Save. Both modes (Page Mode and Inline Mode) can be mixed freely in the same configuration. Each prompt is configured as either "page" or "inline". Inline mode works with all supported field types: text fields, TinyMCE/CKEditor fields, image descriptions, file descriptions, and custom subfields β€” including inside repeaters. Streaming Responses AI responses now stream in real-time via Server-Sent Events (SSE). You can watch the text appear token by token instead of waiting for the full response. This obviously only works in inline mode. Placeholder Support Prompts can now reference other field values from the page using `{page.fieldname}` syntax. Inside repeaters, use `{item.fieldname}` to access the current repeater item's fields. Examples: - Summarize the following text to 400 characters: {page.body} - Create an SEO meta description for a page titled '{page.title}' - Write a caption for this gallery item titled '{item.title}' from the {page.gallery_name} collection This makes prompts context-aware without having to send field content manually. Multi-Field Selection Instead of configuring a single source field per prompt, you can now select multiple fields. The same prompt will be applied to each selected field. This replaces the old source/target field concept β€” the "target" is now only used for subfield options in file/image fields. AI Tools (experimental) The module now ships with three experimental tools that allow the AI to query your ProcessWire installation: - getPages β€” find pages by selector - getPage β€” get detailed info about a single page - getFields β€” list available templates and their fields These are disabled by default and must be enabled in module configuration. They're meant as starting points β€” their usefulness depends heavily on your use case and I recommend to create your own for each projects specific demand. Other Changes - PHP 8.3 is now required to use this module Important: Backup Before Updating The internal configuration structure has changed significantly. The old `sourceField`/`targetField` concept has been replaced with a multi-field `fields` array and a separate `targetSubfield` option. There is no automatic migration for this change. I'm sorry for the inconvenience β€” the old structure simply didn't support the new features. I attached two short screen videos showing the prompt config screen with example prompts and one page edit screen where I showcase some of the predefined prompts. As always, feedback and bug reports are welcome β€” either here or on GitHub. promptai-showcase.mp4 promptai-config.mp4
    1 point
  10. Hey folks, fun fact: this module was already featured in this week’s ProcessWire Weekly – even before we managed to post it here in the forum. So, here we are, finally giving it a proper introduction! πŸ˜… TL;DR: This module connects Stripe Payment Links with ProcessWire and provides a simple checkout integration for sites that don’t need a full shop. 🎯 βœ… Drop a Stripe buy button anywhere βœ… Redirect back to PW thank-you or delivery pages βœ… Buyers get accounts, purchases are logged, access is granted βœ… Access mails are sent automatically ✴️ New in v 1.0.7: Sync existing purchases and buyers from Stripe to PW with test/write option ✴️ New in v 1.0.8: Full Stripe subscription support with real-time webhook updates (cancel, pause, resume, renew) and smarter access control logic ✴️ New in v 1.0.14: Create and send "Magic Links" (access links) to customers for products they've already purchased. First things first: What are Stripe Payment Links? Stripe Payment Links are basically hosted checkout pages that you can create directly in the Stripe Dashboard – no coding required. You define a product (or multiple line items) in Stripe. Stripe gives you a unique URL (the β€œPayment Link”). You can drop this URL behind any button, on any landing page, newsletter, or social media bio. When a customer clicks the link, they’re taken to a secure Stripe Checkout page (PCI compliant, supports all major payment methods, Apple Pay, etc.). After payment, Stripe redirects them back to your success URL. Super simple. But… on its own, Stripe has no idea about your ProcessWire site, your users, or your gated content. That’s where this module jumps in. πŸš€ Why another payment module? We at frameless Media often work on small client projects where setting up a full e-commerce shop would be complete overkill. Think: Coaches selling a few courses or workshops Businesses offering a handful of digital products or subscriptions Creators who just need a buy button on a landing page Stripe Payment Links are perfect for this. But: ProcessWire on its own doesn’t handle redirects, user handling, or gated delivery pages. So we built StripePaymentLinks – a lightweight drop-in module to connect Stripe with PW. What it does Handles the redirect back from Stripe Checkout that contains the session id Creates or updates the buyer’s user account Records purchases in a repeater field Manages access to β€œdelivery pages” (only available after purchase) Auto-sends access mails (configurable: never / new users only / always) Provides Bootstrap-based modals for login, password reset, set-password Usage examples Example 1: Sales page + delivery page Sales page has a β€œBuy now” button (Stripe Payment Link). After checkout, the user is redirected to the delivery page, which is access-protected. β†’ Module logs them in, grants access, and if they’re new: a set-password modal pops up. β†’ An access mail with product links is sent. Example 2: Product without a delivery page Some products don’t need protected pages (e.g. a consulting slot or voucher). β†’ The success redirect goes to a generic thank-you page. β†’ The module shows an access summary block with purchased products and sends the mail. Example 3: Mixed purchase (thank-you + delivery page) A checkout with multiple items: e.g. a β€œsimple product” plus an addon that has its own delivery page. β†’ Thank-you page shows the addon link(s). β†’ The access mail lists all purchased products. Source & License The module is open-source under the MIT License. πŸ‘‰ GitHub: https://github.com/frameless-at/StripePaymentLinks πŸ‘‰ ProcessWire modules directory: https://processwire.com/modules/stripe-payment-links/ So yes: if you or your clients just need a few low-barrier buy buttons, not a full-blown webshop, this might be the module you’ve been looking for. If needed we can provide some screenshots and visual examples next week πŸ˜‰ Happy to hear your thoughts, ideas, and testing feedback! Cheers, Mike
    1 point
  11. LogMaintenance A simple ProcessWire module to give some maintenance control over log files. I found myself often having lots of log files for different things that can grow more or less quickly to a size where they can be difficult to maintain. The built in Logger of PW does a good job of giving you the possibility to delete or prune logs. But it has to be done manually and sometimes a log grows into millions of lines, which makes it often impossible to even prune it as it's too large. LogMaintenance uses LazyCron to run the maintenance task and there's several settings you can setup on a global or per log basis. Archive: will create zip files for each log file in logs/archive/ folder and add the log each time the maintenance is run to a subfolder containing the datetime. Lines: keeps logs to a certain number of lines Days: keeps the log to a certain number of days Bytes: keeps the log to a certain amount of bytes Each setting is checked from top down, the first setting to contain something is used. So if you check the "Archive" option, all other settings are ignored and logs are archived everytime the LazyCron is executed. If you want to keep your logs to a certain amount of bytes just leave all other settings to 0 or blank. Per Log Settings There's a textarea that you can use to setup a config for a specific log file one per line. All the logs you define here ignore the global settings above. The syntax for the settings is: logname:[archive]:[lines]:[days]:[bytes] errors:1:0:0:0 // would archive the errors log messages:0:10000:0:0 // will prune the errors log to 10000 lines The module can be found on github for you to check out. It's still fresh and I'm currently testing. https://github.com/somatonic/LogMaintenance
    1 point
Γ—
Γ—
  • Create New...