78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
const { Client } = require('ssh2');
|
|
|
|
const config = {
|
|
host: 'hs.yifenbao.cn',
|
|
port: 22,
|
|
username: 'root',
|
|
password: 'Torch1112'
|
|
};
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('SSH连接成功');
|
|
|
|
// 检查所有JS文件
|
|
conn.exec('docker exec huishou grep -r "debug-info\\|tabBar:.*safeArea" /usr/share/nginx/html/ 2>/dev/null', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let output = '';
|
|
stream.stdout.on('data', (data) => {
|
|
output += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('容器内所有包含调试信息的文件:');
|
|
console.log(output || '未找到');
|
|
|
|
// 检查所有order相关的CSS
|
|
conn.exec('docker exec huishou grep -r "tabBar\\|safeArea\\|debug-info" /usr/share/nginx/html/h5/assets/*.css 2>/dev/null', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let cssOutput = '';
|
|
stream.stdout.on('data', (data) => {
|
|
cssOutput += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('\nCSS文件中的调试信息:');
|
|
console.log(cssOutput || '未找到');
|
|
|
|
// 列出容器内h5目录下的所有文件
|
|
conn.exec('docker exec huishou ls -la /usr/share/nginx/html/h5/assets/ | grep -E "list|css"', (err, stream) => {
|
|
if (err) {
|
|
console.error('执行命令错误:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
let lsOutput = '';
|
|
stream.stdout.on('data', (data) => {
|
|
lsOutput += data.toString();
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
console.log('\n容器内list相关文件:');
|
|
console.log(lsOutput);
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.error('SSH连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect(config); |