mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-07-19 10:28:09 +02:00
Add files via upload
This commit is contained in:
@@ -99,6 +99,8 @@ function wsT(key) {
|
||||
'webshell.refresh': '刷新',
|
||||
'webshell.selectAll': '全选',
|
||||
'webshell.breadcrumbHome': '根',
|
||||
'webshell.searchPlaceholder': '搜索连接...',
|
||||
'webshell.noMatchConnections': '暂无匹配连接',
|
||||
'common.delete': '删除',
|
||||
'common.refresh': '刷新'
|
||||
};
|
||||
@@ -137,6 +139,16 @@ function initWebshellPage() {
|
||||
renderWebshellList();
|
||||
applyWebshellSidebarWidth();
|
||||
initWebshellSidebarResize();
|
||||
|
||||
// 连接搜索:实时过滤连接列表
|
||||
var searchEl = document.getElementById('webshell-conn-search');
|
||||
if (searchEl && searchEl.dataset.bound !== '1') {
|
||||
searchEl.dataset.bound = '1';
|
||||
searchEl.addEventListener('input', function () {
|
||||
renderWebshellList();
|
||||
});
|
||||
}
|
||||
|
||||
const workspace = document.getElementById('webshell-workspace');
|
||||
if (workspace) {
|
||||
workspace.innerHTML = '<div class="webshell-workspace-placeholder" data-i18n="webshell.selectOrAdd">' + (wsT('webshell.selectOrAdd')) + '</div>';
|
||||
@@ -227,12 +239,29 @@ function renderWebshellList() {
|
||||
const listEl = document.getElementById('webshell-list');
|
||||
if (!listEl) return;
|
||||
|
||||
const searchEl = document.getElementById('webshell-conn-search');
|
||||
const searchTerm = (searchEl && typeof searchEl.value === 'string' ? searchEl.value : '').trim().toLowerCase();
|
||||
|
||||
if (!webshellConnections.length) {
|
||||
listEl.innerHTML = '<div class="webshell-empty" data-i18n="webshell.noConnections">' + (wsT('webshell.noConnections')) + '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
listEl.innerHTML = webshellConnections.map(conn => {
|
||||
const filtered = searchTerm
|
||||
? webshellConnections.filter(conn => {
|
||||
const id = String(conn.id || '').toLowerCase();
|
||||
const url = String(conn.url || '').toLowerCase();
|
||||
const remark = String(conn.remark || '').toLowerCase();
|
||||
return id.includes(searchTerm) || url.includes(searchTerm) || remark.includes(searchTerm);
|
||||
})
|
||||
: webshellConnections;
|
||||
|
||||
if (filtered.length === 0) {
|
||||
listEl.innerHTML = '<div class="webshell-empty">' + (wsT('webshell.noMatchConnections') || '暂无匹配连接') + '</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
listEl.innerHTML = filtered.map(conn => {
|
||||
const remark = (conn.remark || conn.url || '').replace(/</g, '<').replace(/>/g, '>');
|
||||
const url = (conn.url || '').replace(/</g, '<').replace(/>/g, '>');
|
||||
const urlTitle = (conn.url || '').replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
||||
@@ -1687,6 +1716,14 @@ function refreshWebshellUIOnLanguageChange() {
|
||||
if (fileListEl && webshellCurrentConn && pathInput) {
|
||||
webshellFileListDir(webshellCurrentConn, pathInput.value.trim() || '.');
|
||||
}
|
||||
|
||||
// 连接搜索占位符(动态属性:这里手动更新)
|
||||
var connSearchEl = document.getElementById('webshell-conn-search');
|
||||
if (connSearchEl) {
|
||||
var ph = wsT('webshell.searchPlaceholder') || '搜索连接...';
|
||||
connSearchEl.setAttribute('placeholder', ph);
|
||||
connSearchEl.placeholder = ph;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user