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

O Operator
Diff

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

modified on local at 2026-07-12 00:02:05

Added
+30
lines
Removed
-0
lines
Context
116
unchanged
Blobs
from 20c09ee2a28d
to 10cf73c63f2d
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> Restore</span>
33 <h1 class="page-title">Restore file to captured state</h1>
44 <p class="page-subtitle">Every captured change carries its SHA-256-addressed content in BLOB_STORE. Restoring writes that content back to the original path &mdash; current file gets backed up to <code>&lt;path&gt;.drift_restore_backup_&lt;epoch&gt;</code> before overwrite.</p>
55</div>
66
77[if:$has_error]
88<div class="module glow-rose">
99 <div class="module-head"><div class="left">
1010 <div class="module-title">Cannot proceed</div>
1111 <span class="module-subtitle">Restore rejected on safety grounds.</span>
1212 </div></div>
1313 <div class="module-body" style="color:var(--accent-danger-hi)">
1414 $error_msg
1515 </div>
1616</div>
1717[/if]
1818
1919[if:$did_restore]
2020 [if:$result_ok]
2121 <div class="module glow-emerald">
2222 <div class="module-head"><div class="left">
2323 <div class="module-icon"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg></div>
2424 <div class="module-title">Restore succeeded</div>
2525 <span class="module-subtitle">Content at <code>$target_file</code> now matches captured SHA <code>$source_sha</code>. Prior content is safe in the backup file.</span>
2626 </div></div>
2727 <div class="module-body">
2828 <table class="tbl">
2929 <tbody>
3030 <tr><td style="width:200px"><strong>Target</strong></td><td class="mono">$target_file</td></tr>
3131 <tr><td><strong>Server</strong></td><td class="mono">$server_name (<span class="dim">$server_kind</span>)</td></tr>
3232 <tr><td><strong>Restored content SHA</strong></td><td class="mono">$source_sha</td></tr>
3333 <tr><td><strong>Captured at</strong></td><td class="mono dim"><span class="ts" data-ts="$captured_epoch" data-fmt="datetime">$captured_h</span></td></tr>
3434 <tr><td><strong>Backup file</strong></td><td class="mono dim">[if:$backup_path]$backup_path[/if][if:!$backup_path](no prior content to back up)[/if]</td></tr>
3535 <tr><td><strong>Result</strong></td><td>$result_msg</td></tr>
3636 </tbody>
3737 </table>
3838 <div style="margin-top:14px">
3939 <a href="/file_changes.cgi" class="tr-chip">Back to file changes</a>
4040 <a href="/diff.cgi?kind=file&id=$id" class="tr-chip">See diff</a>
4141 </div>
4242 </div>
4343 </div>
4444 [/if]
4545 [if:!$result_ok]
4646 <div class="module glow-rose">
4747 <div class="module-head"><div class="left">
4848 <div class="module-title">Restore failed</div>
4949 <span class="module-subtitle">See RESTORE_LOG for full audit trail.</span>
5050 </div></div>
5151 <div class="module-body">
5252 <p style="color:var(--accent-danger-hi)">$result_msg</p>
5353 <p class="dim" style="font-size:12.5px;margin-top:8px">Backup path: <code>$backup_path</code></p>
5454 </div>
5555 </div>
5656 [/if]
5757[/if]
5858
5959[if:!$did_restore][if:!$has_error]
6060<div class="dash-grid" style="grid-template-columns:1fr 1fr">
6161 <div class="module glow-teal">
6262 <div class="module-head"><div class="left">
6363 <div class="module-title">What will change</div>
6464 <span class="module-subtitle">Preview -- nothing has been written yet.</span>
6565 </div></div>
6666 <div class="module-body">
6767 <table class="tbl">
6868 <tbody>
6969 <tr><td style="width:170px"><strong>Target file</strong></td><td class="mono">$target_file</td></tr>
7070 <tr><td><strong>Site</strong></td><td>$scan_name <span class="dim">on $server_name</span></td></tr>
7171 <tr><td><strong>Kind</strong></td><td>$server_kind</td></tr>
7272 <tr><td><strong>Captured at</strong></td><td class="mono dim"><span class="ts" data-ts="$captured_epoch" data-fmt="datetime">$captured_h</span></td></tr>
7373 <tr><td><strong>Captured SHA</strong></td><td class="mono">$source_sha_full</td></tr>
7474 </tbody>
7575 </table>
7676 </div>
7777 </div>
7878 <div class="module glow-amber">
7979 <div class="module-head"><div class="left">
8080 <div class="module-title">Current state on disk</div>
8181 <span class="module-subtitle">Live check just now. If SHAs match, the restore is a no-op.</span>
8282 </div></div>
8383 <div class="module-body">
8484 <table class="tbl">
8585 <tbody>
8686 <tr><td style="width:170px"><strong>File present</strong></td><td>[if:$current_exists]<span class="pill pill-ok">yes</span>[/if][if:!$current_exists]<span class="pill pill-mute">no (new file)</span>[/if]</td></tr>
8787 <tr><td><strong>Size</strong></td><td class="mono dim">$current_size</td></tr>
8888 <tr><td><strong>Current SHA</strong></td><td class="mono">$current_sha</td></tr>
8989 <tr><td><strong>Same as captured?</strong></td><td>[if:$same_content]<span class="pill pill-ok">yes -- no-op</span>[/if][if:!$same_content]<span class="pill pill-warn">no -- restore will change it</span>[/if]</td></tr>
9090 </tbody>
9191 </table>
9292 <div style="margin-top:14px">
9393 <a href="$diff_url" class="tr-chip">See exactly what's different &rarr;</a>
9494 </div>
95 </div>
96 </div>
97</div>
98
99[if:$has_live_diff]
100<div class="module glow-teal" style="margin-top:20px">
101 <div class="module-head"><div class="left">
102 <div class="module-icon"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2"><polyline points="8 3 4 7 8 11"/><polyline points="16 21 20 17 16 13"/><line x1="4" y1="7" x2="20" y2="7"/><line x1="4" y1="17" x2="20" y2="17"/></svg></div>
103 <div class="module-title">What restore will change &mdash; live diff</div>
104 <span class="module-subtitle">Left column shows current on-disk content; right shows what restore will write. <strong>+$diff_add</strong> additions, <strong>-$diff_del</strong> deletions, $diff_ctx unchanged context lines.</span>
105 </div></div>
106 <div class="module-body tight">
107 <style>
108 .rst-diff { width:100%; border-collapse:collapse; font-family:var(--mono); font-size:12px; line-height:1.5; }
109 .rst-diff td { padding:1px 8px; vertical-align:top; white-space:pre-wrap; word-wrap:break-word; }
110 .rst-diff .ln { color:var(--text-muted); text-align:right; width:44px; user-select:none; border-right:1px solid var(--border); font-size:11px; }
111 .rst-diff tr.op-add td.text { background:rgba(52,211,153,.10); color:#a7f3d0; }
112 .rst-diff tr.op-add td.text::before { content:'+'; color:var(--accent-ok); padding-right:6px; }
113 .rst-diff tr.op-del td.text { background:rgba(244,63,94,.10); color:var(--accent-danger-hi); }
114 .rst-diff tr.op-del td.text::before { content:'-'; color:var(--accent-danger); padding-right:6px; }
115 .rst-diff tr.op-ctx td { color:var(--text-dim); }
116 .rst-diff tr.op-ctx td.text::before { content:' '; padding-right:6px; }
117 </style>
118 <div style="max-height:50vh;overflow:auto">
119 <table class="rst-diff">
120 <tbody>
121 [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]
122 </tbody>
123 </table>
95124 </div>
96125 </div>
97126</div>
127[/if]
98128
99129<div class="module glow-rose" style="margin-top:20px">
100130 <div class="module-head"><div class="left">
101131 <div class="module-title">Confirm restore</div>
102132 <span class="module-subtitle">Backs current content to <code>&lt;target&gt;.drift_restore_backup_&lt;epoch&gt;</code>, writes the captured content, verifies SHA post-write.</span>
103133 </div></div>
104134 <div class="module-body">
105135 <form method="post" action="/restore.cgi" style="display:flex;gap:12px;align-items:center">
106136 <input type="hidden" name="id" value="$id">
107137 <input type="hidden" name="confirm" value="1">
108138 <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">
109139 Yes, restore this file
110140 </button>
111141 <a href="/file_changes.cgi" class="tr-chip">Cancel</a>
112142 <span class="dim" style="margin-left:auto;font-size:12px">Logged to RESTORE_LOG regardless of outcome.</span>
113143 </form>
114144 </div>
115145</div>
116146[/if][/if]