Files
site-builder/craft/scripts/e2e-sitesmith-editor-assets-backend.php
T
shadowdaoandClaude Sonnet 5.5 c6809293c4 sitesmith: show uploaded images in the editor canvas and Preview
Sitesmith writes uploads as assets/<file>, which the editor (panel origin) cannot load.
After the repair + allow-list cleaner, apply now converts every real-upload reference to the
same panel proxy URL the AssetPicker stores (publish rewrites it back to assets/<file>);
canvas summaries sent to the model show assets/<file> again. Covers apply, self-review
patches and regenerate-section. Adds unit, Craft integration and a Chromium+Firefox
browser suite (test:browser:sitesmith-editor-assets) incl. the real PHP publish rewrite.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXgk6UunFCKyXqLe2Cq
2026-11-02 17:43:06 -08:00

18 lines
875 B
PHP

<?php
/**
* Used by scripts/e2e-sitesmith-editor-assets.mjs: reads {html,css} JSON on stdin and prints what the publish handler
* (api/site-builder.php) sends on to generateCompiledHTML: the body and CSS after sb_rewrite_asset_urls(), then the compiled
* document. Usage: php e2e-sitesmith-editor-assets-backend.php <backend repo dir>
*/
ob_start();
define('SB_API_LIBRARY_ONLY', true);
define('AUTH_USER', 'alice');
define('HOME_DIR', '/docker/users/alice');
require rtrim($argv[1], '/') . '/web-files/api/site-builder.php';
ob_end_clean();
$in = json_decode(stream_get_contents(STDIN), true);
$body = sb_rewrite_asset_urls((string)$in['html']);
$css = sb_rewrite_asset_urls((string)$in['css']);
$U = 'https://example.com/';
echo json_encode(['body' => $body, 'doc' => generateCompiledHTML('Home', $css, $body, '', [], '', [], $U, sb_canonical_url($U, 'index.html'))]);