rdesktop2
filip mertens 1 year ago
parent 8edd1925b7
commit 0483d13e56
  1. 6
      apps/1test/src/remix/ui/remix-ui-xterminals.tsx
  2. 3
      apps/remix-ide/src/app.js
  3. 19
      apps/remix-ide/src/app/files/dgitProvider.js
  4. 2
      apps/remix-ide/src/app/files/electronProvider.ts
  5. 4
      apps/remix-ide/src/app/plugins/electron/xtermPlugin.ts
  6. 1
      apps/remix-ide/src/app/plugins/parser/code-parser.tsx
  7. 9
      apps/remixdesktop/src/engine.ts
  8. 120
      apps/remixdesktop/src/main.ts
  9. 3
      apps/remixdesktop/src/plugins/configPlugin.ts
  10. 25
      apps/remixdesktop/src/plugins/fsPlugin.ts
  11. 63
      apps/remixdesktop/src/plugins/isoGitPlugin.ts
  12. 7
      apps/remixdesktop/src/plugins/templates.ts
  13. 24
      apps/remixdesktop/src/plugins/xtermPlugin.ts
  14. 12
      apps/remixdesktop/src/preload.ts
  15. 1
      apps/remixdesktop/src/tools/git.ts
  16. 3
      libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx
  17. 1
      libs/remix-ui/panel/src/lib/plugins/panel-plugin.tsx
  18. 2
      libs/remix-ui/workspace/src/lib/actions/index.ts
  19. 2
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  20. 7
      libs/remix-ui/workspace/src/lib/components/electron-menu.tsx
  21. 3
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  22. 12
      libs/remix-ui/xterm/src/lib/components/remix-ui-xterm.tsx
  23. 16
      libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx
  24. 3
      libs/remix-ui/xterm/src/lib/components/xterm-fit-addOn.ts
  25. 3
      libs/remix-ui/xterm/src/lib/components/xterm-wrap.tsx

@ -48,11 +48,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
}) })
} }
useEffect(() => {
console.log('terminals', terminals)
}, [terminals])
const send = (data: string, pid: number) => { const send = (data: string, pid: number) => {
plugin.call('xterm', 'keystroke', data, pid) plugin.call('xterm', 'keystroke', data, pid)
} }
@ -71,7 +66,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
} }
const setTerminalRef = (pid: number, ref: any) => { const setTerminalRef = (pid: number, ref: any) => {
console.log('setTerminalRef', pid, ref)
setTerminals(prevState => { setTerminals(prevState => {
const terminal = prevState.find(xtermState => xtermState.pid === pid) const terminal = prevState.find(xtermState => xtermState.pid === pid)
terminal.ref = ref terminal.ref = ref

@ -88,9 +88,6 @@ const { TabProxy } = require('./app/panels/tab-proxy.js')
class AppComponent { class AppComponent {
constructor() { constructor() {
console.log(window.electronAPI)
console.log(window.api)
this.appManager = new RemixAppManager({}) this.appManager = new RemixAppManager({})
this.queryParams = new QueryParams() this.queryParams = new QueryParams()
this._components = {} this._components = {}

@ -104,16 +104,16 @@ class DGitProvider extends Plugin {
if (isElectron()) { if (isElectron()) {
const status = await this.call('isogit', 'status', cmd) const status = await this.call('isogit', 'status', cmd)
console.log('STATUS', status)
return status return status
} }
console.log('status')
const status = await git.statusMatrix({ const status = await git.statusMatrix({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('STATUS', status)
return status return status
} }
@ -132,7 +132,7 @@ class DGitProvider extends Plugin {
} }
async rm(cmd) { async rm(cmd) {
console.log('rm', cmd)
if (isElectron()) { if (isElectron()) {
await this.call('isogit', 'rm', cmd) await this.call('isogit', 'rm', cmd)
} else { } else {
@ -146,7 +146,7 @@ class DGitProvider extends Plugin {
} }
async reset(cmd) { async reset(cmd) {
console.log('rm', cmd)
if (isElectron()) { if (isElectron()) {
await this.call('isogit', 'reset', cmd) await this.call('isogit', 'reset', cmd)
} else { } else {
@ -184,7 +184,7 @@ class DGitProvider extends Plugin {
...cmd, ...cmd,
depth: 10 depth: 10
}) })
console.log('STATUS', status)
return status return status
} }
@ -233,12 +233,10 @@ class DGitProvider extends Plugin {
async currentbranch(config) { async currentbranch(config) {
console.log('currentbranch')
if (isElectron()) { if (isElectron()) {
console.log('currentbranch electron')
return await this.call('isogit', 'currentbranch') return await this.call('isogit', 'currentbranch')
} }
try { try {
@ -329,10 +327,8 @@ class DGitProvider extends Plugin {
} }
async readblob(cmd) { async readblob(cmd) {
console.log('readblob', cmd)
if (isElectron()) { if (isElectron()) {
const readBlobResult = await this.call('isogit', 'readblob', cmd) const readBlobResult = await this.call('isogit', 'readblob', cmd)
console.log('readblob', readBlobResult)
return readBlobResult return readBlobResult
} }
const readBlobResult = await git.readBlob({ const readBlobResult = await git.readBlob({
@ -385,7 +381,6 @@ class DGitProvider extends Plugin {
if (isElectron()) { if (isElectron()) {
const folder = await this.call('fs', 'selectFolder') const folder = await this.call('fs', 'selectFolder')
if (!folder) return false if (!folder) return false
console.log('folder', folder)
const cmd = { const cmd = {
url: input.url, url: input.url,
singleBranch: input.singleBranch, singleBranch: input.singleBranch,

@ -15,7 +15,6 @@ export class ElectronProvider extends FileProvider {
async init() { async init() {
this._appManager.on('fs', 'change', (event, path) => { this._appManager.on('fs', 'change', (event, path) => {
console.log('change', event, path)
switch (event) { switch (event) {
case 'add': case 'add':
this.event.emit('fileAdded', path) this.event.emit('fileAdded', path)
@ -47,7 +46,6 @@ export class ElectronProvider extends FileProvider {
if (path.indexOf('/') !== 0) path = '/' + path if (path.indexOf('/') !== 0) path = '/' + path
try { try {
const files = await window.remixFileSystem.readdir(path) const files = await window.remixFileSystem.readdir(path)
console.log(files.length, 'files resolveDirectory ELECTRON')
const ret = {} const ret = {}
if (files) { if (files) {
for (let element of files) { for (let element of files) {

@ -8,8 +8,4 @@ export class xtermPlugin extends ElectronPlugin {
description: 'xterm', description: 'xterm',
}) })
} }
onActivation(){
console.log('xtermPlugin Activated')
}
} }

@ -125,7 +125,6 @@ export class CodeParser extends Plugin {
}) })
this.on('filePanel', 'setWorkspace', async () => { this.on('filePanel', 'setWorkspace', async () => {
console.log('setWorkspace')
await this.call('fileDecorator', 'clearFileDecorators') await this.call('fileDecorator', 'clearFileDecorators')
await this.importService.setFileTree() await this.importService.setFileTree()
}) })

@ -27,28 +27,23 @@ appManager.activatePlugin('fs')
ipcMain.handle('manager:activatePlugin', async (event, plugin) => { ipcMain.handle('manager:activatePlugin', async (event, plugin) => {
console.log('manager:activatePlugin', plugin, event.sender.id)
return await appManager.call(plugin, 'createClient', event.sender.id) return await appManager.call(plugin, 'createClient', event.sender.id)
}) })
ipcMain.on('fs:openFolder', async (event) => { ipcMain.on('fs:openFolder', async (event) => {
console.log('fs:openFolder', event)
fsPlugin.openFolder(event) fsPlugin.openFolder(event)
}) })
ipcMain.on('terminal:new', async (event) => { ipcMain.on('terminal:new', async (event) => {
console.log('terminal:new', event)
xtermPlugin.new(event) xtermPlugin.new(event)
}) })
ipcMain.on('template:open', async (event) => { ipcMain.on('template:open', async (event) => {
console.log('template:open', event)
templatesPlugin.openTemplate(event) templatesPlugin.openTemplate(event)
}) })
ipcMain.on('git:startclone', async (event) => { ipcMain.on('git:startclone', async (event) => {
console.log('git:startclone', event)
isoGitPlugin.startClone(event) isoGitPlugin.startClone(event)
}) })
@ -60,9 +55,7 @@ ipcMain.handle('getWebContentsID', (event, message) => {
app.on('before-quit', async (event) => { app.on('before-quit', async (event) => {
//event.preventDefault()
console.log('before-quit')
await appManager.call('fs', 'removeCloseListener') await appManager.call('fs', 'removeCloseListener')
await appManager.call('fs', 'closeWatch') await appManager.call('fs', 'closeWatch')
//app.quit() await appManager.call('xterm', 'closeTerminals')
}) })

@ -90,13 +90,11 @@ const showAbout = () => {
const isMac = process.platform === 'darwin' const isMac = process.platform === 'darwin'
import FileMenu from './menus/file'; import FileMenu from './menus/file';
import MainMenu from './menus/main';
import darwinMenu from './menus/darwin'; import darwinMenu from './menus/darwin';
import WindowMenu from './menus/window'; import WindowMenu from './menus/window';
import EditMenu from './menus/edit'; import EditMenu from './menus/edit';
import GitMenu from './menus/git'; import GitMenu from './menus/git';
import ViewMenu from './menus/view'; import ViewMenu from './menus/view';
import TerminalMenu from './menus/terminal';
import { execCommand } from './menus/commands'; import { execCommand } from './menus/commands';
@ -115,121 +113,3 @@ WindowMenu(commandKeys, execCommand, []),
Menu.setApplicationMenu(Menu.buildFromTemplate(menu)) Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
/*
searchProxy.checkIfGrepIsInstalled().then((result) => {
console.log('grep --version', result)
})
searchProxy.checkIffindstrIsInstalled().then((result) => {
console.log('findstr /?', result)
})
searchProxy.checkIfSelectStringIsInstalled().then((result) => {
console.log('get-help Select-String', result)
})
*/
interface position {
start: {
line: number
column: number
},
end: {
line: number
column: number
}
}
export interface SearchResultLineLine {
left: any,
center: any,
right: any,
position: position
}
export interface SearchResultLine {
lines: SearchResultLineLine[]
}
//import * as cp from 'child_process';
//import { rgPath } from '@vscode/ripgrep';
//const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.unpacked');
//console.log('rgDiskPath', rgDiskPath)
// ripgrep
// -s means case sensitive
// -i means ignore case
// -F means fixed strings so not regex
/*
-g, --glob GLOB ...
Include or exclude files and directories for searching that match the given glob. This always overrides any other ignore logic. Multiple glob flags may be used. Globbing rules match .gitignore globs. Precede a glob with a ! to exclude it. If multiple globs match a file or directory, the glob given later in the command line takes precedence.
*/
/*
console.log('process.cwd()', process.cwd())
const child = cp.spawn(rgDiskPath, ['bunsens[a-z]*', '--json', './'], { cwd: process.cwd() });
child.on('error', (err) => {
console.log('error', err)
}
)
child.stdout.on('data', (data) => {
const lines: string[] = data.toString().split('\n')
lines.forEach(line => {
if (line) {
try {
const result = JSON.parse(line)
if (result && result.type && result.type === 'match') {
//console.log('line:', result)
//console.log('path:', result.data.path.text)
//console.log('line:', result.data.lines.text)
//console.log('submatch: ', result.data.submatches)
let searchResultLine: SearchResultLine = {
lines: []
}
result.data.submatches.forEach((submatch: any) => {
searchResultLine.lines.push({
left: result.data.lines.text.substring(0, submatch.start),
center: result.data.lines.text.substring(submatch.start, submatch.end),
right: result.data.lines.text.substring(submatch.end),
position: {
start: {
line: result.data.line_number,
column: submatch.start,
},
end: {
line: result.data.line_number,
column: submatch.end,
},
},
})
})
console.log('searchResultLine', searchResultLine)
}
} catch (e) {
console.log('error ripgrep', e)
}
}
})
//console.log('stdout', lines)
}
)
child.stderr.on('data', (data) => {
console.log('stderr', data.toString())
}
)
child.on('close', (code) => {
console.log('close', code)
}
)
child.on('exit', (code) => {
console.log('exit', code)
}
)
*/

@ -37,9 +37,6 @@ class ConfigPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => {
//console.log('config client onload')
})
} }
async writeConfig(data: any): Promise<void> { async writeConfig(data: any): Promise<void> {

@ -38,7 +38,6 @@ export class FSPlugin extends ElectronBasePlugin {
const foldersToDelete: string[] = [] const foldersToDelete: string[] = []
if (openedFolders && openedFolders.length) { if (openedFolders && openedFolders.length) {
for (const folder of openedFolders) { for (const folder of openedFolders) {
console.log('opening folder', folder)
try { try {
const stat = await fs.stat(folder) const stat = await fs.stat(folder)
if (stat.isDirectory()) { if (stat.isDirectory()) {
@ -54,14 +53,12 @@ export class FSPlugin extends ElectronBasePlugin {
this.call('electronconfig', 'writeConfig', { 'recentFolders': newFolders }) this.call('electronconfig', 'writeConfig', { 'recentFolders': newFolders })
} }
}else{ }else{
console.log('no opened folders')
createWindow() createWindow()
} }
} }
async removeCloseListener(): Promise<void> { async removeCloseListener(): Promise<void> {
for (const client of this.clients) { for (const client of this.clients) {
console.log('removeCloseListener', client.webContentsId)
client.window.removeAllListeners() client.window.removeAllListeners()
} }
} }
@ -96,13 +93,12 @@ class FSPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => { this.onload(() => {
//console.log('fsPluginClient onload')
if(!isPackaged) { if(!isPackaged) {
this.window.webContents.openDevTools() this.window.webContents.openDevTools()
} }
this.window.on('close', async () => { this.window.on('close', async () => {
console.log('close', this.webContentsId)
await this.removeFromOpenedFolders(this.workingDir) await this.removeFromOpenedFolders(this.workingDir)
await this.closeWatch()
}) })
}) })
@ -111,7 +107,6 @@ class FSPluginClient extends ElectronBasePluginClient {
// best for non recursive // best for non recursive
async readdir(path: string): Promise<string[]> { async readdir(path: string): Promise<string[]> {
// call node fs.readdir // call node fs.readdir
console.log('readdir', path)
if (!path) return [] if (!path) return []
const startTime = Date.now() const startTime = Date.now()
const files = await fs.readdir(this.fixPath(path), { const files = await fs.readdir(this.fixPath(path), {
@ -126,14 +121,12 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectory isDirectory
}) })
} }
console.log('readdir', result, Date.now() - startTime)
return result return result
} }
async glob(path: string, pattern: string, options?: GlobOptions): Promise<string[] | Path[]> { async glob(path: string, pattern: string, options?: GlobOptions): Promise<string[] | Path[]> {
path = this.fixPath(path) path = this.fixPath(path)
console.log('glob', path, pattern, options)
const files = await glob(path + pattern, { const files = await glob(path + pattern, {
withFileTypes: true, withFileTypes: true,
...options ...options
@ -153,24 +146,20 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectory: (file as Path).isDirectory(), isDirectory: (file as Path).isDirectory(),
}) })
} }
//console.log('glob', result)
return result return result
} }
async readFile(path: string, options: any): Promise<string | undefined> { async readFile(path: string, options: any): Promise<string | undefined> {
//console.log('readFile', path, options)
// hacky fix for TS error // hacky fix for TS error
if (!path) return undefined if (!path) return undefined
try { try {
return (fs as any).readFile(this.fixPath(path), options) return (fs as any).readFile(this.fixPath(path), options)
} catch (e) { } catch (e) {
//console.log('readFile error', e)
return undefined return undefined
} }
} }
async writeFile(path: string, content: string, options: any): Promise<void> { async writeFile(path: string, content: string, options: any): Promise<void> {
//console.log('writeFile', path, content, options)
this.trackDownStreamUpdate[path] = content this.trackDownStreamUpdate[path] = content
return (fs as any).writeFile(this.fixPath(path), content, options) return (fs as any).writeFile(this.fixPath(path), content, options)
} }
@ -180,7 +169,6 @@ class FSPluginClient extends ElectronBasePluginClient {
} }
async rmdir(path: string): Promise<void> { async rmdir(path: string): Promise<void> {
console.log('rmdir', this.fixPath(path))
return fs.rm(this.fixPath(path), { return fs.rm(this.fixPath(path), {
recursive: true recursive: true
}) })
@ -197,14 +185,12 @@ class FSPluginClient extends ElectronBasePluginClient {
async stat(path: string): Promise<any> { async stat(path: string): Promise<any> {
try { try {
const stat = await fs.stat(this.fixPath(path)) const stat = await fs.stat(this.fixPath(path))
////console.log('stat', path, stat)
const isDirectory = stat.isDirectory() const isDirectory = stat.isDirectory()
return { return {
...stat, ...stat,
isDirectoryValue: isDirectory isDirectoryValue: isDirectory
} }
} catch (e) { } catch (e) {
//console.log('stat error', e)
return undefined return undefined
} }
} }
@ -218,7 +204,6 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectoryValue: isDirectory isDirectoryValue: isDirectory
} }
} catch (e) { } catch (e) {
//console.log('lstat error', e)
return undefined return undefined
} }
} }
@ -235,7 +220,6 @@ class FSPluginClient extends ElectronBasePluginClient {
async watch(): Promise<void> { async watch(): Promise<void> {
if (this.watcher) this.watcher.close() if (this.watcher) this.watcher.close()
console.log('watch', this.workingDir)
this.watcher = this.watcher =
chokidar.watch(this.workingDir, { chokidar.watch(this.workingDir, {
ignorePermissionErrors: true, ignoreInitial: true, ignorePermissionErrors: true, ignoreInitial: true,
@ -245,7 +229,6 @@ class FSPluginClient extends ElectronBasePluginClient {
}).on('all', async (eventName, path, stats) => { }).on('all', async (eventName, path, stats) => {
console.log('change', eventName, path, stats)
let pathWithoutPrefix = path.replace(this.workingDir, '') let pathWithoutPrefix = path.replace(this.workingDir, '')
pathWithoutPrefix = convertPathToPosix(pathWithoutPrefix) pathWithoutPrefix = convertPathToPosix(pathWithoutPrefix)
@ -255,7 +238,6 @@ class FSPluginClient extends ElectronBasePluginClient {
// remove workingDir from path // remove workingDir from path
const newContent = await fs.readFile(path, 'utf-8') const newContent = await fs.readFile(path, 'utf-8')
console.log('change', pathWithoutPrefix, this.trackDownStreamUpdate)
const currentContent = this.trackDownStreamUpdate[pathWithoutPrefix] const currentContent = this.trackDownStreamUpdate[pathWithoutPrefix]
if (currentContent !== newContent) { if (currentContent !== newContent) {
@ -278,7 +260,6 @@ class FSPluginClient extends ElectronBasePluginClient {
} }
async closeWatch(): Promise<void> { async closeWatch(): Promise<void> {
console.log('closing Watcher', this.webContentsId)
if (this.watcher) this.watcher.close() if (this.watcher) this.watcher.close()
} }
@ -299,11 +280,9 @@ class FSPluginClient extends ElectronBasePluginClient {
} }
async removeFromOpenedFolders(path: string): Promise<void> { async removeFromOpenedFolders(path: string): Promise<void> {
console.log('removeFromOpenedFolders', path)
const config = await this.call('electronconfig' as any, 'readConfig') const config = await this.call('electronconfig' as any, 'readConfig')
config.openedFolders = config.openedFolders || [] config.openedFolders = config.openedFolders || []
config.openedFolders = config.openedFolders.filter((p: string) => p !== path) config.openedFolders = config.openedFolders.filter((p: string) => p !== path)
console.log('removeFromOpenedFolders', config)
writeConfig(config) writeConfig(config)
} }
@ -362,13 +341,11 @@ class FSPluginClient extends ElectronBasePluginClient {
await this.updateRecentFolders(path) await this.updateRecentFolders(path)
await this.updateOpenedFolders(path) await this.updateOpenedFolders(path)
this.window.setTitle(this.workingDir) this.window.setTitle(this.workingDir)
console.log('setWorkingDir', path)
this.watch() this.watch()
this.emit('workingDirChanged', path) this.emit('workingDirChanged', path)
} }
async setWorkingDir(path: string): Promise<void> { async setWorkingDir(path: string): Promise<void> {
console.log('setWorkingDir', path)
this.workingDir = path this.workingDir = path
await this.updateRecentFolders(path) await this.updateRecentFolders(path)
await this.updateOpenedFolders(path) await this.updateOpenedFolders(path)

@ -55,14 +55,9 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => { this.onload(() => {
console.log('IsoGit client onload')
this.on('fs' as any, 'workingDirChanged', async (path: string) => { this.on('fs' as any, 'workingDirChanged', async (path: string) => {
console.log('workingDirChanged', path)
this.workingDir = path this.workingDir = path
this.gitIsInstalled = await gitProxy.version() ? true : false this.gitIsInstalled = await gitProxy.version() ? true : false
if (this.gitIsInstalled) {
console.log('git is installed')
}
}) })
}) })
} }
@ -79,7 +74,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async status(cmd: any) { async status(cmd: any) {
console.log('status', cmd)
if(this.workingDir === ''){ if(this.workingDir === ''){
return [] return []
@ -112,7 +107,6 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
return [] return []
} }
console.log('log')
const log = await git.log({ const log = await git.log({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
@ -122,43 +116,42 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async add(cmd: any) { async add(cmd: any) {
console.log('add')
const add = await git.add({ const add = await git.add({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('ADD', add)
return add return add
} }
async rm(cmd: any) { async rm(cmd: any) {
console.log('rm', cmd)
const rm = await git.remove({ const rm = await git.remove({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('RM', rm)
return rm return rm
} }
async reset(cmd: any){ async reset(cmd: any){
console.log('reset', cmd)
const reset = await git.resetIndex({ const reset = await git.resetIndex({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('RESET', reset)
return reset return reset
} }
async commit(cmd: any) { async commit(cmd: any) {
console.log('commit')
const commit = await git.commit({ const commit = await git.commit({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('COMMIT', commit)
return commit return commit
} }
@ -170,7 +163,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async branch(cmd: any) { async branch(cmd: any) {
console.log('branch')
const branch = await git.branch({ const branch = await git.branch({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
@ -180,7 +173,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async lsfiles(cmd: any) { async lsfiles(cmd: any) {
console.log('lsfiles')
const lsfiles = await git.listFiles({ const lsfiles = await git.listFiles({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
@ -189,7 +182,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async resolveref(cmd: any) { async resolveref(cmd: any) {
console.log('resolveref')
const resolveref = await git.resolveRef({ const resolveref = await git.resolveRef({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
@ -200,7 +193,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
async readblob(cmd: any) { async readblob(cmd: any) {
console.log('readblob')
const readblob = await git.readBlob({ const readblob = await git.readBlob({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
@ -210,54 +203,54 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async checkout(cmd: any) { async checkout(cmd: any) {
console.log('checkout')
const checkout = await git.checkout({ const checkout = await git.checkout({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('CHECKOUT', checkout)
return checkout return checkout
} }
async push(cmd: any) { async push(cmd: any) {
console.log('push')
const push = await git.push({ const push = await git.push({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd, ...cmd,
...parseInput(cmd.input) ...parseInput(cmd.input)
}) })
console.log('PUSH', push)
return push return push
} }
async pull(cmd: any) { async pull(cmd: any) {
console.log('pull', cmd)
const pull = await git.pull({ const pull = await git.pull({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd, ...cmd,
...parseInput(cmd.input) ...parseInput(cmd.input)
}) })
console.log('PULL', pull)
return pull return pull
} }
async fetch(cmd: any) { async fetch(cmd: any) {
console.log('fetch', cmd)
const fetch = await git.fetch({ const fetch = await git.fetch({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd, ...cmd,
...parseInput(cmd.input) ...parseInput(cmd.input)
}) })
console.log('FETCH', fetch)
return fetch return fetch
} }
async clone(cmd: any) { async clone(cmd: any) {
console.log('clone')
if (this.gitIsInstalled) { if (this.gitIsInstalled) {
await gitProxy.clone(cmd.url, cmd.dir) await gitProxy.clone(cmd.url, cmd.dir)
console.log('CLONING WITH NATIVE GIT', cmd)
} else { } else {
try { try {
const clone = await git.clone({ const clone = await git.clone({
@ -266,7 +259,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
...parseInput(cmd.input), ...parseInput(cmd.input),
dir: cmd.dir || this.workingDir dir: cmd.dir || this.workingDir
}) })
console.log('CLONE', clone)
return clone return clone
} catch (e) { } catch (e) {
console.log('CLONE ERROR', e) console.log('CLONE ERROR', e)
@ -276,22 +269,22 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
} }
async addremote(cmd: any) { async addremote(cmd: any) {
console.log('addremote')
const addremote = await git.addRemote({ const addremote = await git.addRemote({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('ADDREMOTE', addremote)
return addremote return addremote
} }
async delremote(cmd: any) { async delremote(cmd: any) {
console.log('delremote')
const delremote = await git.deleteRemote({ const delremote = await git.deleteRemote({
...await this.getGitConfig(), ...await this.getGitConfig(),
...cmd ...cmd
}) })
console.log('DELREMOTE', delremote)
return delremote return delremote
} }
@ -307,7 +300,7 @@ class IsoGitPluginClient extends ElectronBasePluginClient {
try { try {
const defaultConfig = await this.getGitConfig() const defaultConfig = await this.getGitConfig()
const name = await git.currentBranch(defaultConfig) const name = await git.currentBranch(defaultConfig)
console.log('currentbranch', name)
return name return name
} catch (e) { } catch (e) {
return '' return ''

@ -40,9 +40,6 @@ class TemplatesPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => {
console.log('TemplatesPluginClient onload')
})
} }
async loadTemplateInNewWindow (files: any) { async loadTemplateInNewWindow (files: any) {
@ -50,11 +47,11 @@ class TemplatesPluginClient extends ElectronBasePluginClient {
let folder = await this.call('fs' as any, 'selectFolder') let folder = await this.call('fs' as any, 'selectFolder')
if (!folder || folder === '') return if (!folder || folder === '') return
// @ts-ignore // @ts-ignore
console.log('files for template ', files)
for (const file in files) { for (const file in files) {
try { try {
if(!folder.endsWith('/')) folder += '/' if(!folder.endsWith('/')) folder += '/'
console.log('writing file', folder + file)
await fs.mkdir(path.dirname(folder + file), { recursive: true}) await fs.mkdir(path.dirname(folder + file), { recursive: true})
await fs.writeFile(folder + file, files[file], { await fs.writeFile(folder + file, files[file], {
encoding: 'utf8' encoding: 'utf8'

@ -32,7 +32,6 @@ export const detectDefaultShell = () => {
// Stores default shell when imported. // Stores default shell when imported.
const defaultShell = detectDefaultShell(); const defaultShell = detectDefaultShell();
console.log('defaultShell', defaultShell)
export default defaultShell; export default defaultShell;
@ -47,6 +46,7 @@ export class XtermPlugin extends ElectronBasePlugin {
clients: XtermPluginClient[] = [] clients: XtermPluginClient[] = []
constructor() { constructor() {
super(profile, clientProfile, XtermPluginClient) super(profile, clientProfile, XtermPluginClient)
this.methods = [...super.methods, 'closeTerminals']
} }
new(webContentsId: any): void { new(webContentsId: any): void {
@ -56,6 +56,12 @@ export class XtermPlugin extends ElectronBasePlugin {
} }
} }
async closeTerminals(): Promise<void> {
for (const client of this.clients) {
await client.closeAll()
}
}
} }
const clientProfile: Profile = { const clientProfile: Profile = {
@ -71,15 +77,10 @@ class XtermPluginClient extends ElectronBasePluginClient {
constructor(webContentsId: number, profile: Profile) { constructor(webContentsId: number, profile: Profile) {
super(webContentsId, profile) super(webContentsId, profile)
this.onload(() => { this.onload(() => {
console.log('XtermPluginClient onload')
this.emit('loaded') this.emit('loaded')
}) })
} }
async onActivation(): Promise<void> {
console.log('XtermPluginClient onActivation')
}
async keystroke(key: string, pid: number): Promise<void> { async keystroke(key: string, pid: number): Promise<void> {
this.terminals[pid].write(key) this.terminals[pid].write(key)
} }
@ -92,7 +93,6 @@ class XtermPluginClient extends ElectronBasePluginClient {
async createTerminal(path?: string): Promise<number> { async createTerminal(path?: string): Promise<number> {
const shell = defaultShell; const shell = defaultShell;
console.log('defaultShell', defaultShell)
// filter undefined out of the env // filter undefined out of the env
const env = Object.keys(process.env) const env = Object.keys(process.env)
@ -112,7 +112,6 @@ class XtermPluginClient extends ElectronBasePluginClient {
}); });
ptyProcess.onData((data: string) => { ptyProcess.onData((data: string) => {
console.log('onData', data)
this.sendData(data, ptyProcess.pid); this.sendData(data, ptyProcess.pid);
}) })
this.terminals[ptyProcess.pid] = ptyProcess this.terminals[ptyProcess.pid] = ptyProcess
@ -126,6 +125,15 @@ class XtermPluginClient extends ElectronBasePluginClient {
this.emit('close', pid) this.emit('close', pid)
} }
async closeAll(): Promise<void> {
for (const pid in this.terminals) {
this.terminals[pid].kill()
delete this.terminals[pid]
this.emit('close', pid)
}
}
async sendData(data: string, pid: number) { async sendData(data: string, pid: number) {
this.emit('data', data, pid) this.emit('data', data, pid)
} }

@ -8,19 +8,10 @@ console.log('preload.ts')
const exposedPLugins = ['fs', 'git', 'xterm', 'isogit', 'electronconfig', 'electronTemplates'] const exposedPLugins = ['fs', 'git', 'xterm', 'isogit', 'electronconfig', 'electronTemplates']
console.log('preload.ts', process)
let webContentsId: number | undefined let webContentsId: number | undefined
/*
// get the window id from the process arguments
const windowIdFromArgs = process.argv.find(arg => arg.startsWith('--window-id='))
if (windowIdFromArgs) {
[, windowId] = windowIdFromArgs.split('=')
console.log('windowId', windowId, )
}
*/
ipcRenderer.invoke('getWebContentsID').then((id: number) => { ipcRenderer.invoke('getWebContentsID').then((id: number) => {
webContentsId = id webContentsId = id
console.log('getWebContentsID', webContentsId)
}) })
contextBridge.exposeInMainWorld('electronAPI', { contextBridge.exposeInMainWorld('electronAPI', {
@ -35,7 +26,6 @@ contextBridge.exposeInMainWorld('electronAPI', {
name, name,
on: (cb:any) => ipcRenderer.on(`${name}:send`, cb), on: (cb:any) => ipcRenderer.on(`${name}:send`, cb),
send: (message: Partial<Message>) => { send: (message: Partial<Message>) => {
console.log('send', message, `${name}:on:${webContentsId}`)
ipcRenderer.send(`${name}:on:${webContentsId}`, message) ipcRenderer.send(`${name}:on:${webContentsId}`, message)
} }
} }

@ -31,7 +31,6 @@ export const gitProxy = {
version: async () => { version: async () => {
try { try {
const result = await execAsync('git --version'); const result = await execAsync('git --version');
console.log('git --version', result.stdout)
return result.stdout return result.stdout
} catch (error) { } catch (error) {
return false; return false;

@ -16,16 +16,13 @@ const DragBar = (props: IRemixDragBarUi) => {
const nodeRef = React.useRef(null) // fix for strictmode const nodeRef = React.useRef(null) // fix for strictmode
function stopDrag (e: MouseEvent, data: any) { function stopDrag (e: MouseEvent, data: any) {
console.log('stopDrag', data)
const h = window.innerHeight - data.y const h = window.innerHeight - data.y
props.refObject.current.setAttribute('style', `height: ${h}px;`) props.refObject.current.setAttribute('style', `height: ${h}px;`)
console.log('stopDrag', `height: ${h}px;`)
setDragBarPosY(props.refObject.current.offsetTop) setDragBarPosY(props.refObject.current.offsetTop)
setDragState(false) setDragState(false)
props.setHideStatus(false) props.setHideStatus(false)
} }
const handleResize = () => { const handleResize = () => {
console.log('handleResize', props.refObject.current)
if (!props.refObject.current) return if (!props.refObject.current) return
setDragBarPosY(props.refObject.current.offsetTop) setDragBarPosY(props.refObject.current.offsetTop)
} }

@ -13,7 +13,6 @@ const RemixUIPanelPlugin = (props: panelPLuginProps, panelRef: any) => {
const ref:any = panelRef || localRef const ref:any = panelRef || localRef
if (ref.current) { if (ref.current) {
console.log('ref.current', props.pluginRecord)
if (props.pluginRecord.view) { if (props.pluginRecord.view) {
if (React.isValidElement(props.pluginRecord.view)) { if (React.isValidElement(props.pluginRecord.view)) {
setView(props.pluginRecord.view) setView(props.pluginRecord.view)

@ -45,7 +45,6 @@ const basicWorkspaceInit = async (workspaces: { name: string; isGitRepo: boolean
} }
export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.Dispatch<any>) => { export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.Dispatch<any>) => {
console.log('initWorkspace', filePanelPlugin)
if (filePanelPlugin) { if (filePanelPlugin) {
plugin = filePanelPlugin plugin = filePanelPlugin
dispatch = reducerDispatch dispatch = reducerDispatch
@ -119,7 +118,6 @@ export const initWorkspace = (filePanelPlugin) => async (reducerDispatch: React.
} }
} else await basicWorkspaceInit(workspaces, workspaceProvider) } else await basicWorkspaceInit(workspaces, workspaceProvider)
} else if (isElectron()) { } else if (isElectron()) {
console.log('isElectron initWorkspace')
if (params.opendir) { if (params.opendir) {
params.opendir = decodeURIComponent(params.opendir) params.opendir = decodeURIComponent(params.opendir)
plugin.call('notification', 'toast', `opening ${params.opendir}...`) plugin.call('notification', 'toast', `opening ${params.opendir}...`)

@ -283,14 +283,12 @@ export const fetchWorkspaceDirectory = async (path: string) => {
if (!path) return if (!path) return
const provider = plugin.fileManager.currentFileProvider() const provider = plugin.fileManager.currentFileProvider()
console.log('fetchWorkspaceDirectory', path, provider)
const promise = new Promise((resolve, reject) => { const promise = new Promise((resolve, reject) => {
provider.resolveDirectory(path, (error, fileTree) => { provider.resolveDirectory(path, (error, fileTree) => {
if (error) { if (error) {
console.error(error) console.error(error)
return reject(error) return reject(error)
} }
console.log('fetchWorkspaceDirectory', fileTree)
resolve(fileTree) resolve(fileTree)
}) })
}) })

@ -14,14 +14,7 @@ export const ElectronMenu = () => {
} }
}, []) }, [])
useEffect(() => {
if (isElectron()) {
console.log('global.fs.browser.recentFolders', global.fs.browser.recentFolders)
}
}, [global.fs.browser.recentFolders])
const openFolderElectron = async (path: string) => { const openFolderElectron = async (path: string) => {
console.log('open folder electron', path)
global.dispatchOpenElectronFolder(path) global.dispatchOpenElectronFolder(path)
} }

@ -188,17 +188,14 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
} }
const dispatchOpenElectronFolder = async (path: string) => { const dispatchOpenElectronFolder = async (path: string) => {
console.log('open electron folder')
await openElectronFolder(path) await openElectronFolder(path)
} }
const dispatchGetElectronRecentFolders = async () => { const dispatchGetElectronRecentFolders = async () => {
console.log('get electron recent folders')
await getElectronRecentFolders() await getElectronRecentFolders()
} }
const dispatchRemoveRecentFolder = async (path: string) => { const dispatchRemoveRecentFolder = async (path: string) => {
console.log('remove recent folder')
await removeRecentElectronFolder(path) await removeRecentElectronFolder(path)
} }

@ -22,12 +22,8 @@ const RemixUiXterm = (props: RemixUiXtermProps) => {
const { plugin, pid, send, timeStamp } = props const { plugin, pid, send, timeStamp } = props
const xtermRef = React.useRef(null) const xtermRef = React.useRef(null)
useEffect(() => {
console.log('render remix-ui-xterm')
}, [])
useEffect(() => { useEffect(() => {
console.log('remix-ui-xterm ref', xtermRef.current)
props.setTerminalRef(pid, xtermRef.current) props.setTerminalRef(pid, xtermRef.current)
}, [xtermRef.current]) }, [xtermRef.current])
@ -35,17 +31,13 @@ const RemixUiXterm = (props: RemixUiXtermProps) => {
send(event.key, pid) send(event.key, pid)
} }
const onData = (data: string) => {
console.log('onData', data)
}
return ( return (
<Xterm <Xterm
addons={[fitAddon]} addons={[fitAddon]}
options={{theme: {background: props.theme.backgroundColor , foreground: props.theme.textColor}}} options={{ theme: { background: props.theme.backgroundColor, foreground: props.theme.textColor } }}
onRender={() => fitAddon.fit()} onRender={() => fitAddon.fit()}
ref={xtermRef} onData={onData} ref={xtermRef}
onKey={onKey}></Xterm> onKey={onKey}></Xterm>

@ -54,17 +54,14 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
}) })
plugin.on('theme', 'themeChanged', async (theme) => { plugin.on('theme', 'themeChanged', async (theme) => {
console.log('themeChanged', theme)
handleThemeChange(theme) handleThemeChange(theme)
}) })
const theme = await plugin.call('theme', 'currentTheme') const theme = await plugin.call('theme', 'currentTheme')
console.log('theme', theme)
handleThemeChange(theme) handleThemeChange(theme)
const shells = await plugin.call('xterm', 'getShells') const shells = await plugin.call('xterm', 'getShells')
console.log('shells', shells)
setShells(shells) setShells(shells)
}, 2000) }, 2000)
}, []) }, [])
@ -74,7 +71,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
themeCollection.forEach((themeItem) => { themeCollection.forEach((themeItem) => {
if (themeItem.themeName === theme.name) { if (themeItem.themeName === theme.name) {
setTheme(themeItem) setTheme(themeItem)
console.log('setTheme', themeItem)
} }
}) })
} }
@ -84,21 +80,14 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
setTerminals(prevState => { setTerminals(prevState => {
const terminal = prevState.find(xtermState => xtermState.pid === pid) const terminal = prevState.find(xtermState => xtermState.pid === pid)
if (terminal.ref && terminal.ref.terminal) { if (terminal.ref && terminal.ref.terminal) {
console.log('writing to terminal', terminal, data)
terminal.ref.terminal.write(data) terminal.ref.terminal.write(data)
} else { } else {
console.log('no terminal ref', terminal)
terminal.queue += data terminal.queue += data
} }
return [...prevState] return [...prevState]
}) })
} }
useEffect(() => {
console.log('terminals', terminals)
}, [terminals])
const send = (data: string, pid: number) => { const send = (data: string, pid: number) => {
plugin.call('xterm', 'keystroke', data, pid) plugin.call('xterm', 'keystroke', data, pid)
} }
@ -122,7 +111,6 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
} }
const setTerminalRef = (pid: number, ref: any) => { const setTerminalRef = (pid: number, ref: any) => {
console.log('setTerminalRef', pid, ref)
setTerminals(prevState => { setTerminals(prevState => {
const terminal = prevState.find(xtermState => xtermState.pid === pid) const terminal = prevState.find(xtermState => xtermState.pid === pid)
terminal.ref = ref terminal.ref = ref
@ -180,7 +168,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
<Dropdown.Menu className='custom-dropdown-items remixui_menuwidth'> <Dropdown.Menu className='custom-dropdown-items remixui_menuwidth'>
{shells.map((shell, index) => { {shells.map((shell, index) => {
return (<Dropdown.Item index={index} onClick={createTerminal}>{shell}</Dropdown.Item>) return (<Dropdown.Item key={index} onClick={createTerminal}>{shell}</Dropdown.Item>)
})} })}
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
@ -206,7 +194,7 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
})} })}
<div className='remix-ui-xterminals-buttons border-left'> <div className='remix-ui-xterminals-buttons border-left'>
{terminals.map((xtermState, index) => { {terminals.map((xtermState, index) => {
return (<button onClick={async () => selectTerminal(xtermState)} className={`btn btn-sm mt-2 btn-secondary ${xtermState.hidden ? 'xterm-btn-none' : 'xterm-btn-active'}`}><span className="fa fa-terminal border-0 p-0 m-0"></span></button>) return (<button key={index} onClick={async () => selectTerminal(xtermState)} className={`btn btn-sm mt-2 btn-secondary ${xtermState.hidden ? 'xterm-btn-none' : 'xterm-btn-active'}`}><span className="fa fa-terminal border-0 p-0 m-0"></span></button>)
})} })}
</div> </div>
</div> </div>

@ -27,7 +27,6 @@ export class FitAddon implements ITerminalAddon {
constructor() {} constructor() {}
public activate(terminal: Terminal): void { public activate(terminal: Terminal): void {
console.log('FitAddon activate')
this._terminal = terminal; this._terminal = terminal;
} }
@ -35,7 +34,6 @@ export class FitAddon implements ITerminalAddon {
public fit(): void { public fit(): void {
const dims = this.proposeDimensions(); const dims = this.proposeDimensions();
console.log('FitAddon fit', dims)
if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) { if (!dims || !this._terminal || isNaN(dims.cols) || isNaN(dims.rows)) {
return; return;
} }
@ -70,7 +68,6 @@ export class FitAddon implements ITerminalAddon {
const scrollbarWidth = this._terminal.options.scrollback === 0 ? const scrollbarWidth = this._terminal.options.scrollback === 0 ?
0 : core.viewport.scrollBarWidth; 0 : core.viewport.scrollBarWidth;
console.log('parentElementStyle', this._terminal.element.parentElement)
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement); const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height')); const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));

@ -133,8 +133,6 @@ export class Xterm extends React.Component<IProps> {
constructor(props: IProps) { constructor(props: IProps) {
super(props) super(props)
console.log('Xterm constructor')
this.terminalRef = React.createRef() this.terminalRef = React.createRef()
// Bind Methods // Bind Methods
@ -159,7 +157,6 @@ export class Xterm extends React.Component<IProps> {
// Load addons if the prop exists. // Load addons if the prop exists.
if (this.props.addons) { if (this.props.addons) {
this.props.addons.forEach((addon) => { this.props.addons.forEach((addon) => {
console.log('addon', addon)
this.terminal.loadAddon(addon) this.terminal.loadAddon(addon)
}) })
} }

Loading…
Cancel
Save