Diff -- /var/www/vhosts/3dshawn.com/site1/TEMPLATES/restore.html
Diff
/var/www/vhosts/3dshawn.com/site1/TEMPLATES/restore.html
modified on local at 2026-07-12 00:48:54
Added
+31
lines
Removed
-0
lines
Context
146
unchanged
Blobs
from 10cf73c63f2d
to 4bed1ca57f38
to 4bed1ca57f38
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> Restore</span> |
| 3 | 3 | <h1 class="page-title">Restore file to captured state</h1> |
| 4 | 4 | <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 — current file gets backed up to <code><path>.drift_restore_backup_<epoch></code> before overwrite.</p> |
| 5 | 5 | </div> |
| 6 | 6 | |
| 7 | 7 | [if:$has_error] |
| 8 | 8 | <div class="module glow-rose"> |
| 9 | 9 | <div class="module-head"><div class="left"> |
| 10 | 10 | <div class="module-title">Cannot proceed</div> |
| 11 | 11 | <span class="module-subtitle">Restore rejected on safety grounds.</span> |
| 12 | 12 | </div></div> |
| 13 | 13 | <div class="module-body" style="color:var(--accent-danger-hi)"> |
| 14 | 14 | $error_msg |
| 15 | 15 | </div> |
| 16 | 16 | </div> |
| 17 | 17 | [/if] |
| 18 | 18 | |
| 19 | 19 | [if:$did_restore] |
| 20 | 20 | [if:$result_ok] |
| 21 | 21 | <div class="module glow-emerald"> |
| 22 | 22 | <div class="module-head"><div class="left"> |
| 23 | 23 | <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> |
| 24 | 24 | <div class="module-title">Restore succeeded</div> |
| 25 | 25 | <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> |
| 26 | 26 | </div></div> |
| 27 | 27 | <div class="module-body"> |
| 28 | 28 | <table class="tbl"> |
| 29 | 29 | <tbody> |
| 30 | 30 | <tr><td style="width:200px"><strong>Target</strong></td><td class="mono">$target_file</td></tr> |
| 31 | 31 | <tr><td><strong>Server</strong></td><td class="mono">$server_name (<span class="dim">$server_kind</span>)</td></tr> |
| 32 | 32 | <tr><td><strong>Restored content SHA</strong></td><td class="mono">$source_sha</td></tr> |
| 33 | 33 | <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> |
| 34 | 34 | <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> |
| 35 | 35 | <tr><td><strong>Result</strong></td><td>$result_msg</td></tr> |
| 36 | 36 | </tbody> |
| 37 | 37 | </table> |
| 38 | 38 | <div style="margin-top:14px"> |
| 39 | 39 | <a href="/file_changes.cgi" class="tr-chip">Back to file changes</a> |
| 40 | 40 | <a href="/diff.cgi?kind=file&id=$id" class="tr-chip">See diff</a> |
| 41 | 41 | </div> |
| 42 | 42 | </div> |
| 43 | 43 | </div> |
| 44 | 44 | [/if] |
| 45 | 45 | [if:!$result_ok] |
| 46 | 46 | <div class="module glow-rose"> |
| 47 | 47 | <div class="module-head"><div class="left"> |
| 48 | 48 | <div class="module-title">Restore failed</div> |
| 49 | 49 | <span class="module-subtitle">See RESTORE_LOG for full audit trail.</span> |
| 50 | 50 | </div></div> |
| 51 | 51 | <div class="module-body"> |
| 52 | 52 | <p style="color:var(--accent-danger-hi)">$result_msg</p> |
| 53 | 53 | <p class="dim" style="font-size:12.5px;margin-top:8px">Backup path: <code>$backup_path</code></p> |
| 54 | 54 | </div> |
| 55 | 55 | </div> |
| 56 | 56 | [/if] |
| 57 | 57 | [/if] |
| 58 | 58 | |
| 59 | 59 | [if:!$did_restore][if:!$has_error] |
| 60 | 60 | <div class="dash-grid" style="grid-template-columns:1fr 1fr"> |
| 61 | 61 | <div class="module glow-teal"> |
| 62 | 62 | <div class="module-head"><div class="left"> |
| 63 | 63 | <div class="module-title">What will change</div> |
| 64 | 64 | <span class="module-subtitle">Preview -- nothing has been written yet.</span> |
| 65 | 65 | </div></div> |
| 66 | 66 | <div class="module-body"> |
| 67 | 67 | <table class="tbl"> |
| 68 | 68 | <tbody> |
| 69 | 69 | <tr><td style="width:170px"><strong>Target file</strong></td><td class="mono">$target_file</td></tr> |
| 70 | 70 | <tr><td><strong>Site</strong></td><td>$scan_name <span class="dim">on $server_name</span></td></tr> |
| 71 | 71 | <tr><td><strong>Kind</strong></td><td>$server_kind</td></tr> |
| 72 | 72 | <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> |
| 73 | 73 | <tr><td><strong>Captured SHA</strong></td><td class="mono">$source_sha_full</td></tr> |
| 74 | 74 | </tbody> |
| 75 | 75 | </table> |
| 76 | 76 | </div> |
| 77 | 77 | </div> |
| 78 | 78 | <div class="module glow-amber"> |
| 79 | 79 | <div class="module-head"><div class="left"> |
| 80 | 80 | <div class="module-title">Current state on disk</div> |
| 81 | 81 | <span class="module-subtitle">Live check just now. If SHAs match, the restore is a no-op.</span> |
| 82 | 82 | </div></div> |
| 83 | 83 | <div class="module-body"> |
| 84 | 84 | <table class="tbl"> |
| 85 | 85 | <tbody> |
| 86 | 86 | <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> |
| 87 | 87 | <tr><td><strong>Size</strong></td><td class="mono dim">$current_size</td></tr> |
| 88 | 88 | <tr><td><strong>Current SHA</strong></td><td class="mono">$current_sha</td></tr> |
| 89 | 89 | <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> |
| 90 | 90 | </tbody> |
| 91 | 91 | </table> |
| 92 | 92 | <div style="margin-top:14px"> |
| 93 | 93 | <a href="$diff_url" class="tr-chip">See exactly what's different →</a> |
| 94 | 94 | </div> |
| 95 | 95 | </div> |
| 96 | </div> | |
| 97 | </div> | |
| 98 | ||
| 99 | [if:$has_recent_restores] | |
| 100 | <div class="module glow-warn" style="margin-top:16px"> | |
| 101 | <div class="module-head"><div class="left"> | |
| 102 | <div class="module-title">Recent restores of this file</div> | |
| 103 | <span class="module-subtitle">This file has been restored before — check whether you want to duplicate that action or pick a different captured moment.</span> | |
| 104 | </div></div> | |
| 105 | <div class="module-body tight"> | |
| 106 | <table class="tbl"> | |
| 107 | <thead><tr> | |
| 108 | <th style="width:100px">Status</th> | |
| 109 | <th style="width:120px">Source SHA</th> | |
| 110 | <th>By</th> | |
| 111 | <th>Error</th> | |
| 112 | <th style="width:150px">When</th> | |
| 113 | </tr></thead> | |
| 114 | <tbody> | |
| 115 | [loop:@recent_restores_this] | |
| 116 | <tr> | |
| 117 | <td><span class="pill $status_pill">$status</span></td> | |
| 118 | <td class="mono">$sha_short</td> | |
| 119 | <td class="dim">$restored_by</td> | |
| 120 | <td class="mono dim" style="font-size:11.5px">$err_short</td> | |
| 121 | <td class="mono dim"><span class="ts" data-ts="$restored_epoch" data-fmt="relative">$restored_h</span></td> | |
| 122 | </tr> | |
| 123 | [/loop] | |
| 124 | </tbody> | |
| 125 | </table> | |
| 96 | 126 | </div> |
| 97 | 127 | </div> |
| 128 | [/if] | |
| 98 | 129 | |
| 99 | 130 | [if:$has_live_diff] |
| 100 | 131 | <div class="module glow-teal" style="margin-top:20px"> |
| 101 | 132 | <div class="module-head"><div class="left"> |
| 102 | 133 | <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 | 134 | <div class="module-title">What restore will change — live diff</div> |
| 104 | 135 | <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 | 136 | </div></div> |
| 106 | 137 | <div class="module-body tight"> |
| 107 | 138 | <style> |
| 108 | 139 | .rst-diff { width:100%; border-collapse:collapse; font-family:var(--mono); font-size:12px; line-height:1.5; } |
| 109 | 140 | .rst-diff td { padding:1px 8px; vertical-align:top; white-space:pre-wrap; word-wrap:break-word; } |
| 110 | 141 | .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 | 142 | .rst-diff tr.op-add td.text { background:rgba(52,211,153,.10); color:#a7f3d0; } |
| 112 | 143 | .rst-diff tr.op-add td.text::before { content:'+'; color:var(--accent-ok); padding-right:6px; } |
| 113 | 144 | .rst-diff tr.op-del td.text { background:rgba(244,63,94,.10); color:var(--accent-danger-hi); } |
| 114 | 145 | .rst-diff tr.op-del td.text::before { content:'-'; color:var(--accent-danger); padding-right:6px; } |
| 115 | 146 | .rst-diff tr.op-ctx td { color:var(--text-dim); } |
| 116 | 147 | .rst-diff tr.op-ctx td.text::before { content:' '; padding-right:6px; } |
| 117 | 148 | </style> |
| 118 | 149 | <div style="max-height:50vh;overflow:auto"> |
| 119 | 150 | <table class="rst-diff"> |
| 120 | 151 | <tbody> |
| 121 | 152 | [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 | 153 | </tbody> |
| 123 | 154 | </table> |
| 124 | 155 | </div> |
| 125 | 156 | </div> |
| 126 | 157 | </div> |
| 127 | 158 | [/if] |
| 128 | 159 | |
| 129 | 160 | <div class="module glow-rose" style="margin-top:20px"> |
| 130 | 161 | <div class="module-head"><div class="left"> |
| 131 | 162 | <div class="module-title">Confirm restore</div> |
| 132 | 163 | <span class="module-subtitle">Backs current content to <code><target>.drift_restore_backup_<epoch></code>, writes the captured content, verifies SHA post-write.</span> |
| 133 | 164 | </div></div> |
| 134 | 165 | <div class="module-body"> |
| 135 | 166 | <form method="post" action="/restore.cgi" style="display:flex;gap:12px;align-items:center"> |
| 136 | 167 | <input type="hidden" name="id" value="$id"> |
| 137 | 168 | <input type="hidden" name="confirm" value="1"> |
| 138 | 169 | <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"> |
| 139 | 170 | Yes, restore this file |
| 140 | 171 | </button> |
| 141 | 172 | <a href="/file_changes.cgi" class="tr-chip">Cancel</a> |
| 142 | 173 | <span class="dim" style="margin-left:auto;font-size:12px">Logged to RESTORE_LOG regardless of outcome.</span> |
| 143 | 174 | </form> |
| 144 | 175 | </div> |
| 145 | 176 | </div> |
| 146 | 177 | [/if][/if] |