Diff -- /var/www/vhosts/3dshawn.com/site1/TEMPLATES/sync.html

O Operator
Diff

/var/www/vhosts/3dshawn.com/site1/TEMPLATES/sync.html

modified on local at 2026-07-12 00:19:44

Added
+50
lines
Removed
-0
lines
Context
83
unchanged
Blobs
from 3fc563b9cd30
to 79b514fe88af
Restore this content →
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
11<div class="page-head">
22 <span class="page-eyebrow"><span class="dot"></span> Cross-site sync</span>
33 <h1 class="page-title">Sync <code>$basename</code> across sites</h1>
44 <p class="page-subtitle">Fan the source content out to other sites that have a same-basename file with different content. Each target gets its current version backed up to <code>&lt;target&gt;.drift_restore_backup_&lt;epoch&gt;</code> before overwrite. Every write is logged to <code>RESTORE_LOG</code>.</p>
55</div>
66
77[if:$has_error]
88<div class="module glow-rose">
99 <div class="module-body">$error_msg</div>
1010</div>
1111[/if]
1212
1313[if:$has_result]
1414<div class="banner banner-ok" style="margin:0 0 16px;padding:10px 14px;border-radius:10px;background:rgba(52,211,153,.10);border:1px solid rgba(52,211,153,.35);color:#a7f3d0;font-size:13px">
1515 Sync complete: <strong>$ok_ct</strong> succeeded, <strong>$fail_ct</strong> failed. See RESTORE_LOG for per-target detail.
1616</div>
1717[/if]
1818
1919<div class="module glow-teal" style="margin-bottom:16px">
2020 <div class="module-head"><div class="left">
2121 <div class="module-title">Canonical version</div>
2222 <span class="module-subtitle">Source content that will be written to every selected target.</span>
2323 </div></div>
2424 <div class="module-body">
2525 <table class="tbl">
2626 <tbody>
2727 <tr><td style="width:150px"><strong>File</strong></td><td class="mono">$src_file</td></tr>
2828 <tr><td><strong>Site</strong></td><td>$src_scan <span class="dim">on $src_server</span></td></tr>
2929 <tr><td><strong>Blob SHA</strong></td><td class="mono">$src_sha_full</td></tr>
3030 <tr><td><strong>Preview</strong></td><td><a href="$src_diff_url" style="color:var(--accent-hi);text-decoration:none">See diff &rarr;</a></td></tr>
3131 </tbody>
3232 </table>
3333 </div>
3434</div>
3535
3636[if:$has_targets]
37<div style="display:flex;gap:6px;margin-bottom:14px;align-items:center">
38 [if:!$dry_run]<a href="$preview_url" class="tr-chip is-active">Show dry-run diffs &darr;</a>[/if]
39 [if:$dry_run]<a href="$confirm_url" class="tr-chip">Hide diffs</a>[/if]
40 <span style="margin-left:auto;color:var(--text-muted);font-size:11.5px">
41 [if:$dry_run]Live-fetching each target's current content and computing the diff vs source. Slower.[/if]
42 [if:!$dry_run]Quick view. Toggle above to see what will change on each target.[/if]
43 </span>
44</div>
45
3746<form method="post" action="/sync.cgi">
3847 <input type="hidden" name="id" value="$src_id">
3948 <input type="hidden" name="confirm" value="1">
4049
4150 <div class="module glow-amber">
4251 <div class="module-head"><div class="left">
4352 <div class="module-title">$total_targets targets found</div>
4453 <span class="module-subtitle">Same basename, different content. Uncheck any you don't want to sync.</span>
4554 </div></div>
4655 <div class="module-body tight">
56 [if:!$dry_run]
4757 <table class="tbl">
4858 <thead><tr>
4959 <th style="width:50px"><input type="checkbox" onclick="document.querySelectorAll('input[name=targets]').forEach(function(el){el.checked=this.checked}.bind(this))" checked></th>
5060 <th>Target file</th>
5161 <th style="width:150px">Site</th>
5262 <th style="width:110px">Current SHA</th>
5363 </tr></thead>
5464 <tbody>
5565 [loop:@targets]
5666 <tr>
5767 <td><input type="checkbox" name="targets" value="$latest_id" checked></td>
5868 <td class="mono" style="font-size:11.5px"><a href="$diff_url" style="color:var(--accent-hi);text-decoration:none">$file_short</a></td>
5969 <td class="dim">$scan_name <span class="pill $kind_pill" style="font-size:9.5px">$server_kind</span></td>
6070 <td class="mono dim" style="font-size:11.5px">$sha_short</td>
6171 </tr>
6272 [/loop]
6373 </tbody>
6474 </table>
75 [/if]
76
77 [if:$dry_run]
78 <style>
79 .syn-diff { width:100%; border-collapse:collapse; font-family:var(--mono); font-size:11.5px; line-height:1.5; }
80 .syn-diff td { padding:0 8px; vertical-align:top; white-space:pre-wrap; word-wrap:break-word; }
81 .syn-diff .ln { color:var(--text-muted); text-align:right; width:36px; user-select:none; border-right:1px solid var(--border); font-size:10.5px; }
82 .syn-diff tr.op-add td.text { background:rgba(52,211,153,.10); color:#a7f3d0; }
83 .syn-diff tr.op-add td.text::before { content:'+'; color:var(--accent-ok); padding-right:6px; }
84 .syn-diff tr.op-del td.text { background:rgba(244,63,94,.10); color:var(--accent-danger-hi); }
85 .syn-diff tr.op-del td.text::before { content:'-'; color:var(--accent-danger); padding-right:6px; }
86 .syn-diff tr.op-ctx td { color:var(--text-dim); }
87 .syn-diff tr.op-ctx td.text::before { content:' '; padding-right:6px; }
88 .syn-target-block { border-bottom:1px solid var(--border); }
89 .syn-target-block:last-child { border-bottom:0; }
90 </style>
91 [loop:@targets]
92 <div class="syn-target-block" style="padding:14px 16px">
93 <div style="display:flex;align-items:center;gap:10px;margin-bottom:8px">
94 <input type="checkbox" name="targets" value="$latest_id" checked style="transform:scale(1.2)">
95 <strong style="font-family:var(--mono);font-size:12px">$file_short</strong>
96 <span class="pill $kind_pill" style="font-size:9.5px">$server_kind</span>
97 <span class="dim" style="font-size:11px">on $scan_name</span>
98 <span style="margin-left:auto;font-size:11px;color:var(--text-muted)">
99 [if:$has_diff]<span style="color:var(--accent-ok);font-weight:700">+$diff_add</span> / <span style="color:var(--accent-danger);font-weight:700">-$diff_del</span> / <span class="dim">$diff_ctx ctx</span>[/if]
100 [if:!$has_diff]<span class="dim">(diff unavailable)</span>[/if]
101 </span>
102 </div>
103 [if:$has_diff]
104 <div style="max-height:28vh;overflow:auto;background:var(--bg-0);border:1px solid var(--border);border-radius:6px">
105 <table class="syn-diff">
106 <tbody>
107 [loop:@diff_lines]<tr class="op-$op"><td class="ln">$old_n</td><td class="ln">$new_n</td><td class="text">$text</td></tr>[/loop]
108 </tbody>
109 </table>
110 </div>
111 [/if]
112 </div>
113 [/loop]
114 [/if]
65115 </div>
66116 </div>
67117
68118 <div style="display:flex;gap:8px;justify-content:flex-end;margin-top:12px">
69119 <a href="/dashboard.cgi" class="tr-chip">Cancel</a>
70120 <button type="submit" class="tr-chip is-active" style="border:none;padding:8px 22px;background:var(--accent-danger);border-color:var(--accent-danger);color:#fff">
71121 Sync selected targets &rarr;
72122 </button>
73123 </div>
74124</form>
75125[/if]
76126
77127[if:!$has_targets]
78128<div class="module glow-mute">
79129 <div class="module-body">
80130 <p class="dim">No other sites have a file with basename <code>$basename</code> that differs from this source. Nothing to sync.</p>
81131 </div>
82132</div>
83133[/if]