- browser-files-tree.js to filePovider.js,
- browser-files.js to localStorageProvider.js,
- basicReadOnlyExplorer.js to readonlyProvider.js,
- shared-folder.js to remixdProvider.js
pull/3094/head
LianaHus 5 years ago
parent 18cc9735a1
commit b9524f167e
  1. 20
      src/app.js
  2. 2
      src/app/files/NotPersistedExplorer.js
  3. 8
      src/app/files/fileManager.js
  4. 4
      src/app/files/filePovider.js
  5. 25
      src/app/files/fileProviderBase.js
  6. 4
      src/app/files/localStorageProvider.js
  7. 4
      src/app/files/readonlyProvider.js
  8. 2
      src/app/files/remixd-handle.js
  9. 2
      src/app/files/remixdProvider.js

@ -12,14 +12,14 @@ var { OffsetToLineColumnConverter } = require('./lib/offsetToLineColumnConverter
var QueryParams = require('./lib/query-params') var QueryParams = require('./lib/query-params')
var GistHandler = require('./lib/gist-handler') var GistHandler = require('./lib/gist-handler')
var Storage = remixLib.Storage var Storage = remixLib.Storage
var Browserfiles = require('./app/files/browser-files') var LocalStorageProvider = require('./app/files/localStorageProvider')
var SharedFolder = require('./app/files/shared-folder') var RemixdProvider = require('./app/files/remixdProvider')
var Config = require('./config') var Config = require('./config')
var Renderer = require('./app/ui/renderer') var Renderer = require('./app/ui/renderer')
var examples = require('./app/editor/example-contracts') var examples = require('./app/editor/example-contracts')
var modalDialogCustom = require('./app/ui/modal-dialog-custom') var modalDialogCustom = require('./app/ui/modal-dialog-custom')
var FileManager = require('./app/files/fileManager') var FileManager = require('./app/files/fileManager')
var BasicReadOnlyExplorer = require('./app/files/basicReadOnlyExplorer') var ReadonlyProvider = require('./app/files/readonlyProvider')
var NotPersistedExplorer = require('./app/files/NotPersistedExplorer') var NotPersistedExplorer = require('./app/files/NotPersistedExplorer')
var toolTip = require('./app/ui/tooltip') var toolTip = require('./app/ui/tooltip')
var CompilerMetadata = require('./app/files/compiler-metadata') var CompilerMetadata = require('./app/files/compiler-metadata')
@ -113,7 +113,7 @@ class App {
// load file system // load file system
self._components.filesProviders = {} self._components.filesProviders = {}
self._components.filesProviders['browser'] = new Browserfiles(fileStorage) self._components.filesProviders['browser'] = new LocalStorageProvider(fileStorage)
registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'}) registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'})
var remixd = new Remixd(65520) var remixd = new Remixd(65520)
@ -122,13 +122,13 @@ class App {
if (message.error) toolTip(message.error) if (message.error) toolTip(message.error)
}) })
self._components.filesProviders['localhost'] = new SharedFolder(remixd) self._components.filesProviders['localhost'] = new RemixdProvider(remixd)
self._components.filesProviders['swarm'] = new BasicReadOnlyExplorer('swarm') self._components.filesProviders['swarm'] = new ReadonlyProvider('swarm')
self._components.filesProviders['github'] = new BasicReadOnlyExplorer('github') self._components.filesProviders['github'] = new ReadonlyProvider('github')
self._components.filesProviders['gist'] = new NotPersistedExplorer('gist') self._components.filesProviders['gist'] = new NotPersistedExplorer('gist')
self._components.filesProviders['ipfs'] = new BasicReadOnlyExplorer('ipfs') self._components.filesProviders['ipfs'] = new ReadonlyProvider('ipfs')
self._components.filesProviders['https'] = new BasicReadOnlyExplorer('https') self._components.filesProviders['https'] = new ReadonlyProvider('https')
self._components.filesProviders['http'] = new BasicReadOnlyExplorer('http') self._components.filesProviders['http'] = new ReadonlyProvider('http')
registry.put({api: self._components.filesProviders['localhost'], name: 'fileproviders/localhost'}) registry.put({api: self._components.filesProviders['localhost'], name: 'fileproviders/localhost'})
registry.put({api: self._components.filesProviders['swarm'], name: 'fileproviders/swarm'}) registry.put({api: self._components.filesProviders['swarm'], name: 'fileproviders/swarm'})
registry.put({api: self._components.filesProviders['github'], name: 'fileproviders/github'}) registry.put({api: self._components.filesProviders['github'], name: 'fileproviders/github'})

@ -1,5 +1,5 @@
'use strict' 'use strict'
var ReadOnlyExplorer = require('./basicReadOnlyExplorer') var ReadOnlyExplorer = require('./readonlyProvider')
var toolTip = require('../ui/tooltip') var toolTip = require('../ui/tooltip')
class NotPersistedExplorer extends ReadOnlyExplorer { class NotPersistedExplorer extends ReadOnlyExplorer {

@ -277,9 +277,9 @@ class FileManager extends Plugin {
if (file) return _switchFile(file) if (file) return _switchFile(file)
else { else {
var browserProvider = this._deps.filesProviders['browser'] var browserProvider = this._deps.filesProviders['browser']
browserProvider.resolveDirectory('browser', (error, filesTree) => { browserProvider.resolveDirectory('browser', (error, filesProvider) => {
if (error) console.error(error) if (error) console.error(error)
var fileList = Object.keys(filesTree) var fileList = Object.keys(filesProvider)
if (fileList.length) { if (fileList.length) {
_switchFile(browserProvider.type + '/' + fileList[0]) _switchFile(browserProvider.type + '/' + fileList[0])
} else { } else {
@ -296,9 +296,9 @@ class FileManager extends Plugin {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const provider = this.fileProviderOf(path) const provider = this.fileProviderOf(path)
if (!provider) return reject(`provider for path ${path} not found`) if (!provider) return reject(`provider for path ${path} not found`)
provider.resolveDirectory(path, (error, filesTree) => { provider.resolveDirectory(path, (error, filesProvider) => {
if (error) reject(error) if (error) reject(error)
resolve(filesTree) resolve(filesProvider)
}) })
}) })
} }

@ -2,7 +2,7 @@
var EventManager = require('../../lib/events') var EventManager = require('../../lib/events')
class FilesTree { class FileProvider {
constructor (name, storage) { constructor (name, storage) {
this.event = new EventManager() this.event = new EventManager()
this.storage = storage this.storage = storage
@ -136,4 +136,4 @@ class FilesTree {
} }
} }
module.exports = FilesTree module.exports = FileProvider

@ -0,0 +1,25 @@
/*
this.exists = function (path, cb) {}
this.init = function (cb) {}
this.get = function (path, cb) {}
this.set = function (path, content, cb) {}
this.addReadOnly = function (path, content) {}
this.isReadOnly = function (path) {}
this.remove = function (path) {}
this.rename = function (oldPath, newPath, isFolder) {}
this.resolveDirectory = function (path, callback) {}
this.removePrefix = function (path) {}
updateRefs (path, type) {}
*/

@ -2,7 +2,7 @@
var EventManager = require('../../lib/events') var EventManager = require('../../lib/events')
function Files (storage) { function LocalStorageProvider (storage) {
var event = new EventManager() var event = new EventManager()
this.event = event this.event = event
var readonly = {} var readonly = {}
@ -145,4 +145,4 @@ function Files (storage) {
} }
} }
module.exports = Files module.exports = LocalStorageProvider

@ -1,7 +1,7 @@
'use strict' 'use strict'
var EventManager = require('../../lib/events') var EventManager = require('../../lib/events')
class BasicReadOnlyExplorer { class ReadonlyProvider {
constructor (type) { constructor (type) {
this.event = new EventManager() this.event = new EventManager()
this.files = {} this.files = {}
@ -99,4 +99,4 @@ class BasicReadOnlyExplorer {
} }
} }
module.exports = BasicReadOnlyExplorer module.exports = ReadonlyProvider

@ -21,7 +21,7 @@ const profile = {
name: 'remixd', name: 'remixd',
methods: [], methods: [],
events: [], events: [],
description: 'using Remixd daemon, allow to access file system', description: 'Using Remixd daemon, allow to access file system',
kind: 'other', kind: 'other',
version: packageJson.version version: packageJson.version
} }

@ -2,7 +2,7 @@
var EventManager = require('../../lib/events') var EventManager = require('../../lib/events')
var pathtool = require('path') var pathtool = require('path')
module.exports = class SharedFolder { module.exports = class RemixdProvider {
constructor (remixd) { constructor (remixd) {
this.event = new EventManager() this.event = new EventManager()
this._remixd = remixd this._remixd = remixd
Loading…
Cancel
Save