update structure
This commit is contained in:
parent
6339a3ed9b
commit
5b1f800067
5
dist/smartssh.classes.sshconfig.d.ts
vendored
5
dist/smartssh.classes.sshconfig.d.ts
vendored
@ -6,10 +6,11 @@ export declare class SshConfig {
|
||||
/**
|
||||
* stores a config file
|
||||
*/
|
||||
storeConfig(dirPathArg: string): any;
|
||||
store(dirPathArg: string): any;
|
||||
read(dirPathArg: any): any;
|
||||
}
|
||||
export interface configObject {
|
||||
host: string;
|
||||
configString: string;
|
||||
authorized: boolean;
|
||||
sshKey: SshKey;
|
||||
}
|
||||
|
31
dist/smartssh.classes.sshconfig.js
vendored
31
dist/smartssh.classes.sshconfig.js
vendored
@ -8,7 +8,32 @@ var SshConfig = (function () {
|
||||
/**
|
||||
* stores a config file
|
||||
*/
|
||||
SshConfig.prototype.storeConfig = function (dirPathArg) {
|
||||
SshConfig.prototype.store = function (dirPathArg) {
|
||||
var done = plugins.q.defer();
|
||||
var configArray;
|
||||
var configString;
|
||||
for (var key in this.sshKeyArray) {
|
||||
var sshKey = this.sshKeyArray[key];
|
||||
if (sshKey.host) {
|
||||
configString = "Host " + sshKey.host + "\n" +
|
||||
" HostName " + sshKey.host + "\n" +
|
||||
" IdentityFile ~/.ssh/" + sshKey.host + "\n";
|
||||
}
|
||||
configArray.push({
|
||||
configString: configString,
|
||||
authorized: sshKey.authorized,
|
||||
sshKey: sshKey
|
||||
});
|
||||
}
|
||||
var configFile = "";
|
||||
for (var key in configArray) {
|
||||
configFile = configFile + configArray[key].configString + "\n";
|
||||
}
|
||||
;
|
||||
plugins.smartfile.memory.toFsSync(configFile, dirPathArg);
|
||||
return done.promise;
|
||||
};
|
||||
SshConfig.prototype.read = function (dirPathArg) {
|
||||
var done = plugins.q.defer();
|
||||
var configArray;
|
||||
return done.promise;
|
||||
@ -17,8 +42,6 @@ var SshConfig = (function () {
|
||||
}());
|
||||
exports.SshConfig = SshConfig;
|
||||
;
|
||||
var createConfigPath = function () {
|
||||
};
|
||||
;
|
||||
|
||||
//#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Qga2V5IGluIHRoaXMuc3NoS2V5QXJyYXkpe1xuICAgICAgICAgICAgbGV0IHNzaEtleSA9IHRoaXMuc3NoS2V5QXJyYXlba2V5XTtcbiAgICAgICAgICAgIGlmKHNzaEtleS5ob3N0KXtcbiAgICAgICAgICAgICAgICBjb25maWdTdHJpbmcgPSBcIkhvc3QgXCIgKyBzc2hLZXkuaG9zdCArIFwiXFxuXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiAgSG9zdE5hbWUgXCIgKyBzc2hLZXkuaG9zdCArIFwiXFxuXCIgK1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcIiAgSWRlbnRpdHlGaWxlIH4vLnNzaC9cIiArIHNzaEtleS5ob3N0ICsgXCJcXG5cIlxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY29uZmlnQXJyYXkucHVzaCh7XG4gICAgICAgICAgICAgICAgY29uZmlnU3RyaW5nOmNvbmZpZ1N0cmluZyxcbiAgICAgICAgICAgICAgICBhdXRob3JpemVkOiBzc2hLZXkuYXV0aG9yaXplZCxcbiAgICAgICAgICAgICAgICBzc2hLZXk6IHNzaEtleVxuICAgICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgbGV0IGNvbmZpZ0ZpbGU6c3RyaW5nID0gXCJcIjtcbiAgICAgICAgZm9yKGxldCBrZXkgaW4gY29uZmlnQXJyYXkpe1xuICAgICAgICAgICAgY29uZmlnRmlsZSA9IGNvbmZpZ0ZpbGUgKyBjb25maWdBcnJheVtrZXldLmNvbmZpZ1N0cmluZyArIFwiXFxuXCI7XG4gICAgICAgIH07XG4gICAgICAgIHBsdWdpbnMuc21hcnRmaWxlLm1lbW9yeS50b0ZzU3luYyhjb25maWdGaWxlLGRpclBhdGhBcmcpO1xuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cbiAgICByZWFkKGRpclBhdGhBcmcpe1xuICAgICAgICBsZXQgZG9uZSA9IHBsdWdpbnMucS5kZWZlcigpO1xuICAgICAgICBsZXQgY29uZmlnQXJyYXk6Y29uZmlnT2JqZWN0W107XG4gICAgICAgIFxuICAgICAgICByZXR1cm4gZG9uZS5wcm9taXNlO1xuICAgIH1cbn07XG5cbmV4cG9ydCBpbnRlcmZhY2UgY29uZmlnT2JqZWN0IHtcbiAgICBjb25maWdTdHJpbmc6c3RyaW5nO1xuICAgIGF1dGhvcml6ZWQ6Ym9vbGVhbjtcbiAgICBzc2hLZXk6U3NoS2V5O1xufTtcblxuIl19
|
||||
|
4
dist/smartssh.classes.sshdir.d.ts
vendored
4
dist/smartssh.classes.sshdir.d.ts
vendored
@ -1,9 +1,11 @@
|
||||
import "typings-global";
|
||||
import { SshKey } from "./smartssh.classes.sshkey";
|
||||
import { SshConfig } from "./smartssh.classes.sshconfig";
|
||||
export declare class SshDir {
|
||||
path: string;
|
||||
private sshKeyArray;
|
||||
constructor(sshKeyArray: SshKey[], sshDirPathArg?: string);
|
||||
private sshConfig;
|
||||
constructor(sshKeyArray: SshKey[], sshConfig: SshConfig, sshDirPathArg?: string);
|
||||
writeToDir(): void;
|
||||
readFromDir(): void;
|
||||
getKeys(): SshKey[];
|
||||
|
5
dist/smartssh.classes.sshdir.js
vendored
5
dist/smartssh.classes.sshdir.js
vendored
@ -3,7 +3,7 @@ require("typings-global");
|
||||
var plugins = require("./smartssh.plugins");
|
||||
var helpers = require("./smartssh.classes.helpers");
|
||||
var SshDir = (function () {
|
||||
function SshDir(sshKeyArray, sshDirPathArg) {
|
||||
function SshDir(sshKeyArray, sshConfig, sshDirPathArg) {
|
||||
this.sshKeyArray = sshKeyArray;
|
||||
if (sshDirPathArg) {
|
||||
this.path = sshDirPathArg;
|
||||
@ -18,6 +18,7 @@ var SshDir = (function () {
|
||||
this.sshKeyArray.forEach(function (sshKeyArg) {
|
||||
sshKeyArg.store(_this.path);
|
||||
});
|
||||
this.sshConfig.store(this.path);
|
||||
};
|
||||
;
|
||||
SshDir.prototype.readFromDir = function () {
|
||||
@ -29,4 +30,4 @@ var SshDir = (function () {
|
||||
}());
|
||||
exports.SshDir = SshDir;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsSUFBWSxPQUFPLFdBQU0sb0JBQW9CLENBQUMsQ0FBQTtBQUM5QyxJQUFZLE9BQU8sV0FBTSw0QkFBNEIsQ0FBQyxDQUFBO0FBSXREO0lBR0ksZ0JBQVksV0FBb0IsRUFBQyxhQUFxQjtRQUNsRCxJQUFJLENBQUMsV0FBVyxHQUFHLFdBQVcsQ0FBQztRQUMvQixFQUFFLENBQUEsQ0FBQyxhQUFhLENBQUMsQ0FBQSxDQUFDO1lBQ2QsSUFBSSxDQUFDLElBQUksR0FBRyxhQUFhLENBQUM7UUFDOUIsQ0FBQztRQUFDLElBQUksQ0FBQyxDQUFDO1lBQ0osSUFBSSxDQUFDLElBQUksR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsRUFBQyxPQUFPLENBQUMsQ0FBQztRQUN4RSxDQUFDO1FBQUEsQ0FBQztJQUNOLENBQUM7SUFDRCwyQkFBVSxHQUFWO1FBQUEsaUJBS0M7UUFKRyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxVQUFDLFNBQVM7WUFDL0IsU0FBUyxDQUFDLEtBQUssQ0FBQyxLQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7UUFFL0IsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDOztJQUNELDRCQUFXLEdBQVg7SUFFQSxDQUFDO0lBQ0Qsd0JBQU8sR0FBUDtRQUN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G9yZSh0aGlzLnBhdGgpO1xuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy5zc2hDb25maWcuc3RvcmUodGhpcy5wYXRoKTtcbiAgICB9O1xuICAgIHJlYWRGcm9tRGlyKCl7IC8vIHN5bmNzIHNzaEluc3RhbmNlIGZyb20gZGlyZWN0b3J5XG4gICAgICAgIFxuICAgIH1cbiAgICBnZXRLZXlzKCl7XG4gICAgICAgIHJldHVybiBoZWxwZXJzLnNzaEtleUFycmF5RnJvbURpcih0aGlzLnBhdGgpO1xuICAgIH1cbn0iXX0=
|
||||
|
4
dist/smartssh.classes.sshinstance.js
vendored
4
dist/smartssh.classes.sshinstance.js
vendored
File diff suppressed because one or more lines are too long
3
dist/smartssh.classes.sshkey.d.ts
vendored
3
dist/smartssh.classes.sshkey.d.ts
vendored
@ -15,7 +15,8 @@ export declare class SshKey {
|
||||
privKeyBase64: string;
|
||||
pubKey: string;
|
||||
pubKeyBase64: string;
|
||||
authorized: boolean;
|
||||
type: any;
|
||||
read(filePathArg: any): void;
|
||||
store(filePathArg?: string): void;
|
||||
store(dirPathArg?: string): void;
|
||||
}
|
||||
|
31
dist/smartssh.classes.sshkey.js
vendored
31
dist/smartssh.classes.sshkey.js
vendored
File diff suppressed because one or more lines are too long
@ -1,3 +1,4 @@
|
||||
{
|
||||
"mode":"default"
|
||||
"mode":"default",
|
||||
"coverageTreshold":50
|
||||
}
|
@ -12,21 +12,40 @@ export class SshConfig {
|
||||
/**
|
||||
* stores a config file
|
||||
*/
|
||||
storeConfig(dirPathArg:string){
|
||||
store(dirPathArg:string){
|
||||
let done = plugins.q.defer();
|
||||
let configArray:configObject[];
|
||||
let configString;
|
||||
for(let key in this.sshKeyArray){
|
||||
let sshKey = this.sshKeyArray[key];
|
||||
if(sshKey.host){
|
||||
configString = "Host " + sshKey.host + "\n" +
|
||||
" HostName " + sshKey.host + "\n" +
|
||||
" IdentityFile ~/.ssh/" + sshKey.host + "\n"
|
||||
}
|
||||
configArray.push({
|
||||
configString:configString,
|
||||
authorized: sshKey.authorized,
|
||||
sshKey: sshKey
|
||||
});
|
||||
}
|
||||
let configFile:string = "";
|
||||
for(let key in configArray){
|
||||
configFile = configFile + configArray[key].configString + "\n";
|
||||
};
|
||||
plugins.smartfile.memory.toFsSync(configFile,dirPathArg);
|
||||
return done.promise;
|
||||
}
|
||||
read(dirPathArg){
|
||||
let done = plugins.q.defer();
|
||||
let configArray:configObject[];
|
||||
|
||||
return done.promise;
|
||||
}
|
||||
readConfig
|
||||
};
|
||||
|
||||
let createConfigPath = () => {
|
||||
|
||||
}
|
||||
|
||||
export interface configObject {
|
||||
host:string;
|
||||
configString:string;
|
||||
authorized:boolean;
|
||||
sshKey:SshKey;
|
||||
};
|
||||
|
@ -7,7 +7,8 @@ import {SshConfig} from "./smartssh.classes.sshconfig";
|
||||
export class SshDir { // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
|
||||
path:string; // the path of the ssh directory
|
||||
private sshKeyArray:SshKey[];
|
||||
constructor(sshKeyArray:SshKey[],sshDirPathArg?:string){
|
||||
private sshConfig:SshConfig;
|
||||
constructor(sshKeyArray:SshKey[],sshConfig:SshConfig,sshDirPathArg?:string){
|
||||
this.sshKeyArray = sshKeyArray;
|
||||
if(sshDirPathArg){
|
||||
this.path = sshDirPathArg;
|
||||
@ -18,8 +19,8 @@ export class SshDir { // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
|
||||
writeToDir(){ // syncs sshInstance to directory
|
||||
this.sshKeyArray.forEach((sshKeyArg) => {
|
||||
sshKeyArg.store(this.path);
|
||||
|
||||
});
|
||||
this.sshConfig.store(this.path);
|
||||
};
|
||||
readFromDir(){ // syncs sshInstance from directory
|
||||
|
||||
|
@ -15,7 +15,7 @@ export class SshInstance {
|
||||
optionsArg ? void(0) : optionsArg = {};
|
||||
this._sshKeyArray = [];
|
||||
this._sshConfig = new SshConfig(this._sshKeyArray);
|
||||
this._sshDir = new SshDir(this._sshKeyArray,optionsArg.sshDirPath);
|
||||
this._sshDir = new SshDir(this._sshKeyArray,this._sshConfig,optionsArg.sshDirPath);
|
||||
this._sshSync = optionsArg.sshSync;
|
||||
};
|
||||
|
||||
@ -101,5 +101,3 @@ export class SshInstance {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,12 @@ export class SshKey {
|
||||
this._pubKey = plugins.base64.decode(publicKeyArg);
|
||||
}
|
||||
|
||||
|
||||
get authorized(){
|
||||
return this._authorized;
|
||||
}
|
||||
set authorized(authorizedArg:boolean){
|
||||
this._authorized = authorizedArg;
|
||||
}
|
||||
get type(){
|
||||
if(this._privKey && this._pubKey){
|
||||
return "duplex";
|
||||
|
Loading…
Reference in New Issue
Block a user