good commit

This commit is contained in:
EthanShoeDev
2025-09-21 20:58:44 -04:00
parent 05c05f364f
commit b885beb262
6 changed files with 27 additions and 18 deletions

View File

@@ -42,6 +42,7 @@
"build:native": "tsx scripts/native-build.ts",
"build:bob": "bob build",
"lint:rust": "cd rust/uniffi-russh && just lint",
"update-rust": "cd rust/uniffi-russh && just update-deps",
"test": "jest",
"release": "release-it --only-version"
},

View File

@@ -6,6 +6,10 @@ default:
lint:
cargo clippy --all-targets --all-features -- -D warnings
# Update all Cargo dependencies to the latest allowed by Cargo.toml
update-deps:
cargo update
# Run crate tests
test:
cargo test

View File

@@ -147,13 +147,18 @@ export type SshShell = {
type RusshApi = {
uniffiInitAsync: () => Promise<void>;
connect: (opts: ConnectOptions) => Promise<SshConnection>;
generateKeyPair: (type: 'rsa' | 'ecdsa' | 'ed25519',
generateKeyPair: (
type: 'rsa' | 'ecdsa' | 'ed25519'
// TODO: Add these
// passphrase?: string;
// keySize?: number;
// comment?: string;
) => Promise<string>;
validatePrivateKey: (key: string) => { valid: true; error?: never } | { valid: false; error: GeneratedRussh.SshError };
validatePrivateKey: (
key: string
) =>
| { valid: true; error?: never }
| { valid: false; error: GeneratedRussh.SshError };
};
// #endregion
@@ -196,8 +201,6 @@ const streamEnumToLiteral = {
[GeneratedRussh.StreamKind.Stderr]: 'stderr',
} as const satisfies Record<GeneratedRussh.StreamKind, StreamKind>;
function generatedConnDetailsToIdeal(
details: GeneratedRussh.ConnectionDetails
): ConnectionDetails {
@@ -314,13 +317,13 @@ function wrapConnection(
tcpEstablishedAtMs: info.progressTimings.tcpEstablishedAtMs,
sshHandshakeAtMs: info.progressTimings.sshHandshakeAtMs,
},
startShell: async (params) => {
startShell: async ({ onClosed, ...params }) => {
const shell = await conn.startShell(
{
term: terminalTypeLiteralToEnum[params.term],
onClosedCallback: params.onClosed
onClosedCallback: onClosed
? {
onChange: (channelId) => params.onClosed!(channelId),
onChange: (channelId) => onClosed(channelId),
}
: undefined,
terminalMode: params.terminalMode,
@@ -381,7 +384,11 @@ async function generateKeyPair(type: 'rsa' | 'ecdsa' | 'ed25519') {
return GeneratedRussh.generateKeyPair(map[type]);
}
function validatePrivateKey(key: string): { valid: true; error?: never } | { valid: false; error: GeneratedRussh.SshError } {
function validatePrivateKey(
key: string
):
| { valid: true; error?: never }
| { valid: false; error: GeneratedRussh.SshError } {
try {
GeneratedRussh.validatePrivateKey(key);
return { valid: true };

View File

@@ -14,10 +14,9 @@ export type BridgeOutboundMessage =
| { type: 'resize'; cols: number; rows: number }
| { type: 'fit' }
| {
type: 'setOptions'; opts: Partial<
Omit<ITerminalOptions, keyof ITerminalInitOnlyOptions>
>
}
type: 'setOptions';
opts: Partial<Omit<ITerminalOptions, keyof ITerminalInitOnlyOptions>>;
}
| { type: 'clear' }
| { type: 'focus' };

View File

@@ -8,9 +8,7 @@ const logExternal: boolean = false;
export default defineConfig({
plugins: [
react({
}),
react({}),
dts({
tsconfigPath: './tsconfig.app.json',
// This makes dist/ look nice but breaks Cmd + Click