feat: save to remote can be authed by Kerberos

This commit is contained in:
2026-06-12 10:32:14 +08:00
parent 050f2b74c3
commit 4576653b4e
5 changed files with 332 additions and 13 deletions
+53 -11
View File
@@ -43,6 +43,7 @@ interface SSHConfig {
host: string
port: number
user: string
authMethod: string
password: string
pathPrefix: string
strictHostKey: boolean
@@ -77,6 +78,7 @@ function defaultConfig(): AppConfig {
host: '',
port: 22,
user: '',
authMethod: 'builtin',
password: '',
pathPrefix: 'snapgo/',
strictHostKey: false,
@@ -280,14 +282,26 @@ onMounted(load)
placeholder="22"
/>
</label>
<label class="field">
<span>User *</span>
<input v-model="config.ssh.user" placeholder="ubuntu" />
</label>
<label class="field">
<span>Password (optional)</span>
<input v-model="config.ssh.password" type="password" />
</label>
<div class="field-row auth-row">
<label class="field">
<span>Auth method</span>
<select v-model="config.ssh.authMethod">
<option value="builtin">Password / Key</option>
<option value="kerberos">Kerberos</option>
</select>
</label>
<label class="field">
<span>User *</span>
<input v-model="config.ssh.user" placeholder="ubuntu" />
</label>
<label
v-if="config.ssh.authMethod !== 'kerberos'"
class="field"
>
<span>Password (optional)</span>
<input v-model="config.ssh.password" type="password" />
</label>
</div>
<label class="field full">
<span>Remote path (under home)</span>
<div class="prefixed-input">
@@ -324,7 +338,16 @@ onMounted(load)
</span>
</label>
</div>
<p v-if="!config.ssh.password" class="hint warn">
<p v-if="config.ssh.authMethod === 'kerberos'" class="hint">
Kerberos mode delegates to the system <code>ssh</code>/<code>scp</code>.
Run <code>kinit {{ config.ssh.user || 'user' }}@BYTEDANCE.COM</code> in a terminal first; tickets
expire (typically every 1024h), so re-run <code>kinit</code> if uploads
start failing. Verify with <code>klist</code>.
</p>
<p
v-else-if="!config.ssh.password"
class="hint warn"
>
Password is empty please make sure password-less SSH is configured on
this machine (e.g. via <code>ssh-copy-id</code> or your <code>ssh-agent</code>).
</p>
@@ -414,17 +437,30 @@ kbd {
.field.full {
grid-column: 1 / -1;
}
/* field-row groups several fields onto a single full-width row. auth-row
splits Auth method / User / Password roughly 1:2:2. */
.field-row {
grid-column: 1 / -1;
display: grid;
gap: 12px 16px;
}
.auth-row {
grid-template-columns: 1fr 2fr 2fr;
}
.field span {
color: #374151;
font-weight: 500;
}
.field input[type='text'],
.field input[type='number'],
.field input:not([type='checkbox']) {
.field input:not([type='checkbox']),
.field select {
border: 1px solid #d1d5db;
border-radius: 6px;
padding: 7px 10px;
font-size: 13px;
line-height: 1.4;
height: 36px;
background: #fff;
color: inherit;
outline: none;
@@ -432,7 +468,8 @@ kbd {
width: 100%;
box-sizing: border-box;
}
.field input:focus {
.field input:focus,
.field select:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
@@ -560,6 +597,11 @@ kbd {
border-color: #374151;
color: #e5e7eb;
}
.field select {
background: #111827;
border-color: #374151;
color: #e5e7eb;
}
.field input:disabled {
background: #1f2937;
color: #6b7280;