refactor: 移除 ttyd 扩展的“用户凭据”功能

This commit is contained in:
mofeng-git
2026-02-11 16:50:49 +08:00
parent 24c4002ef2
commit f912c977d0
7 changed files with 1 additions and 26 deletions

View File

@@ -230,13 +230,6 @@ impl ExtensionManager {
"-W".to_string(), // Writable (allow input) "-W".to_string(), // Writable (allow input)
]; ];
// Add credential if set (still useful for additional security layer)
if let Some(ref cred) = c.credential {
if !cred.is_empty() {
args.extend(["-c".to_string(), cred.clone()]);
}
}
// Add shell as last argument // Add shell as last argument
args.push(c.shell.clone()); args.push(c.shell.clone());
Ok(args) Ok(args)

View File

@@ -102,9 +102,6 @@ pub struct TtydConfig {
pub port: u16, pub port: u16,
/// Shell to execute /// Shell to execute
pub shell: String, pub shell: String,
/// Credential in format "user:password" (optional)
#[serde(skip_serializing_if = "Option::is_none")]
pub credential: Option<String>,
} }
impl Default for TtydConfig { impl Default for TtydConfig {
@@ -113,7 +110,6 @@ impl Default for TtydConfig {
enabled: false, enabled: false,
port: 7681, port: 7681,
shell: "/bin/bash".to_string(), shell: "/bin/bash".to_string(),
credential: None,
} }
} }
} }

View File

@@ -156,7 +156,6 @@ pub struct TtydConfigUpdate {
pub enabled: Option<bool>, pub enabled: Option<bool>,
pub port: Option<u16>, pub port: Option<u16>,
pub shell: Option<String>, pub shell: Option<String>,
pub credential: Option<String>,
} }
/// Update gostc config /// Update gostc config
@@ -203,9 +202,6 @@ pub async fn update_ttyd_config(
if let Some(ref shell) = req.shell { if let Some(ref shell) = req.shell {
ttyd.shell = shell.clone(); ttyd.shell = shell.clone();
} }
if req.credential.is_some() {
ttyd.credential = req.credential.clone();
}
}) })
.await?; .await?;

View File

@@ -741,7 +741,6 @@ export default {
openInNewTab: 'Open in New Tab', openInNewTab: 'Open in New Tab',
port: 'Port', port: 'Port',
shell: 'Shell', shell: 'Shell',
credential: 'Credential',
}, },
// gostc // gostc
gostc: { gostc: {

View File

@@ -741,7 +741,6 @@ export default {
openInNewTab: '在新标签页打开', openInNewTab: '在新标签页打开',
port: '端口', port: '端口',
shell: 'Shell', shell: 'Shell',
credential: '认证凭据',
}, },
// gostc // gostc
gostc: { gostc: {

View File

@@ -302,8 +302,6 @@ export interface TtydConfig {
port: number; port: number;
/** Shell to execute */ /** Shell to execute */
shell: string; shell: string;
/** Credential in format "user:password" (optional) */
credential?: string;
} }
/** gostc configuration (NAT traversal based on FRP) */ /** gostc configuration (NAT traversal based on FRP) */
@@ -659,7 +657,6 @@ export interface TtydConfigUpdate {
enabled?: boolean; enabled?: boolean;
port?: number; port?: number;
shell?: string; shell?: string;
credential?: string;
} }
/** Simple ttyd status for console view */ /** Simple ttyd status for console view */

View File

@@ -168,7 +168,7 @@ const showTerminalDialog = ref(false)
// Extension config (local edit state) // Extension config (local edit state)
const extConfig = ref({ const extConfig = ref({
ttyd: { enabled: false, shell: '/bin/bash', credential: '' }, ttyd: { enabled: false, shell: '/bin/bash' },
gostc: { enabled: false, addr: 'gostc.mofeng.run', key: '', tls: true }, gostc: { enabled: false, addr: 'gostc.mofeng.run', key: '', tls: true },
easytier: { enabled: false, network_name: '', network_secret: '', peer_urls: [] as string[], virtual_ip: '' }, easytier: { enabled: false, network_name: '', network_secret: '', peer_urls: [] as string[], virtual_ip: '' },
}) })
@@ -780,7 +780,6 @@ async function loadExtensions() {
extConfig.value.ttyd = { extConfig.value.ttyd = {
enabled: ttyd.enabled, enabled: ttyd.enabled,
shell: ttyd.shell, shell: ttyd.shell,
credential: ttyd.credential || '',
} }
extConfig.value.gostc = { ...extensions.value.gostc.config } extConfig.value.gostc = { ...extensions.value.gostc.config }
const easytier = extensions.value.easytier.config const easytier = extensions.value.easytier.config
@@ -2115,10 +2114,6 @@ onMounted(async () => {
<Label class="sm:text-right">{{ t('extensions.ttyd.shell') }}</Label> <Label class="sm:text-right">{{ t('extensions.ttyd.shell') }}</Label>
<Input v-model="extConfig.ttyd.shell" class="sm:col-span-3" placeholder="/bin/bash" :disabled="isExtRunning(extensions?.ttyd?.status)" /> <Input v-model="extConfig.ttyd.shell" class="sm:col-span-3" placeholder="/bin/bash" :disabled="isExtRunning(extensions?.ttyd?.status)" />
</div> </div>
<div class="grid gap-2 sm:grid-cols-4 sm:items-center">
<Label class="sm:text-right">{{ t('extensions.ttyd.credential') }}</Label>
<Input v-model="extConfig.ttyd.credential" class="sm:col-span-3" placeholder="user:password" :disabled="isExtRunning(extensions?.ttyd?.status)" />
</div>
</div> </div>
<!-- Logs --> <!-- Logs -->
<div class="space-y-2"> <div class="space-y-2">