-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor ssh connection flow #3
Signed-off-by: seven <[email protected]>
- Loading branch information
Showing
19 changed files
with
240 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Store } from 'tauri-plugin-store-api'; | ||
|
||
export const secretClient = new Store('.secrets.st'); | ||
export const connectionClient = new Store('.connections.st'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { isTauri } from '../common'; | ||
import { connectionClient } from './clients/storeClient.ts'; | ||
import { Connection } from '../store'; | ||
|
||
const getConnections = async () => { | ||
if (isTauri()) { | ||
return connectionClient.values(); | ||
} | ||
}; | ||
const saveConnection = async (connection: Connection) => { | ||
if (isTauri()) { | ||
await connectionClient.set(`${connection.id}`, connection); | ||
|
||
await connectionClient.save(); | ||
} | ||
}; | ||
|
||
const removeConnection = async ({ id }: Connection) => { | ||
if (isTauri()) { | ||
await connectionClient.delete(`${id}`); | ||
|
||
await connectionClient.save(); | ||
} | ||
}; | ||
|
||
export const loadConnectionDataSource = () => ({ | ||
getConnections, | ||
saveConnection, | ||
removeConnection, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { loadSecretsDataSource } from './secretDataSource.ts'; | ||
export { loadConnectionDataSource } from './connectionDataSource.ts'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Secret } from '../store'; | ||
import { isTauri } from '../common'; | ||
import { secretClient } from './clients/storeClient.ts'; | ||
const saveSecret = async (secret: Secret) => { | ||
if (isTauri()) { | ||
await secretClient.set(`${secret.id}`, secret); | ||
|
||
await secretClient.save(); | ||
} | ||
}; | ||
const removeSecret = async (secret: Secret) => { | ||
if (isTauri()) { | ||
await secretClient.delete(`${secret.id}`); | ||
|
||
await secretClient.save(); | ||
} | ||
}; | ||
|
||
const getSecrets = async () => { | ||
if (isTauri()) { | ||
return secretClient.values(); | ||
} | ||
}; | ||
|
||
export const loadSecretsDataSource = () => ({ | ||
saveSecret, | ||
removeSecret, | ||
getSecrets, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.