resolve conflicts

pull/5100/head
STetsing 2 months ago
parent 2adedaf909
commit ddfbf1bcc4
  1. 108
      apps/remix-ide/src/app.js
  2. 1
      apps/remix-ide/src/app/plugins/electron/appUpdaterPlugin.ts
  3. 2
      apps/remix-ide/src/assets/js/loader.js
  4. 1135
      apps/remix-ide/src/assets/list.json
  5. 9
      apps/remix-ide/src/remixAppManager.js
  6. 19
      apps/remixdesktop/src/engine.ts
  7. 5
      apps/remixdesktop/src/main.ts
  8. 15
      apps/remixdesktop/src/preload.ts

@ -1,29 +1,29 @@
'use strict' 'use strict'
import {RunTab, makeUdapp} from './app/udapp' import { RunTab, makeUdapp } from './app/udapp'
import {RemixEngine} from './remixEngine' import { RemixEngine } from './remixEngine'
import {RemixAppManager} from './remixAppManager' import { RemixAppManager } from './remixAppManager'
import {ThemeModule} from './app/tabs/theme-module' import { ThemeModule } from './app/tabs/theme-module'
import {LocaleModule} from './app/tabs/locale-module' import { LocaleModule } from './app/tabs/locale-module'
import {NetworkModule} from './app/tabs/network-module' import { NetworkModule } from './app/tabs/network-module'
import {Web3ProviderModule} from './app/tabs/web3-provider' import { Web3ProviderModule } from './app/tabs/web3-provider'
import {CompileAndRun} from './app/tabs/compile-and-run' import { CompileAndRun } from './app/tabs/compile-and-run'
import {PluginStateLogger} from './app/tabs/state-logger' import { PluginStateLogger } from './app/tabs/state-logger'
import {SidePanel} from './app/components/side-panel' import { SidePanel } from './app/components/side-panel'
import {StatusBar} from './app/components/status-bar' import { StatusBar } from './app/components/status-bar'
import {HiddenPanel} from './app/components/hidden-panel' import { HiddenPanel } from './app/components/hidden-panel'
import {PinnedPanel} from './app/components/pinned-panel' import { PinnedPanel } from './app/components/pinned-panel'
import {VerticalIcons} from './app/components/vertical-icons' import { VerticalIcons } from './app/components/vertical-icons'
import {LandingPage} from './app/ui/landing-page/landing-page' import { LandingPage } from './app/ui/landing-page/landing-page'
import {MainPanel} from './app/components/main-panel' import { MainPanel } from './app/components/main-panel'
import {PermissionHandlerPlugin} from './app/plugins/permission-handler-plugin' import { PermissionHandlerPlugin } from './app/plugins/permission-handler-plugin'
import {AstWalker} from '@remix-project/remix-astwalker' import { AstWalker } from '@remix-project/remix-astwalker'
import {LinkLibraries, DeployLibraries, OpenZeppelinProxy} from '@remix-project/core-plugin' import { LinkLibraries, DeployLibraries, OpenZeppelinProxy } from '@remix-project/core-plugin'
import {CodeParser} from './app/plugins/parser/code-parser' import { CodeParser } from './app/plugins/parser/code-parser'
import {SolidityScript} from './app/plugins/solidity-script' import { SolidityScript } from './app/plugins/solidity-script'
import {WalkthroughService} from './walkthroughService' import { WalkthroughService } from './walkthroughService'
import {OffsetToLineColumnConverter, CompilerMetadata, CompilerArtefacts, FetchAndCompile, CompilerImports, GistHandler} from '@remix-project/core-plugin' import { OffsetToLineColumnConverter, CompilerMetadata, CompilerArtefacts, FetchAndCompile, CompilerImports, GistHandler } from '@remix-project/core-plugin'
import {Registry} from '@remix-project/remix-lib' import {Registry} from '@remix-project/remix-lib'
import {ConfigPlugin} from './app/plugins/config' import {ConfigPlugin} from './app/plugins/config'
@ -61,10 +61,16 @@ import { remixAIDesktopPlugin } from './app/plugins/electron/remixAIDesktopPlugi
import { RemixAIPlugin } from './app/plugins/remixAIPlugin' import { RemixAIPlugin } from './app/plugins/remixAIPlugin'
import { SlitherHandleDesktop } from './app/plugins/electron/slitherPlugin' import { SlitherHandleDesktop } from './app/plugins/electron/slitherPlugin'
import { SlitherHandle } from './app/files/slither-handle' import { SlitherHandle } from './app/files/slither-handle'
import { FoundryHandle } from './app/files/foundry-handle'
import { FoundryHandleDesktop } from './app/plugins/electron/foundryPlugin'
import { HardhatHandle } from './app/files/hardhat-handle'
import { HardhatHandleDesktop } from './app/plugins/electron/hardhatPlugin'
import { SolCoder } from './app/plugins/solcoderAI'
import { GitPlugin } from './app/plugins/git' import { GitPlugin } from './app/plugins/git'
import { Matomo } from './app/plugins/matomo' import { Matomo } from './app/plugins/matomo'
import {SolCoder} from './app/plugins/solcoderAI'
import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin' import { TemplatesSelectionPlugin } from './app/plugins/templates-selection/templates-selection-plugin'
@ -83,6 +89,7 @@ const Config = require('./config')
const FileManager = require('./app/files/fileManager') const FileManager = require('./app/files/fileManager')
import FileProvider from "./app/files/fileProvider" import FileProvider from "./app/files/fileProvider"
import { appPlatformTypes } from '@remix-ui/app' import { appPlatformTypes } from '@remix-ui/app'
const DGitProvider = require('./app/files/dgitProvider') const DGitProvider = require('./app/files/dgitProvider')
const WorkspaceFileProvider = require('./app/files/workspaceFileProvider') const WorkspaceFileProvider = require('./app/files/workspaceFileProvider')
@ -91,19 +98,19 @@ const PluginManagerComponent = require('./app/components/plugin-manager-componen
const CompileTab = require('./app/tabs/compile-tab') const CompileTab = require('./app/tabs/compile-tab')
const SettingsTab = require('./app/tabs/settings-tab') const SettingsTab = require('./app/tabs/settings-tab')
const AnalysisTab = require('./app/tabs/analysis-tab') const AnalysisTab = require('./app/tabs/analysis-tab')
const {DebuggerTab} = require('./app/tabs/debugger-tab') const { DebuggerTab } = require('./app/tabs/debugger-tab')
const TestTab = require('./app/tabs/test-tab') const TestTab = require('./app/tabs/test-tab')
const FilePanel = require('./app/panels/file-panel') const FilePanel = require('./app/panels/file-panel')
const Editor = require('./app/editor/editor') const Editor = require('./app/editor/editor')
const Terminal = require('./app/panels/terminal') const Terminal = require('./app/panels/terminal')
const {TabProxy} = require('./app/panels/tab-proxy.js') const { TabProxy } = require('./app/panels/tab-proxy.js')
export class platformApi { export class platformApi {
get name () { get name() {
return isElectron() ? appPlatformTypes.desktop : appPlatformTypes.web return isElectron() ? appPlatformTypes.desktop : appPlatformTypes.web
} }
isDesktop () { isDesktop() {
return isElectron() return isElectron()
} }
} }
@ -123,7 +130,7 @@ class AppComponent {
// load app config // load app config
const config = new Config(configStorage) const config = new Config(configStorage)
Registry.getInstance().put({api: config, name: 'config'}) Registry.getInstance().put({ api: config, name: 'config' })
// load file system // load file system
this._components.filesProviders = {} this._components.filesProviders = {}
@ -204,12 +211,12 @@ class AppComponent {
this.themeModule = new ThemeModule() this.themeModule = new ThemeModule()
// ----------------- locale service --------------------------------- // ----------------- locale service ---------------------------------
this.localeModule = new LocaleModule() this.localeModule = new LocaleModule()
Registry.getInstance().put({api: this.themeModule, name: 'themeModule'}) Registry.getInstance().put({ api: this.themeModule, name: 'themeModule' })
Registry.getInstance().put({api: this.localeModule, name: 'localeModule'}) Registry.getInstance().put({ api: this.localeModule, name: 'localeModule' })
// ----------------- editor service ---------------------------- // ----------------- editor service ----------------------------
const editor = new Editor() // wrapper around ace editor const editor = new Editor() // wrapper around ace editor
Registry.getInstance().put({api: editor, name: 'editor'}) Registry.getInstance().put({ api: editor, name: 'editor' })
editor.event.register('requiringToSaveCurrentfile', (currentFile) => { editor.event.register('requiringToSaveCurrentfile', (currentFile) => {
fileManager.saveCurrentFile() fileManager.saveCurrentFile()
if (currentFile.endsWith('.circom')) this.appManager.activatePlugin(['circuit-compiler']) if (currentFile.endsWith('.circom')) this.appManager.activatePlugin(['circuit-compiler'])
@ -217,7 +224,7 @@ class AppComponent {
// ----------------- fileManager service ---------------------------- // ----------------- fileManager service ----------------------------
const fileManager = new FileManager(editor, appManager) const fileManager = new FileManager(editor, appManager)
Registry.getInstance().put({api: fileManager, name: 'filemanager'}) Registry.getInstance().put({ api: fileManager, name: 'filemanager' })
// ----------------- dGit provider --------------------------------- // ----------------- dGit provider ---------------------------------
const dGitProvider = new DGitProvider() const dGitProvider = new DGitProvider()
@ -304,7 +311,7 @@ class AppComponent {
// -------------------Terminal---------------------------------------- // -------------------Terminal----------------------------------------
makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl)) makeUdapp(blockchain, compilersArtefacts, (domEl) => terminal.logHtml(domEl))
const terminal = new Terminal( const terminal = new Terminal(
{appManager, blockchain}, { appManager, blockchain },
{ {
getPosition: (event) => { getPosition: (event) => {
const limitUp = 36 const limitUp = 36
@ -405,20 +412,27 @@ class AppComponent {
const remixAIDesktop = new remixAIDesktopPlugin() const remixAIDesktop = new remixAIDesktopPlugin()
this.engine.register([remixAIDesktop]) this.engine.register([remixAIDesktop])
} }
const remixAI = new RemixAIPlugin(isElectron()) const remixAI = new RemixAIPlugin(isElectron())
this.engine.register([remixAI]) this.engine.register([remixAI])
const compilerloader = isElectron()? new compilerLoaderPluginDesktop(): new compilerLoaderPlugin() const compilerloader = isElectron() ? new compilerLoaderPluginDesktop() : new compilerLoaderPlugin()
this.engine.register([compilerloader]) this.engine.register([compilerloader])
// slither analyzer plugin (remixd / desktop) // slither analyzer plugin (remixd / desktop)
const slitherPlugin = isElectron() ? new SlitherHandleDesktop() : new SlitherHandle() const slitherPlugin = isElectron() ? new SlitherHandleDesktop() : new SlitherHandle()
this.engine.register([slitherPlugin]) this.engine.register([slitherPlugin])
//foundry plugin
const foundryPlugin = isElectron() ? new FoundryHandleDesktop() : new FoundryHandle()
this.engine.register([foundryPlugin])
// hardhat plugin
const hardhatPlugin = isElectron() ? new HardhatHandleDesktop() : new HardhatHandle()
this.engine.register([hardhatPlugin])
// LAYOUT & SYSTEM VIEWS // LAYOUT & SYSTEM VIEWS
const appPanel = new MainPanel() const appPanel = new MainPanel()
Registry.getInstance().put({api: this.mainview, name: 'mainview'}) Registry.getInstance().put({ api: this.mainview, name: 'mainview' })
const tabProxy = new TabProxy(fileManager, editor) const tabProxy = new TabProxy(fileManager, editor)
this.engine.register([appPanel, tabProxy]) this.engine.register([appPanel, tabProxy])
@ -470,8 +484,6 @@ class AppComponent {
analysis, analysis,
test, test,
filePanel.remixdHandle, filePanel.remixdHandle,
filePanel.hardhatHandle,
filePanel.foundryHandle,
filePanel.truffleHandle, filePanel.truffleHandle,
linkLibraries, linkLibraries,
deployLibraries, deployLibraries,
@ -480,10 +492,10 @@ class AppComponent {
]) ])
this.layout.panels = { this.layout.panels = {
tabs: {plugin: tabProxy, active: true}, tabs: { plugin: tabProxy, active: true },
editor: {plugin: editor, active: true}, editor: { plugin: editor, active: true },
main: {plugin: appPanel, active: false}, main: { plugin: appPanel, active: false },
terminal: {plugin: terminal, active: true, minimized: false} terminal: { plugin: terminal, active: true, minimized: false }
} }
} }
@ -496,7 +508,7 @@ class AppComponent {
} catch (e) { } catch (e) {
console.log("couldn't register iframe plugins", e.message) console.log("couldn't register iframe plugins", e.message)
} }
if (isElectron()){ if (isElectron()) {
await this.appManager.activatePlugin(['fs']) await this.appManager.activatePlugin(['fs'])
} }
await this.appManager.activatePlugin(['layout']) await this.appManager.activatePlugin(['layout'])
@ -539,8 +551,8 @@ class AppComponent {
await this.appManager.activatePlugin(['walkthrough', 'storage', 'search', 'compileAndRun', 'recorder', 'dgitApi', 'dgit']) await this.appManager.activatePlugin(['walkthrough', 'storage', 'search', 'compileAndRun', 'recorder', 'dgitApi', 'dgit'])
await this.appManager.activatePlugin(['solidity-script', 'remix-templates']) await this.appManager.activatePlugin(['solidity-script', 'remix-templates'])
if (isElectron()){ if (isElectron()) {
await this.appManager.activatePlugin(['isogit', 'electronconfig', 'electronTemplates', 'xterm', 'ripgrep', 'appUpdater', 'remixAID', 'slither']) await this.appManager.activatePlugin(['isogit', 'electronconfig', 'electronTemplates', 'xterm', 'ripgrep', 'appUpdater', 'slither', 'foundry', 'hardhat', 'remixAID'])
} }
this.appManager.on( this.appManager.on(

@ -8,7 +8,6 @@ const profile = {
export class appUpdaterPlugin extends ElectronPlugin { export class appUpdaterPlugin extends ElectronPlugin {
constructor() { constructor() {
console.log('appUpdaterPlugin')
super(profile) super(profile)
} }

@ -10,7 +10,7 @@ let domainToTrack = domains[window.location.hostname]
function trackDomain(domainToTrack) { function trackDomain(domainToTrack) {
var _paq = window._paq = window._paq || [] var _paq = window._paq = window._paq || []
console.log('Tracking domain', domainToTrack, _paq)
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */ /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(["setExcludedQueryParams", ["code", "gist"]]); _paq.push(["setExcludedQueryParams", ["code", "gist"]]);
_paq.push(["setExcludedReferrers", ["etherscan.io"]]); _paq.push(["setExcludedReferrers", ["etherscan.io"]]);

File diff suppressed because it is too large Load Diff

@ -94,6 +94,8 @@ const dependentModules = ['foundry', 'hardhat', 'truffle', 'slither']
const loadLocalPlugins = ['doc-gen', 'doc-viewer', 'etherscan', 'vyper', 'solhint', 'walletconnect', 'circuit-compiler', 'learneth', 'quick-dapp'] const loadLocalPlugins = ['doc-gen', 'doc-viewer', 'etherscan', 'vyper', 'solhint', 'walletconnect', 'circuit-compiler', 'learneth', 'quick-dapp']
const partnerPlugins = ['cookbookdev']
const sensitiveCalls = { const sensitiveCalls = {
fileManager: ['writeFile', 'copyFile', 'rename', 'copyDir'], fileManager: ['writeFile', 'copyFile', 'rename', 'copyDir'],
contentImport: ['resolveAndSave'], contentImport: ['resolveAndSave'],
@ -164,7 +166,7 @@ export class RemixAppManager extends PluginManager {
this.pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json' this.pluginsDirectory = 'https://raw.githubusercontent.com/ethereum/remix-plugins-directory/master/build/metadata.json'
this.pluginLoader = new PluginLoader() this.pluginLoader = new PluginLoader()
if (Registry.getInstance().get('platform').api.isDesktop()) { if (Registry.getInstance().get('platform').api.isDesktop()) {
requiredModules = [...requiredModules, 'fs', 'electronTemplates', 'isogit', 'remix-templates', 'electronconfig', 'xterm', 'compilerloader', 'ripgrep', 'remixAID', 'slither'] requiredModules = [...requiredModules, 'fs', 'electronTemplates', 'isogit', 'remix-templates', 'electronconfig', 'xterm', 'compilerloader', 'ripgrep', 'slither', 'remixAID']
} }
} }
@ -207,6 +209,11 @@ export class RemixAppManager extends PluginManager {
return true return true
} }
// skipping partner plugins' requests
if (partnerPlugins[from]) {
return true
}
// ask the user for permission // ask the user for permission
return await this.call('permissionhandler', 'askPermission', this.profiles[from], this.profiles[to], method, message, isSensitiveCall) return await this.call('permissionhandler', 'askPermission', this.profiles[from], this.profiles[to], method, message, isSensitiveCall)
} }

@ -12,6 +12,9 @@ import { CompilerLoaderPlugin } from './plugins/compilerLoader';
import { SlitherPlugin } from './plugins/slitherPlugin'; import { SlitherPlugin } from './plugins/slitherPlugin';
import { AppUpdaterPlugin } from './plugins/appUpdater'; import { AppUpdaterPlugin } from './plugins/appUpdater';
import { RemixAIDesktopPlugin } from './plugins/remixAIDektop'; import { RemixAIDesktopPlugin } from './plugins/remixAIDektop';
import { FoundryPlugin } from './plugins/foundryPlugin';
import { HardhatPlugin } from './plugins/hardhatPlugin';
import { isE2E } from './main';
const engine = new Engine() const engine = new Engine()
const appManager = new PluginManager() const appManager = new PluginManager()
@ -24,6 +27,8 @@ const ripgrepPlugin = new RipgrepPlugin()
const compilerLoaderPlugin = new CompilerLoaderPlugin() const compilerLoaderPlugin = new CompilerLoaderPlugin()
const slitherPlugin = new SlitherPlugin() const slitherPlugin = new SlitherPlugin()
const appUpdaterPlugin = new AppUpdaterPlugin() const appUpdaterPlugin = new AppUpdaterPlugin()
const foundryPlugin = new FoundryPlugin()
const hardhatPlugin = new HardhatPlugin()
const remixAIDesktopPlugin = new RemixAIDesktopPlugin() const remixAIDesktopPlugin = new RemixAIDesktopPlugin()
engine.register(appManager) engine.register(appManager)
@ -35,7 +40,9 @@ engine.register(templatesPlugin)
engine.register(ripgrepPlugin) engine.register(ripgrepPlugin)
engine.register(compilerLoaderPlugin) engine.register(compilerLoaderPlugin)
engine.register(slitherPlugin) engine.register(slitherPlugin)
engine.register(foundryPlugin)
engine.register(appUpdaterPlugin) engine.register(appUpdaterPlugin)
engine.register(hardhatPlugin)
engine.register(remixAIDesktopPlugin) engine.register(remixAIDesktopPlugin)
appManager.activatePlugin('electronconfig') appManager.activatePlugin('electronconfig')
@ -49,6 +56,18 @@ ipcMain.on('fs:openFolder', async (event, path?) => {
fsPlugin.openFolder(event, path) fsPlugin.openFolder(event, path)
}) })
ipcMain.handle('fs:openFolder', async (event, webContentsId, path?) => {
if(!isE2E) return
console.log('openFolder', webContentsId, path)
fsPlugin.openFolder(webContentsId, path)
})
ipcMain.handle('fs:openFolderInSameWindow', async (event, webContentsId, path?) => {
if(!isE2E) return
console.log('openFolderInSameWindow', webContentsId, path)
fsPlugin.openFolderInSameWindow(webContentsId, path)
})
ipcMain.on('terminal:new', async (event) => { ipcMain.on('terminal:new', async (event) => {
xtermPlugin.new(event) xtermPlugin.new(event)

@ -36,8 +36,8 @@ const windowSet = new Set<BrowserWindow>([]);
export const createWindow = async (dir?: string): Promise<void> => { export const createWindow = async (dir?: string): Promise<void> => {
// Create the browser window. // Create the browser window.
const mainWindow = new BrowserWindow({ const mainWindow = new BrowserWindow({
height: (isE2E ? 1440 : screen.getPrimaryDisplay().size.height * 0.8),
width: (isE2E ? 2560 : screen.getPrimaryDisplay().size.width * 0.8), width: (isE2E ? 2560 : screen.getPrimaryDisplay().size.width * 0.8),
height: (isE2E ? 1140 : screen.getPrimaryDisplay().size.height * 0.8),
frame: true, frame: true,
webPreferences: { webPreferences: {
preload: path.join(__dirname, 'preload.js') preload: path.join(__dirname, 'preload.js')
@ -145,6 +145,9 @@ HelpMenu(commandKeys, execCommand),
if (!isE2E || isE2ELocal) if (!isE2E || isE2ELocal)
Menu.setApplicationMenu(Menu.buildFromTemplate(menu)) Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
ipcMain.handle('logger', async (...args) => {
console.log('log:', ...args)
})
ipcMain.handle('config:isPackaged', async () => { ipcMain.handle('config:isPackaged', async () => {
return isPackaged return isPackaged

@ -6,7 +6,7 @@ console.log('preload.ts', new Date().toLocaleTimeString())
/* preload script needs statically defined API for each plugin */ /* preload script needs statically defined API for each plugin */
const exposedPLugins = ['fs', 'git', 'xterm', 'isogit', 'electronconfig', 'electronTemplates', 'ripgrep', 'compilerloader', 'appUpdater', 'remixAID', 'slither'] const exposedPLugins = ['fs', 'git', 'xterm', 'isogit', 'electronconfig', 'electronTemplates', 'ripgrep', 'compilerloader', 'appUpdater', 'slither', 'foundry', 'hardhat', 'remixAID']
let webContentsId: number | undefined let webContentsId: number | undefined
@ -18,8 +18,9 @@ contextBridge.exposeInMainWorld('electronAPI', {
isPackaged: () => ipcRenderer.invoke('config:isPackaged'), isPackaged: () => ipcRenderer.invoke('config:isPackaged'),
isE2E: () => ipcRenderer.invoke('config:isE2E'), isE2E: () => ipcRenderer.invoke('config:isE2E'),
canTrackMatomo: () => ipcRenderer.invoke('config:canTrackMatomo'), canTrackMatomo: () => ipcRenderer.invoke('config:canTrackMatomo'),
trackEvent: (args: any[]) => ipcRenderer.invoke('matomo:trackEvent', args), trackEvent: (args: any[]) => ipcRenderer.invoke('matomo:trackEvent', args),
openFolder: (path: string) => ipcRenderer.invoke('fs:openFolder', webContentsId, path),
openFolderInSameWindow: (path: string) => ipcRenderer.invoke('fs:openFolderInSameWindow', webContentsId, path),
activatePlugin: (name: string) => { activatePlugin: (name: string) => {
return ipcRenderer.invoke('manager:activatePlugin', name) return ipcRenderer.invoke('manager:activatePlugin', name)
}, },
@ -27,10 +28,16 @@ contextBridge.exposeInMainWorld('electronAPI', {
plugins: exposedPLugins.map(name => { plugins: exposedPLugins.map(name => {
return { return {
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>) => {
//if(name === 'isogit') console.log(name, message)
//if(name === 'isogit') ipcRenderer.invoke(`logger`, name, message)
ipcRenderer.send(`${name}:on:${webContentsId}`, message) ipcRenderer.send(`${name}:on:${webContentsId}`, message)
} }
} }
}) })
}) })
Loading…
Cancel
Save