Add Go project scaffold for Wails v2 SSH/Telnet/RAW TCP client

- go.mod with Wails v2.9.2, x/crypto, go-sqlite3, go-keyring, uuid
- cmd/app/main.go: Wails entry point (Nexus Terminal, 1400x900, #1a1a2e)
- internal/app/app.go: lifecycle (Startup/Shutdown/DomReady)
- internal/models/models.go: full model definitions (Profile, SSHConfig,
  TelnetConfig, RAWConfig, SessionInfo, KnownHost, AppPreferences, etc.)
- internal/models/defaults.go: default values and NewProfile factory
- internal/validation/validation.go: thorough field-level validation
- frontend/embed.go: embedded frontend assets
- Updated existing storage, secrets, config to match new model structure
This commit is contained in:
2026-04-15 00:00:00 +01:00
commit 35bc9c75b1
36 changed files with 6226 additions and 0 deletions
+83
View File
@@ -0,0 +1,83 @@
/**
* copy-assets.js — Copies xterm library assets from node_modules into
* the frontend source tree so they can be served directly by Wails.
*
* Run automatically via the postinstall hook in package.json.
*/
'use strict';
const fs = require('fs');
const path = require('path');
const frontendDir = path.resolve(__dirname, '..');
// Mapping: source (relative to node_modules) → destination (relative to frontend/)
const assets = [
{
src: 'xterm/css/xterm.css',
dest: 'src/css/lib/xterm.css',
},
{
src: 'xterm/lib/xterm.js',
dest: 'src/js/lib/xterm.min.js',
},
{
src: 'xterm-addon-fit/lib/xterm-addon-fit.js',
dest: 'src/js/lib/xterm-addon-fit.min.js',
},
{
src: 'xterm-addon-search/lib/xterm-addon-search.js',
dest: 'src/js/lib/xterm-addon-search.min.js',
},
{
src: 'xterm-addon-web-links/lib/xterm-addon-web-links.js',
dest: 'src/js/lib/xterm-addon-web-links.min.js',
},
];
/**
* Ensures the parent directory of the given file path exists.
*/
function ensureDir(filePath) {
const dir = path.dirname(filePath);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
}
/**
* Copies a single asset, logging the result.
*/
function copyAsset(entry) {
const srcPath = path.join(frontendDir, 'node_modules', entry.src);
const destPath = path.join(frontendDir, entry.dest);
if (!fs.existsSync(srcPath)) {
console.error(` ✗ Source not found: ${entry.src}`);
return false;
}
ensureDir(destPath);
fs.copyFileSync(srcPath, destPath);
console.log(` ✓ ${entry.src} → ${entry.dest}`);
return true;
}
// --- Main ---
console.log('[copy-assets] Copying xterm library files…');
let failures = 0;
for (const entry of assets) {
if (!copyAsset(entry)) {
failures++;
}
}
if (failures > 0) {
console.error(`\n[copy-assets] ${failures} file(s) could not be copied.`);
console.error('[copy-assets] Have you run "npm install" first?');
process.exit(1);
}
console.log('[copy-assets] All assets copied successfully.');