Files
felhom-controller/controller/internal/web/templates/sharing.html
T
admin ac149c2aa4 i18n slice 1 release C: storage, sharing, sign-in, guest, catch-all and debug pages in English
- 11 templates converted (storage, storage_network, storage_init, storage_attach, sharing, login,
  claim, launcher_shared, launcher_share_password, catchall, debug); every key translated.
  Six ASCII-only Hungarian JS fragments the extractor missed were found by eye and converted by hand
  (", majd a(z)", "FIGYELEM:", "jelenlegi:", "mp", "p", " db").
- login, claim, both guest share pages and the catch-all render through executeTemplateLang (the
  household language; no session CSRF, no escrow reminder). renderLogin now takes the request.
- Page titles: TitleKey for storage, network storage, the two drive wizards and sharing.
  TestHandlerTitleKeysMatchHungarianTitle pins handler literal == hu.json value for every TitleKey.
- Tests: TestDirectRenderHandlersFollowLanguage (real routes, en + hu),
  TestI18nDirectRenderPagesHaveNoAdminChrome (escrow reminder due; none on the guest page).
- Fixture correction: the release C cases had invented page titles; the cases now carry the handlers'
  real titles (and the wizard pages their real page name), and those 12 fixtures were RE-CAPTURED from
  the unconverted templates at 0555091. The diff to the old fixtures is the <title> line (and the nav
  highlight on the two wizard pages) only.
- i18n gate: HU_FORMAL_CEILING 12 -> 16 — four more „ön" forms in the converted copy, unchanged by rule (R-516).

Hungarian: byte-identical (TestI18nParity against fixtures from unconverted templates).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-09-17 18:29:53 +02:00

369 lines
16 KiB
HTML

{{define "sharing"}}
{{template "layout_start" .}}
<div class="page-header">
<h2>{{T "sharing.halozati_megosztas"}}</h2>
</div>
{{if .Flash}}
<div class="alert alert-success">{{.Flash}}</div>
{{end}}
<div class="settings-card">
<p class="settings-card-desc">
{{T "sharing.a_megosztott_mappak_a_windows"}}
</p>
<form method="POST" action="/sharing/enable">
{{.CSRFField}}
<div class="form-group">
<label>
<input type="checkbox" name="enabled" {{if .SMBEnabled}}checked{{end}}>
{{T "sharing.megosztas_engedelyezese"}}
</label>
</div>
<div class="form-group">
<label for="server_name">{{T "sharing.kiszolgalo_neve"}}</label>
<input type="text" id="server_name" name="server_name" class="form-control mono"
value="{{.SMBServerName}}" maxlength="15" autocomplete="off">
<div class="form-hint">
{{T "sharing.ezen_a_neven_jelenik_meg"}}<span class="mono">\\{{.SMBServerName}}</span>{{T "sharing.legfeljebb_15_karakter_betu_szam"}}
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">{{T "sharing.mentes"}}</button>
</div>
</form>
<!-- v0.147.0 (4b): bring-up progress. Hidden until the poll reports a non-idle phase, so a page
with nothing in flight looks exactly as it did before. This is what makes the first-enable
wait survivable on a golden that has not baked felhom-samba: the pull is named, not silent. -->
<div id="samba-progress" class="alert alert-info" style="display:none">
<span id="samba-progress-text"></span>
</div>
<div class="form-group">
<span>{{T "sharing.allapot"}}</span>
{{if .SMBRunning}}
<span class="badge badge-ok">{{T "sharing.fut"}}</span>
{{else}}
<span class="badge badge-neutral">{{T "sharing.all"}}</span>
{{end}}
{{if and .SMBEnabled (not .SMBUserSet)}}
<span class="badge badge-warn">{{T "sharing.eloszor_adj_meg_jelszot"}}</span>
{{end}}
</div>
<div class="form-hint">
{{T "sharing.egyes_halozatokon_a_gep_kesve"}}
<span class="mono">\\{{.SMBServerName}}</span> {{T "sharing.cim_beirasa_a_cimsorba_ilyenkor"}}
</div>
</div>
{{if .SMBEnabled}}
<!-- v0.151.0 (S-2/S-5): the page names BOTH ways in. Until now it showed only the configured name,
so a customer whose network fails to resolve it had nothing to fall back on but a guess — and
the guess that started the diagnosis was the Proxmox HOST's address, which never ran smbd
(DIAG-sharing-2026-07-20.md). The direct address is derived per render from the samba
container's own netns and is absent whenever it cannot be read: no address beats a wrong one. -->
<div class="settings-card">
<h3>{{T "sharing.csatlakozas_a_megosztashoz"}}</h3>
<div class="form-hint">
{{T "sharing.windows_a_fajlkezelo_cimsoraba"}} <span class="mono">\\{{.SMBServerName}}</span>
</div>
<div class="form-hint">
{{T "sharing.mac_finder_ugras_csatlakozas_a"}}
<span class="mono">smb://{{.SMBServerName}}.local</span>
</div>
{{if .SMBDirectAddress}}
<div class="form-hint">
{{T "sharing.ha_a_nev_nem_mukodik"}}
<span class="mono">smb://{{.SMBDirectAddress}}</span>
</div>
<div class="form-hint">
{{T "sharing.a_kozvetlen_cim_a_halozattol"}}
</div>
{{end}}
</div>
{{end}}
<div class="settings-card">
<h3>{{T "sharing.megosztasi_jelszo_beallitasa"}}</h3>
<p class="settings-card-desc">
{{T "sharing.egy_kozos_jelszo_tartozik_a"}}
<span class="mono">felhom</span>.
</p>
<form method="POST" action="/sharing/password">
{{.CSRFField}}
<div class="form-group">
<label for="smb_password">{{T "sharing.uj_jelszo"}}</label>
<input type="password" id="smb_password" name="smb_password" class="form-control"
autocomplete="new-password" minlength="8" required>
</div>
<div class="form-group">
<label for="smb_password_confirm">{{T "sharing.jelszo_megerositese"}}</label>
<input type="password" id="smb_password_confirm" name="smb_password_confirm" class="form-control"
autocomplete="new-password" minlength="8" required>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">{{T "sharing.jelszo_mentese"}}</button>
</div>
</form>
</div>
<div class="settings-card">
<h3>{{T "sharing.megosztott_mappak"}}</h3>
{{if .SMBShares}}
<div class="backup-table-wrap">
<table class="db-table">
<thead>
<tr>
<th>{{T "sharing.nev"}}</th>
<th>{{T "sharing.mappa"}}</th>
<th>{{T "sharing.irasvedett"}}</th>
<th>{{T "sharing.felhomentes"}}</th>
<th>{{T "sharing.torles"}}</th>
</tr>
</thead>
<tbody>
{{range .SMBShares}}
<tr>
<td class="mono">{{.Name}}</td>
<td class="mono">{{.Path}}
{{if not .Available}}<span class="badge badge-warn">{{T "sharing.a_meghajto_nem_elerheto"}}</span>{{end}}
</td>
<td>{{if .ReadOnly}}<span class="badge badge-neutral">{{T "sharing.igen"}}</span>{{else}}{{T "sharing.nem"}}{{end}}</td>
<td>
<form method="POST" action="/sharing/shares/offsite">
{{$.CSRFField}}
<input type="hidden" name="name" value="{{.Name}}">
<input type="hidden" name="offsite" value="{{if .Offsite}}off{{else}}on{{end}}">
<button type="submit" class="btn btn-xs btn-outline">
{{if .Offsite}}{{T "sharing.bekapcsolva"}}{{else}}{{T "sharing.kikapcsolva"}}{{end}}
</button>
</form>
</td>
<td>
{{if .System}}
<span class="form-hint">{{T "sharing.rendszer"}}</span>
{{else}}
<form method="POST" action="/sharing/shares/delete">
{{$.CSRFField}}
<input type="hidden" name="name" value="{{.Name}}">
<button type="submit" class="btn btn-xs btn-danger-outline">{{T "sharing.torles"}}</button>
</form>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
<div class="form-hint">
{{T "sharing.a_megosztas_torlesekor_a_mappa"}}
</div>
<div class="backup-section-card" style="margin-top:1rem">
<h3>{{T "sharing.a_megosztasok_mentese"}}</h3>
<p class="form-hint" style="margin:-0.25rem 0 0.75rem">
{{T "sharing.a_megosztott_mappak_a_tobbi"}}
</p>
<ul class="plain-list">
<li>
<strong>{{T "sharing.2_mentes_masik_meghajto"}}</strong>
{{if .SharesTier2Status}}
{{if eq .SharesTier2Status "ok"}}
{{T "sharing.rendben"}}{{if .SharesTier2LastRun}} — {{.SharesTier2LastRun}}{{end}}
{{if .SharesTier2Warning}}<span class="badge badge-warn">{{.SharesTier2Warning}}</span>{{end}}
{{else if eq .SharesTier2Status "no_target"}}
<span class="badge badge-warn">{{T "sharing.nincs_cel"}}</span>
{{else}}
<span class="badge badge-warn">{{T "sharing.hiba"}}</span>
{{end}}
{{else}}
{{T "sharing.meg_nem_futott"}}
{{end}}
</li>
<li>
<strong>{{T "sharing.tavoli_mentes_felho"}}</strong>
{{if .SharesOffsiteStatus}}
{{if eq .SharesOffsiteStatus "ok"}}
{{T "sharing.rendben_megosztas"}}{{if .SharesOffsiteLastRun}}, {{.SharesOffsiteLastRun}}{{end}}
{{else if eq .SharesOffsiteStatus "blocked"}}
<span class="badge badge-warn">{{T "sharing.a_tarhelykeret_miatt_csak_a"}}</span>
{{else if eq .SharesOffsiteStatus "skipped"}}
<span class="badge badge-warn">{{T "sharing.kimaradt"}}</span>
{{else}}
<span class="badge badge-warn">{{T "sharing.hiba_2"}}</span>
{{end}}
{{else}}
{{T "sharing.meg_nem_futott"}}
{{end}}
</li>
</ul>
<div class="form-hint">
{{T "sharing.visszaallitani_a_visszaallitas_oldalon_l"}}
</div>
</div>
{{else}}
<div class="backup-table-empty">{{T "sharing.meg_nincs_megosztott_mappa"}}</div>
{{end}}
</div>
<div class="settings-card">
<h3>{{T "sharing.uj_megosztas"}}</h3>
<form method="POST" action="/sharing/shares" id="share-create-form">
{{.CSRFField}}
<div class="form-group">
<label for="share_name">{{T "sharing.megosztas_neve"}} <span class="required">*</span></label>
<input type="text" id="share_name" name="name" class="form-control mono"
maxlength="15" required autocomplete="off">
<div class="form-hint">{{T "sharing.legfeljebb_15_karakter_betu_szam_2"}}</div>
</div>
<div class="form-group">
<label>
<input type="radio" name="mode" value="new" checked onclick="shareModeSwitch()">
{{T "sharing.uj_mappa_a_tarhelyen"}}
</label>
<label>
<input type="radio" name="mode" value="existing" onclick="shareModeSwitch()">
{{T "sharing.meglevo_mappa_kivalasztasa"}}
</label>
</div>
<div class="form-group" id="share-mode-new">
<label for="storage_root">{{T "sharing.tarhely"}}</label>
<select id="storage_root" name="storage_root" class="form-control">
{{range .StorageRoots}}
<option value="{{.Path}}">{{.Label}}</option>
{{end}}
</select>
<div class="form-hint">{{T "sharing.a_mappa_a_kivalasztott_tarhely"}} <span class="mono">shares/</span> {{T "sharing.konyvtaraban_jon_letre"}}</div>
</div>
<div class="form-group" id="share-mode-existing" style="display:none">
<label>{{T "sharing.kivalasztott_mappa"}}</label>
<input type="text" id="share_path" name="path" class="form-control mono" readonly>
<div class="form-actions">
<button type="button" class="btn btn-sm btn-outline" onclick="shareBrowseOpen()">{{T "sharing.tallozas"}}</button>
</div>
</div>
<div class="form-group">
<label>
<input type="checkbox" name="read_only">
{{T "sharing.irasvedett_csak_olvashato"}}
</label>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">{{T "sharing.megosztas_letrehozasa"}}</button>
</div>
</form>
</div>
<div class="confirm-overlay" id="share-browse-overlay" style="display:none">
<div class="confirm-box">
<h3>{{T "sharing.mappa_kivalasztasa"}}</h3>
<div class="mono" id="share-browse-path"></div>
<div id="share-browse-list"></div>
<div class="form-actions">
<button type="button" class="btn btn-sm btn-primary" onclick="shareBrowsePick()">{{T "sharing.ezt_valasztom"}}</button>
<button type="button" class="btn btn-sm btn-outline" onclick="shareBrowseClose()">{{T "sharing.megse"}}</button>
</div>
</div>
</div>
<script>
var shareBrowseCurrent = "";
function shareModeSwitch(){
var mode = document.querySelector('input[name="mode"]:checked').value;
document.getElementById('share-mode-new').style.display = (mode === 'new') ? '' : 'none';
document.getElementById('share-mode-existing').style.display = (mode === 'existing') ? '' : 'none';
}
function shareBrowseOpen(){
document.getElementById('share-browse-overlay').style.display = '';
shareBrowseLoad('');
}
function shareBrowseClose(){
document.getElementById('share-browse-overlay').style.display = 'none';
}
function shareBrowsePick(){
if(shareBrowseCurrent){ document.getElementById('share_path').value = shareBrowseCurrent; }
shareBrowseClose();
}
function shareBrowseLoad(p){
fetch('/api/sharing/browse?path=' + encodeURIComponent(p))
.then(function(r){ return r.json(); })
.then(function(d){
shareBrowseCurrent = d.path || "";
document.getElementById('share-browse-path').textContent = d.error ? d.error : (d.path || '{{T "sharing.tarhelyek"}}');
var list = document.getElementById('share-browse-list');
list.innerHTML = '';
if(d.parent){
var up = document.createElement('div');
up.innerHTML = '<button type="button" class="btn btn-xs btn-outline">{{T "sharing.vissza"}}</button>';
up.firstChild.onclick = function(){ shareBrowseLoad(d.parent); };
list.appendChild(up);
}
(d.entries || []).forEach(function(e){
var row = document.createElement('div');
row.innerHTML = '<button type="button" class="btn btn-xs btn-outline"></button>';
row.firstChild.textContent = e.name;
row.firstChild.onclick = function(){ shareBrowseLoad(e.path); };
list.appendChild(row);
});
});
}
/* v0.147.0 (4b) — Megosztás bring-up poll. Same shape as the storage-init status poll
(storage_init.html): 1.5s tick, phase string mapped to Hungarian, terminal states stop the timer.
The card only ever appears while something is genuinely in flight. */
(function(){
var box = document.getElementById('samba-progress');
var txt = document.getElementById('samba-progress-text');
if (!box || !txt) return;
var PHASES = {
pulling: '{{T "sharing.a_megosztasi_szolgaltatas_elokeszitese_k"}}',
starting: '{{T "sharing.a_megosztasi_szolgaltatas_inditasa"}}',
needs_password: '{{T "sharing.a_megosztas_be_van_kapcsolva"}}'
};
var timer = null;
function stop(){ if (timer) { clearInterval(timer); timer = null; } }
function show(cls, text){
box.className = 'alert ' + cls;
txt.textContent = text;
box.style.display = '';
}
function tick(){
fetch('/sharing/status', {credentials:'same-origin'})
.then(function(r){ return r.json(); })
.then(function(j){
if (!j || !j.ok || !j.data) return; // transient — keep polling
var ph = j.data.phase;
if (PHASES[ph]) { show('alert-info', PHASES[ph]); return; }
if (ph === 'running') {
stop();
show('alert-success', '{{T "sharing.a_megosztasi_szolgaltatas_fut"}}');
/* Repaint the „Állapot" badge, which was rendered server-side as „áll". */
setTimeout(function(){ location.reload(); }, 1200);
return;
}
if (ph === 'failed') {
stop();
show('alert-error', '{{T "sharing.a_megosztasi_szolgaltatas_nem_indult"}}' + (j.data.error ? ': ' + j.data.error : '.'));
return;
}
/* idle and nothing running: nothing to report. */
stop();
box.style.display = 'none';
})
.catch(function(){ /* transient — keep polling */ });
}
tick();
timer = setInterval(tick, 1500);
})();
</script>
{{template "layout_end" .}}
{{end}}