style(headers): update all page header titles and add HelpTrigger buttons matching demoplace.my.id
This commit is contained in:
1 parent
fb75711994
commit
36fe496566
20 files changed
+532
-60
No files matched your search
@@ -0,0 +1,66 @@
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const remoteScript = `
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = '/home/adminbackend/web/demoplace.my.id/public_html/.next/standalone/.next/server/app/(dashboard)';
|
||||
|
||||
function scanDir(dir) {
|
||||
const results = [];
|
||||
if (!fs.existsSync(dir)) return results;
|
||||
const items = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const item of items) {
|
||||
const fullPath = path.join(dir, item.name);
|
||||
if (item.isDirectory()) {
|
||||
results.push(...scanDir(fullPath));
|
||||
} else if (item.name.endsWith('.html') || item.name.endsWith('.js')) {
|
||||
results.push(fullPath);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
console.log('=== AUDITING ALL PAGE HEADERS AND TITLES ON DEMOPLACE.MY.ID ===\\n');
|
||||
|
||||
const files = scanDir(root);
|
||||
files.forEach(file => {
|
||||
const content = fs.readFileSync(file, 'utf8');
|
||||
const rel = path.relative(root, file);
|
||||
|
||||
// Extract <h2> or <h1> or header titles
|
||||
const h2s = [];
|
||||
const h2Match = content.matchAll(/<h2[^>]*>(.*?)<\/h2>/gi);
|
||||
for (const m of h2Match) {
|
||||
const clean = m[1].replace(/<[^>]+>/g, '').trim();
|
||||
if (clean && !h2s.includes(clean)) h2s.push(clean);
|
||||
}
|
||||
|
||||
// Extract Learn This Page triggers
|
||||
const hasHelpTrigger = content.includes('Learn This Page');
|
||||
|
||||
if (h2s.length > 0 || hasHelpTrigger) {
|
||||
console.log('Page Route File:', rel);
|
||||
if (h2s.length > 0) console.log(' Headers (H2):', h2s.join(' | '));
|
||||
console.log(' Has Learn This Page Button:', hasHelpTrigger);
|
||||
console.log('---');
|
||||
}
|
||||
});
|
||||
`;
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
conn.exec(`node -e ${JSON.stringify(remoteScript)}`, (err, stream) => {
|
||||
let out = '';
|
||||
stream.on('data', d => out += d);
|
||||
stream.on('close', () => {
|
||||
console.log(out);
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
const SftpClient = require('ssh2-sftp-client');
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const remoteExtractScript = `
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = '/home/adminbackend/web/demoplace.my.id/public_html/.next/standalone/.next/server/chunks';
|
||||
|
||||
console.log('=== EXTRACTING ALL PAGE HEADERS FROM CHUNKS ===\\n');
|
||||
|
||||
const files = fs.readdirSync(root);
|
||||
files.forEach(f => {
|
||||
if (!f.endsWith('.js')) return;
|
||||
const content = fs.readFileSync(path.join(root, f), 'utf8');
|
||||
|
||||
// Match header titles in React JSX: e.g. text-3xl font-bold ... >TitleText<
|
||||
const titleMatches = content.matchAll(/text-3xl[^>]*>([^<]{3,40})</gi);
|
||||
for (const m of titleMatches) {
|
||||
console.log(\`Chunk \${f}: "\${m[1].trim()}"\`);
|
||||
}
|
||||
|
||||
// Match tab names in React JSX
|
||||
const tabMatches = content.matchAll(/role="tab"[^>]*>([^<]{3,30})</gi);
|
||||
for (const m of tabMatches) {
|
||||
console.log(\`Chunk \${f} Tab: "\${m[1].trim()}"\`);
|
||||
}
|
||||
});
|
||||
`;
|
||||
|
||||
async function main() {
|
||||
const sftp = new SftpClient();
|
||||
await sftp.connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
|
||||
const remoteScriptPath = '/home/adminbackend/extract_client_titles.js';
|
||||
await sftp.put(Buffer.from(remoteExtractScript), remoteScriptPath);
|
||||
await sftp.end();
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
conn.exec(`node ${remoteScriptPath}`, (err, stream) => {
|
||||
let out = '';
|
||||
stream.on('data', d => out += d);
|
||||
stream.on('close', () => {
|
||||
console.log(out);
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,69 @@
|
||||
const SftpClient = require('ssh2-sftp-client');
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const remoteExtractScript = `
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = '/home/adminbackend/web/demoplace.my.id/public_html/.next/standalone/.next/server';
|
||||
|
||||
console.log('=== EXTRACTING ALL PAGE HEADERS FROM STANDALONE BUILD ===\\n');
|
||||
|
||||
function scan(dir) {
|
||||
if (!fs.existsSync(dir)) return;
|
||||
const items = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const item of items) {
|
||||
const full = path.join(dir, item.name);
|
||||
if (item.isDirectory()) {
|
||||
scan(full);
|
||||
} else if (item.name.endsWith('.js') || item.name.endsWith('.html')) {
|
||||
const content = fs.readFileSync(full, 'utf8');
|
||||
|
||||
// Look for H2/H1 page header titles or page metadata
|
||||
const matches = content.matchAll(/<h[12][^>]*>([\\s\\S]*?)<\\/h[12]>/gi);
|
||||
for (const m of matches) {
|
||||
const clean = m[1].replace(/<[^>]+>/g, '').trim();
|
||||
if (clean && clean.length > 2 && clean.length < 60 && !clean.includes('{') && !clean.includes('function')) {
|
||||
console.log(\`File: \${path.relative(root, full)}\`);
|
||||
console.log(\` Header: "\${clean}"\`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scan(path.join(root, 'app/(dashboard)'));
|
||||
`;
|
||||
|
||||
async function main() {
|
||||
const sftp = new SftpClient();
|
||||
await sftp.connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
|
||||
const remoteScriptPath = '/home/adminbackend/extract_standalone.js';
|
||||
await sftp.put(Buffer.from(remoteExtractScript), remoteScriptPath);
|
||||
await sftp.end();
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
conn.exec(`node ${remoteScriptPath}`, (err, stream) => {
|
||||
let out = '';
|
||||
stream.on('data', d => out += d);
|
||||
stream.on('close', () => {
|
||||
console.log(out);
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,44 @@
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
// Execute a shell script on remote server
|
||||
conn.exec(`python3 -c "
|
||||
import os, re
|
||||
|
||||
root = '/home/adminbackend/web/demoplace.my.id/public_html/.next/standalone/.next/server/app/(dashboard)'
|
||||
|
||||
for dirpath, dirnames, filenames in os.walk(root):
|
||||
for f in filenames:
|
||||
if f.endswith('.html') or f.endswith('.js'):
|
||||
full = os.path.join(dirpath, f)
|
||||
rel = os.path.relpath(full, root)
|
||||
try:
|
||||
content = open(full, 'r', encoding='utf-8', errors='ignore').read()
|
||||
|
||||
h2s = re.findall(r'<h[12][^>]*>(.*?)</h[12]>', content)
|
||||
clean_h2s = [re.sub(r'<[^>]+>', '', h).strip() for h in h2s if h.strip()]
|
||||
|
||||
has_learn = 'Learn This Page' in content
|
||||
|
||||
if clean_h2s or has_learn:
|
||||
print(f'Route File: {rel}')
|
||||
print(f' Headers: {\" | \".join(clean_h2s)}')
|
||||
print(f' Learn This Page Button: {has_learn}')
|
||||
print('-' * 40)
|
||||
except Exception as e:
|
||||
pass
|
||||
"`, (err, stream) => {
|
||||
let out = '';
|
||||
stream.on('data', d => out += d);
|
||||
stream.on('close', () => {
|
||||
console.log(out);
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
const SftpClient = require('ssh2-sftp-client');
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const remoteScanScript = `
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = '/home/adminbackend/web/demoplace.my.id/public_html/.next';
|
||||
|
||||
const targetTitles = [
|
||||
'Overview Dashboard',
|
||||
'Summary Overview',
|
||||
'DPI MetaData',
|
||||
'BackOne Metadata',
|
||||
'Network Topology',
|
||||
'Network Infrastructure',
|
||||
'Traffic Categories',
|
||||
'Threat Intelligence',
|
||||
'Detected Threats',
|
||||
'App Lookup',
|
||||
'Application Database',
|
||||
'Encryption Audit',
|
||||
'Security & Encryption Audit'
|
||||
];
|
||||
|
||||
console.log('=== MATCHING TARGET TITLES IN REMOTE NEXT BUILD ===\\n');
|
||||
|
||||
function scan(dir) {
|
||||
if (!fs.existsSync(dir)) return;
|
||||
const items = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const item of items) {
|
||||
const full = path.join(dir, item.name);
|
||||
if (item.isDirectory()) {
|
||||
scan(full);
|
||||
} else if (item.name.endsWith('.js') || item.name.endsWith('.html')) {
|
||||
const content = fs.readFileSync(full, 'utf8');
|
||||
targetTitles.forEach(t => {
|
||||
if (content.includes(t)) {
|
||||
console.log(\`Found "\${t}" in file: \${path.relative(root, full)}\`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scan(root);
|
||||
`;
|
||||
|
||||
async function main() {
|
||||
const sftp = new SftpClient();
|
||||
await sftp.connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
|
||||
const remoteScriptPath = '/home/adminbackend/scan_strings.js';
|
||||
await sftp.put(Buffer.from(remoteScanScript), remoteScriptPath);
|
||||
await sftp.end();
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
conn.exec(`node ${remoteScriptPath}`, (err, stream) => {
|
||||
let out = '';
|
||||
stream.on('data', d => out += d);
|
||||
stream.on('close', () => {
|
||||
console.log(out);
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -0,0 +1,94 @@
|
||||
const SftpClient = require('ssh2-sftp-client');
|
||||
const { Client } = require('ssh2');
|
||||
|
||||
const remoteAuditScript = `
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = '/home/adminbackend/web/demoplace.my.id/public_html';
|
||||
|
||||
console.log('====================================================');
|
||||
console.log(' FULL COMPONENT & PAGE AUDIT OF DEMOPLACE.MY.ID ');
|
||||
console.log('====================================================');
|
||||
|
||||
// 1. Audit Client/Server Chunks for Page Headers & HelpTriggers
|
||||
const chunksDir = path.join(root, '.next/standalone/.next/server/chunks');
|
||||
if (fs.existsSync(chunksDir)) {
|
||||
const files = fs.readdirSync(chunksDir);
|
||||
files.forEach(f => {
|
||||
if (!f.endsWith('.js')) return;
|
||||
const content = fs.readFileSync(path.join(chunksDir, f), 'utf8');
|
||||
|
||||
// Look for page headers or title definitions
|
||||
const headerMatch = content.match(/["']([A-Z][A-Za-z0-9\\s]{3,35})["'],\\s*description:/);
|
||||
if (headerMatch) {
|
||||
console.log(\`[Chunk \${f}] Found Header Definition: "\${headerMatch[1]}"\`);
|
||||
}
|
||||
|
||||
if (content.includes('Learn This Page')) {
|
||||
console.log(\`[Chunk \${f}] Contains "Learn This Page" button\`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 2. Audit Page Source files in src/app/(dashboard)
|
||||
const appSrcDir = path.join(root, 'src/app/(dashboard)');
|
||||
if (fs.existsSync(appSrcDir)) {
|
||||
function scan(dir) {
|
||||
const items = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const item of items) {
|
||||
const full = path.join(dir, item.name);
|
||||
if (item.isDirectory()) {
|
||||
scan(full);
|
||||
} else if (item.name === 'page.tsx' || item.name.endsWith('.tsx')) {
|
||||
const content = fs.readFileSync(full, 'utf8');
|
||||
const rel = path.relative(appSrcDir, full);
|
||||
|
||||
// Find H2 or H1
|
||||
const h2 = content.match(/<h[12][^>]*>([\\s\\S]*?)<\\/h[12]>/i);
|
||||
const titleText = h2 ? h2[1].replace(/<[^>]+>/g, '').trim().split('\\n')[0] : 'None';
|
||||
const hasHelp = content.includes('HelpTrigger') || content.includes('Learn This Page');
|
||||
|
||||
console.log(\`Page File: \${rel}\`);
|
||||
console.log(\` Header Title : \${titleText}\`);
|
||||
console.log(\` Has HelpButton: \${hasHelp}\`);
|
||||
console.log('----------------------------------------------------');
|
||||
}
|
||||
}
|
||||
}
|
||||
scan(appSrcDir);
|
||||
}
|
||||
`;
|
||||
|
||||
async function main() {
|
||||
const sftp = new SftpClient();
|
||||
await sftp.connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
|
||||
const remoteScriptPath = '/home/adminbackend/audit_remote.js';
|
||||
await sftp.put(Buffer.from(remoteAuditScript), remoteScriptPath);
|
||||
await sftp.end();
|
||||
|
||||
const conn = new Client();
|
||||
conn.on('ready', () => {
|
||||
conn.exec(`node ${remoteScriptPath}`, (err, stream) => {
|
||||
let out = '';
|
||||
stream.on('data', d => out += d);
|
||||
stream.on('close', () => {
|
||||
console.log(out);
|
||||
conn.end();
|
||||
});
|
||||
});
|
||||
}).connect({
|
||||
host: '103.185.47.52',
|
||||
port: 2222,
|
||||
username: 'adminbackend',
|
||||
password: 'htEo7x6LsBQiEHHH'
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in new issue
Block a user