Diff -- /var/www/vhosts/3dshawn.com/site1/TEMPLATES/sync.html
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
to 79b514fe88af
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.| 1 | 1 | <div class="page-head"> |
| 2 | 2 | <span class="page-eyebrow"><span class="dot"></span> Cross-site sync</span> |
| 3 | 3 | <h1 class="page-title">Sync <code>$basename</code> across sites</h1> |
| 4 | 4 | <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><target>.drift_restore_backup_<epoch></code> before overwrite. Every write is logged to <code>RESTORE_LOG</code>.</p> |
| 5 | 5 | </div> |
| 6 | 6 | |
| 7 | 7 | [if:$has_error] |
| 8 | 8 | <div class="module glow-rose"> |
| 9 | 9 | <div class="module-body">$error_msg</div> |
| 10 | 10 | </div> |
| 11 | 11 | [/if] |
| 12 | 12 | |
| 13 | 13 | [if:$has_result] |
| 14 | 14 | <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"> |
| 15 | 15 | Sync complete: <strong>$ok_ct</strong> succeeded, <strong>$fail_ct</strong> failed. See RESTORE_LOG for per-target detail. |
| 16 | 16 | </div> |
| 17 | 17 | [/if] |
| 18 | 18 | |
| 19 | 19 | <div class="module glow-teal" style="margin-bottom:16px"> |
| 20 | 20 | <div class="module-head"><div class="left"> |
| 21 | 21 | <div class="module-title">Canonical version</div> |
| 22 | 22 | <span class="module-subtitle">Source content that will be written to every selected target.</span> |
| 23 | 23 | </div></div> |
| 24 | 24 | <div class="module-body"> |
| 25 | 25 | <table class="tbl"> |
| 26 | 26 | <tbody> |
| 27 | 27 | <tr><td style="width:150px"><strong>File</strong></td><td class="mono">$src_file</td></tr> |
| 28 | 28 | <tr><td><strong>Site</strong></td><td>$src_scan <span class="dim">on $src_server</span></td></tr> |
| 29 | 29 | <tr><td><strong>Blob SHA</strong></td><td class="mono">$src_sha_full</td></tr> |
| 30 | 30 | <tr><td><strong>Preview</strong></td><td><a href="$src_diff_url" style="color:var(--accent-hi);text-decoration:none">See diff →</a></td></tr> |
| 31 | 31 | </tbody> |
| 32 | 32 | </table> |
| 33 | 33 | </div> |
| 34 | 34 | </div> |
| 35 | 35 | |
| 36 | 36 | [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 ↓</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 | ||
| 37 | 46 | <form method="post" action="/sync.cgi"> |
| 38 | 47 | <input type="hidden" name="id" value="$src_id"> |
| 39 | 48 | <input type="hidden" name="confirm" value="1"> |
| 40 | 49 | |
| 41 | 50 | <div class="module glow-amber"> |
| 42 | 51 | <div class="module-head"><div class="left"> |
| 43 | 52 | <div class="module-title">$total_targets targets found</div> |
| 44 | 53 | <span class="module-subtitle">Same basename, different content. Uncheck any you don't want to sync.</span> |
| 45 | 54 | </div></div> |
| 46 | 55 | <div class="module-body tight"> |
| 56 | [if:!$dry_run] | |
| 47 | 57 | <table class="tbl"> |
| 48 | 58 | <thead><tr> |
| 49 | 59 | <th style="width:50px"><input type="checkbox" onclick="document.querySelectorAll('input[name=targets]').forEach(function(el){el.checked=this.checked}.bind(this))" checked></th> |
| 50 | 60 | <th>Target file</th> |
| 51 | 61 | <th style="width:150px">Site</th> |
| 52 | 62 | <th style="width:110px">Current SHA</th> |
| 53 | 63 | </tr></thead> |
| 54 | 64 | <tbody> |
| 55 | 65 | [loop:@targets] |
| 56 | 66 | <tr> |
| 57 | 67 | <td><input type="checkbox" name="targets" value="$latest_id" checked></td> |
| 58 | 68 | <td class="mono" style="font-size:11.5px"><a href="$diff_url" style="color:var(--accent-hi);text-decoration:none">$file_short</a></td> |
| 59 | 69 | <td class="dim">$scan_name <span class="pill $kind_pill" style="font-size:9.5px">$server_kind</span></td> |
| 60 | 70 | <td class="mono dim" style="font-size:11.5px">$sha_short</td> |
| 61 | 71 | </tr> |
| 62 | 72 | [/loop] |
| 63 | 73 | </tbody> |
| 64 | 74 | </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] | |
| 65 | 115 | </div> |
| 66 | 116 | </div> |
| 67 | 117 | |
| 68 | 118 | <div style="display:flex;gap:8px;justify-content:flex-end;margin-top:12px"> |
| 69 | 119 | <a href="/dashboard.cgi" class="tr-chip">Cancel</a> |
| 70 | 120 | <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"> |
| 71 | 121 | Sync selected targets → |
| 72 | 122 | </button> |
| 73 | 123 | </div> |
| 74 | 124 | </form> |
| 75 | 125 | [/if] |
| 76 | 126 | |
| 77 | 127 | [if:!$has_targets] |
| 78 | 128 | <div class="module glow-mute"> |
| 79 | 129 | <div class="module-body"> |
| 80 | 130 | <p class="dim">No other sites have a file with basename <code>$basename</code> that differs from this source. Nothing to sync.</p> |
| 81 | 131 | </div> |
| 82 | 132 | </div> |
| 83 | 133 | [/if] |