fix: resolve build — move main.go to root, fix Makefile wails path, update Wails to v2.12.0
- Moved main.go from cmd/app/ to project root (Wails convention) - Makefile now resolves wails binary via GOPATH/bin fallback - Updated wails/v2 dependency from v2.9.2 to v2.12.0 - Fixed preferences round-trip bug (store as single JSON blob) - Fixed import strategy test (needs non-empty profile data)
This commit is contained in:
+100
@@ -0,0 +1,100 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {models} from '../models';
|
||||
import {context} from '../models';
|
||||
|
||||
export function ClearSessionHistory(arg1:string):Promise<void>;
|
||||
|
||||
export function CloseAllSessions():Promise<void>;
|
||||
|
||||
export function ConnectQuick(arg1:models.Profile):Promise<string>;
|
||||
|
||||
export function ConnectSession(arg1:string):Promise<string>;
|
||||
|
||||
export function CreateProfile(arg1:models.Profile):Promise<models.Profile>;
|
||||
|
||||
export function DeleteKnownHost(arg1:string):Promise<void>;
|
||||
|
||||
export function DeleteProfile(arg1:string):Promise<void>;
|
||||
|
||||
export function DeleteProfileSecrets(arg1:string):Promise<void>;
|
||||
|
||||
export function DisconnectSession(arg1:string):Promise<void>;
|
||||
|
||||
export function DuplicateProfile(arg1:string):Promise<models.Profile>;
|
||||
|
||||
export function ExportProfiles(arg1:boolean):Promise<string>;
|
||||
|
||||
export function GetAppInfo():Promise<Record<string, string>>;
|
||||
|
||||
export function GetPreferences():Promise<models.AppPreferences>;
|
||||
|
||||
export function GetProfile(arg1:string):Promise<models.Profile>;
|
||||
|
||||
export function GetSessionHistory(arg1:string):Promise<Array<Record<string, any>>>;
|
||||
|
||||
export function ImportProfiles(arg1:string,arg2:string):Promise<number>;
|
||||
|
||||
export function InitialiseSecretStore(arg1:string):Promise<void>;
|
||||
|
||||
export function IsSecretStoreInitialised():Promise<boolean>;
|
||||
|
||||
export function IsSecretStoreUnlocked():Promise<boolean>;
|
||||
|
||||
export function ListAuditEntries(arg1:number):Promise<Array<models.AuditEntry>>;
|
||||
|
||||
export function ListFavourites():Promise<Array<models.Profile>>;
|
||||
|
||||
export function ListKnownHosts():Promise<Array<models.KnownHost>>;
|
||||
|
||||
export function ListProfiles():Promise<Array<models.Profile>>;
|
||||
|
||||
export function ListProfilesByFolder(arg1:string):Promise<Array<models.Profile>>;
|
||||
|
||||
export function ListProfilesByProtocol(arg1:string):Promise<Array<models.Profile>>;
|
||||
|
||||
export function ListProfilesByTag(arg1:string):Promise<Array<models.Profile>>;
|
||||
|
||||
export function ListSessions():Promise<Array<models.SessionInfo>>;
|
||||
|
||||
export function LockSecretStore():Promise<void>;
|
||||
|
||||
export function NewProfile(arg1:string):Promise<models.Profile>;
|
||||
|
||||
export function PinSession(arg1:string,arg2:boolean):Promise<void>;
|
||||
|
||||
export function ReconnectSession(arg1:string):Promise<void>;
|
||||
|
||||
export function RenameSession(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function ResizeSession(arg1:string,arg2:number,arg3:number):Promise<void>;
|
||||
|
||||
export function SaveFile(arg1:string,arg2:string):Promise<string>;
|
||||
|
||||
export function SavePreferences(arg1:models.AppPreferences):Promise<void>;
|
||||
|
||||
export function SaveSessionCapture(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function SearchProfiles(arg1:string):Promise<Array<models.Profile>>;
|
||||
|
||||
export function SelectFile(arg1:string,arg2:string):Promise<string>;
|
||||
|
||||
export function SendBreak(arg1:string):Promise<void>;
|
||||
|
||||
export function SetContext(arg1:context.Context):Promise<void>;
|
||||
|
||||
export function SetFavourite(arg1:string,arg2:boolean):Promise<void>;
|
||||
|
||||
export function SetProfileSecret(arg1:string,arg2:string,arg3:string):Promise<void>;
|
||||
|
||||
export function UnlockSecretStore(arg1:string):Promise<void>;
|
||||
|
||||
export function UpdateProfile(arg1:models.Profile):Promise<void>;
|
||||
|
||||
export function WriteSession(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function WriteSessionEscaped(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function WriteSessionHex(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function WriteSessionText(arg1:string,arg2:string):Promise<void>;
|
||||
Executable
+195
@@ -0,0 +1,195 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function ClearSessionHistory(arg1) {
|
||||
return window['go']['api']['Service']['ClearSessionHistory'](arg1);
|
||||
}
|
||||
|
||||
export function CloseAllSessions() {
|
||||
return window['go']['api']['Service']['CloseAllSessions']();
|
||||
}
|
||||
|
||||
export function ConnectQuick(arg1) {
|
||||
return window['go']['api']['Service']['ConnectQuick'](arg1);
|
||||
}
|
||||
|
||||
export function ConnectSession(arg1) {
|
||||
return window['go']['api']['Service']['ConnectSession'](arg1);
|
||||
}
|
||||
|
||||
export function CreateProfile(arg1) {
|
||||
return window['go']['api']['Service']['CreateProfile'](arg1);
|
||||
}
|
||||
|
||||
export function DeleteKnownHost(arg1) {
|
||||
return window['go']['api']['Service']['DeleteKnownHost'](arg1);
|
||||
}
|
||||
|
||||
export function DeleteProfile(arg1) {
|
||||
return window['go']['api']['Service']['DeleteProfile'](arg1);
|
||||
}
|
||||
|
||||
export function DeleteProfileSecrets(arg1) {
|
||||
return window['go']['api']['Service']['DeleteProfileSecrets'](arg1);
|
||||
}
|
||||
|
||||
export function DisconnectSession(arg1) {
|
||||
return window['go']['api']['Service']['DisconnectSession'](arg1);
|
||||
}
|
||||
|
||||
export function DuplicateProfile(arg1) {
|
||||
return window['go']['api']['Service']['DuplicateProfile'](arg1);
|
||||
}
|
||||
|
||||
export function ExportProfiles(arg1) {
|
||||
return window['go']['api']['Service']['ExportProfiles'](arg1);
|
||||
}
|
||||
|
||||
export function GetAppInfo() {
|
||||
return window['go']['api']['Service']['GetAppInfo']();
|
||||
}
|
||||
|
||||
export function GetPreferences() {
|
||||
return window['go']['api']['Service']['GetPreferences']();
|
||||
}
|
||||
|
||||
export function GetProfile(arg1) {
|
||||
return window['go']['api']['Service']['GetProfile'](arg1);
|
||||
}
|
||||
|
||||
export function GetSessionHistory(arg1) {
|
||||
return window['go']['api']['Service']['GetSessionHistory'](arg1);
|
||||
}
|
||||
|
||||
export function ImportProfiles(arg1, arg2) {
|
||||
return window['go']['api']['Service']['ImportProfiles'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function InitialiseSecretStore(arg1) {
|
||||
return window['go']['api']['Service']['InitialiseSecretStore'](arg1);
|
||||
}
|
||||
|
||||
export function IsSecretStoreInitialised() {
|
||||
return window['go']['api']['Service']['IsSecretStoreInitialised']();
|
||||
}
|
||||
|
||||
export function IsSecretStoreUnlocked() {
|
||||
return window['go']['api']['Service']['IsSecretStoreUnlocked']();
|
||||
}
|
||||
|
||||
export function ListAuditEntries(arg1) {
|
||||
return window['go']['api']['Service']['ListAuditEntries'](arg1);
|
||||
}
|
||||
|
||||
export function ListFavourites() {
|
||||
return window['go']['api']['Service']['ListFavourites']();
|
||||
}
|
||||
|
||||
export function ListKnownHosts() {
|
||||
return window['go']['api']['Service']['ListKnownHosts']();
|
||||
}
|
||||
|
||||
export function ListProfiles() {
|
||||
return window['go']['api']['Service']['ListProfiles']();
|
||||
}
|
||||
|
||||
export function ListProfilesByFolder(arg1) {
|
||||
return window['go']['api']['Service']['ListProfilesByFolder'](arg1);
|
||||
}
|
||||
|
||||
export function ListProfilesByProtocol(arg1) {
|
||||
return window['go']['api']['Service']['ListProfilesByProtocol'](arg1);
|
||||
}
|
||||
|
||||
export function ListProfilesByTag(arg1) {
|
||||
return window['go']['api']['Service']['ListProfilesByTag'](arg1);
|
||||
}
|
||||
|
||||
export function ListSessions() {
|
||||
return window['go']['api']['Service']['ListSessions']();
|
||||
}
|
||||
|
||||
export function LockSecretStore() {
|
||||
return window['go']['api']['Service']['LockSecretStore']();
|
||||
}
|
||||
|
||||
export function NewProfile(arg1) {
|
||||
return window['go']['api']['Service']['NewProfile'](arg1);
|
||||
}
|
||||
|
||||
export function PinSession(arg1, arg2) {
|
||||
return window['go']['api']['Service']['PinSession'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ReconnectSession(arg1) {
|
||||
return window['go']['api']['Service']['ReconnectSession'](arg1);
|
||||
}
|
||||
|
||||
export function RenameSession(arg1, arg2) {
|
||||
return window['go']['api']['Service']['RenameSession'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ResizeSession(arg1, arg2, arg3) {
|
||||
return window['go']['api']['Service']['ResizeSession'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function SaveFile(arg1, arg2) {
|
||||
return window['go']['api']['Service']['SaveFile'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function SavePreferences(arg1) {
|
||||
return window['go']['api']['Service']['SavePreferences'](arg1);
|
||||
}
|
||||
|
||||
export function SaveSessionCapture(arg1, arg2) {
|
||||
return window['go']['api']['Service']['SaveSessionCapture'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function SearchProfiles(arg1) {
|
||||
return window['go']['api']['Service']['SearchProfiles'](arg1);
|
||||
}
|
||||
|
||||
export function SelectFile(arg1, arg2) {
|
||||
return window['go']['api']['Service']['SelectFile'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function SendBreak(arg1) {
|
||||
return window['go']['api']['Service']['SendBreak'](arg1);
|
||||
}
|
||||
|
||||
export function SetContext(arg1) {
|
||||
return window['go']['api']['Service']['SetContext'](arg1);
|
||||
}
|
||||
|
||||
export function SetFavourite(arg1, arg2) {
|
||||
return window['go']['api']['Service']['SetFavourite'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function SetProfileSecret(arg1, arg2, arg3) {
|
||||
return window['go']['api']['Service']['SetProfileSecret'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function UnlockSecretStore(arg1) {
|
||||
return window['go']['api']['Service']['UnlockSecretStore'](arg1);
|
||||
}
|
||||
|
||||
export function UpdateProfile(arg1) {
|
||||
return window['go']['api']['Service']['UpdateProfile'](arg1);
|
||||
}
|
||||
|
||||
export function WriteSession(arg1, arg2) {
|
||||
return window['go']['api']['Service']['WriteSession'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WriteSessionEscaped(arg1, arg2) {
|
||||
return window['go']['api']['Service']['WriteSessionEscaped'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WriteSessionHex(arg1, arg2) {
|
||||
return window['go']['api']['Service']['WriteSessionHex'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function WriteSessionText(arg1, arg2) {
|
||||
return window['go']['api']['Service']['WriteSessionText'](arg1, arg2);
|
||||
}
|
||||
Executable
+410
@@ -0,0 +1,410 @@
|
||||
export namespace models {
|
||||
|
||||
export class AppPreferences {
|
||||
theme: string;
|
||||
defaultProtocol: string;
|
||||
confirmOnClose: boolean;
|
||||
confirmOnDisconnect: boolean;
|
||||
showStatusBar: boolean;
|
||||
sidebarWidth: number;
|
||||
defaultFontFamily: string;
|
||||
defaultFontSize: number;
|
||||
defaultScrollback: number;
|
||||
defaultCursorStyle: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AppPreferences(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.theme = source["theme"];
|
||||
this.defaultProtocol = source["defaultProtocol"];
|
||||
this.confirmOnClose = source["confirmOnClose"];
|
||||
this.confirmOnDisconnect = source["confirmOnDisconnect"];
|
||||
this.showStatusBar = source["showStatusBar"];
|
||||
this.sidebarWidth = source["sidebarWidth"];
|
||||
this.defaultFontFamily = source["defaultFontFamily"];
|
||||
this.defaultFontSize = source["defaultFontSize"];
|
||||
this.defaultScrollback = source["defaultScrollback"];
|
||||
this.defaultCursorStyle = source["defaultCursorStyle"];
|
||||
}
|
||||
}
|
||||
export class AuditEntry {
|
||||
id: string;
|
||||
// Go type: time
|
||||
timestamp: any;
|
||||
action: string;
|
||||
profileId?: string;
|
||||
sessionId?: string;
|
||||
details: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AuditEntry(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.timestamp = this.convertValues(source["timestamp"], null);
|
||||
this.action = source["action"];
|
||||
this.profileId = source["profileId"];
|
||||
this.sessionId = source["sessionId"];
|
||||
this.details = source["details"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class JumpHost {
|
||||
host: string;
|
||||
port: number;
|
||||
username: string;
|
||||
authMethod: string;
|
||||
secretMode: string;
|
||||
privateKeyPath: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new JumpHost(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.host = source["host"];
|
||||
this.port = source["port"];
|
||||
this.username = source["username"];
|
||||
this.authMethod = source["authMethod"];
|
||||
this.secretMode = source["secretMode"];
|
||||
this.privateKeyPath = source["privateKeyPath"];
|
||||
}
|
||||
}
|
||||
export class KnownHost {
|
||||
id: string;
|
||||
host: string;
|
||||
port: number;
|
||||
keyType: string;
|
||||
fingerprint: string;
|
||||
publicKey: string;
|
||||
// Go type: time
|
||||
firstSeen: any;
|
||||
// Go type: time
|
||||
lastSeen: any;
|
||||
trusted: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new KnownHost(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.host = source["host"];
|
||||
this.port = source["port"];
|
||||
this.keyType = source["keyType"];
|
||||
this.fingerprint = source["fingerprint"];
|
||||
this.publicKey = source["publicKey"];
|
||||
this.firstSeen = this.convertValues(source["firstSeen"], null);
|
||||
this.lastSeen = this.convertValues(source["lastSeen"], null);
|
||||
this.trusted = source["trusted"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class PayloadPreset {
|
||||
id: string;
|
||||
name: string;
|
||||
payload: string;
|
||||
format: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new PayloadPreset(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.name = source["name"];
|
||||
this.payload = source["payload"];
|
||||
this.format = source["format"];
|
||||
}
|
||||
}
|
||||
export class RAWConfig {
|
||||
autoReconnect: boolean;
|
||||
lineEnding: string;
|
||||
encoding: string;
|
||||
showTimestamps: boolean;
|
||||
showDirection: boolean;
|
||||
payloadPresets: PayloadPreset[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new RAWConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.autoReconnect = source["autoReconnect"];
|
||||
this.lineEnding = source["lineEnding"];
|
||||
this.encoding = source["encoding"];
|
||||
this.showTimestamps = source["showTimestamps"];
|
||||
this.showDirection = source["showDirection"];
|
||||
this.payloadPresets = this.convertValues(source["payloadPresets"], PayloadPreset);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class TelnetConfig {
|
||||
localEcho: boolean;
|
||||
lineEnding: string;
|
||||
terminalType: string;
|
||||
encoding: string;
|
||||
negotiationDebug: boolean;
|
||||
lineMode: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new TelnetConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.localEcho = source["localEcho"];
|
||||
this.lineEnding = source["lineEnding"];
|
||||
this.terminalType = source["terminalType"];
|
||||
this.encoding = source["encoding"];
|
||||
this.negotiationDebug = source["negotiationDebug"];
|
||||
this.lineMode = source["lineMode"];
|
||||
}
|
||||
}
|
||||
export class SSHConfig {
|
||||
authMethods: string[];
|
||||
secretMode: string;
|
||||
privateKeyPath: string;
|
||||
keySecretMode: string;
|
||||
hostKeyPolicy: string;
|
||||
terminalType: string;
|
||||
keepaliveInterval: number;
|
||||
keepaliveCountMax: number;
|
||||
compression: boolean;
|
||||
jumpHosts: JumpHost[];
|
||||
startupCommand: string;
|
||||
envVars: Record<string, string>;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new SSHConfig(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.authMethods = source["authMethods"];
|
||||
this.secretMode = source["secretMode"];
|
||||
this.privateKeyPath = source["privateKeyPath"];
|
||||
this.keySecretMode = source["keySecretMode"];
|
||||
this.hostKeyPolicy = source["hostKeyPolicy"];
|
||||
this.terminalType = source["terminalType"];
|
||||
this.keepaliveInterval = source["keepaliveInterval"];
|
||||
this.keepaliveCountMax = source["keepaliveCountMax"];
|
||||
this.compression = source["compression"];
|
||||
this.jumpHosts = this.convertValues(source["jumpHosts"], JumpHost);
|
||||
this.startupCommand = source["startupCommand"];
|
||||
this.envVars = source["envVars"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class Profile {
|
||||
id: string;
|
||||
displayName: string;
|
||||
description: string;
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
username: string;
|
||||
tags: string[];
|
||||
folder: string;
|
||||
environment: string;
|
||||
notes: string;
|
||||
favourite: boolean;
|
||||
// Go type: time
|
||||
lastConnected?: any;
|
||||
connectTimeout: number;
|
||||
readTimeout: number;
|
||||
// Go type: time
|
||||
createdAt: any;
|
||||
// Go type: time
|
||||
updatedAt: any;
|
||||
terminalFontFamily: string;
|
||||
terminalFontSize: number;
|
||||
terminalScrollback: number;
|
||||
terminalCursorStyle: string;
|
||||
ssh?: SSHConfig;
|
||||
telnet?: TelnetConfig;
|
||||
raw?: RAWConfig;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Profile(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.displayName = source["displayName"];
|
||||
this.description = source["description"];
|
||||
this.protocol = source["protocol"];
|
||||
this.host = source["host"];
|
||||
this.port = source["port"];
|
||||
this.username = source["username"];
|
||||
this.tags = source["tags"];
|
||||
this.folder = source["folder"];
|
||||
this.environment = source["environment"];
|
||||
this.notes = source["notes"];
|
||||
this.favourite = source["favourite"];
|
||||
this.lastConnected = this.convertValues(source["lastConnected"], null);
|
||||
this.connectTimeout = source["connectTimeout"];
|
||||
this.readTimeout = source["readTimeout"];
|
||||
this.createdAt = this.convertValues(source["createdAt"], null);
|
||||
this.updatedAt = this.convertValues(source["updatedAt"], null);
|
||||
this.terminalFontFamily = source["terminalFontFamily"];
|
||||
this.terminalFontSize = source["terminalFontSize"];
|
||||
this.terminalScrollback = source["terminalScrollback"];
|
||||
this.terminalCursorStyle = source["terminalCursorStyle"];
|
||||
this.ssh = this.convertValues(source["ssh"], SSHConfig);
|
||||
this.telnet = this.convertValues(source["telnet"], TelnetConfig);
|
||||
this.raw = this.convertValues(source["raw"], RAWConfig);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class SessionInfo {
|
||||
id: string;
|
||||
profileId: string;
|
||||
profileName: string;
|
||||
protocol: string;
|
||||
host: string;
|
||||
port: number;
|
||||
state: string;
|
||||
tabName: string;
|
||||
pinned: boolean;
|
||||
// Go type: time
|
||||
connectedAt: any;
|
||||
error?: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new SessionInfo(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.profileId = source["profileId"];
|
||||
this.profileName = source["profileName"];
|
||||
this.protocol = source["protocol"];
|
||||
this.host = source["host"];
|
||||
this.port = source["port"];
|
||||
this.state = source["state"];
|
||||
this.tabName = source["tabName"];
|
||||
this.pinned = source["pinned"];
|
||||
this.connectedAt = this.convertValues(source["connectedAt"], null);
|
||||
this.error = source["error"];
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user