Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
40c8a8bb
Commit
40c8a8bb
authored
Sep 19, 2018
by
Tom Janson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --read-only flag which prevents all writes
parent
a0823a3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
remixd
bin/remixd
+2
-1
sharedFolder.js
src/services/sharedFolder.js
+5
-1
No files found.
bin/remixd
View file @
40c8a8bb
...
@@ -10,6 +10,7 @@ program
...
@@ -10,6 +10,7 @@ program
.
usage
(
'-s <shared folder>'
)
.
usage
(
'-s <shared folder>'
)
.
description
(
'Provide a two ways connection between the local computer and Remix IDE'
)
.
description
(
'Provide a two ways connection between the local computer and Remix IDE'
)
.
option
(
'-s, --shared-folder <path>'
,
'Folder to share with Remix IDE'
)
.
option
(
'-s, --shared-folder <path>'
,
'Folder to share with Remix IDE'
)
.
option
(
'--read-only'
,
'Treat shared folder as read-only (experimental)'
)
.
option
(
'-m, --mist'
,
'start mist'
)
.
option
(
'-m, --mist'
,
'start mist'
)
.
option
(
'-g, --geth'
,
'start geth'
)
.
option
(
'-g, --geth'
,
'start geth'
)
.
option
(
'-p, --dev-path <dev-path>'
,
'Folder used by mist/geth to start the development instance'
)
.
option
(
'-p, --dev-path <dev-path>'
,
'Folder used by mist/geth to start the development instance'
)
...
@@ -48,7 +49,7 @@ if (program.sharedFolder) {
...
@@ -48,7 +49,7 @@ if (program.sharedFolder) {
var
sharedFolderrouter
=
new
Router
(
65520
,
servicesList
[
'sharedfolder'
],
(
webSocket
)
=>
{
var
sharedFolderrouter
=
new
Router
(
65520
,
servicesList
[
'sharedfolder'
],
(
webSocket
)
=>
{
servicesList
[
'sharedfolder'
].
setWebSocket
(
webSocket
)
servicesList
[
'sharedfolder'
].
setWebSocket
(
webSocket
)
servicesList
[
'sharedfolder'
].
setupNotifications
(
program
.
sharedFolder
)
servicesList
[
'sharedfolder'
].
setupNotifications
(
program
.
sharedFolder
)
servicesList
[
'sharedfolder'
].
sharedFolder
(
program
.
sharedFolder
)
servicesList
[
'sharedfolder'
].
sharedFolder
(
program
.
sharedFolder
,
program
.
readOnly
)
})
})
killCallBack
.
push
(
sharedFolderrouter
.
start
())
killCallBack
.
push
(
sharedFolderrouter
.
start
())
}
}
...
...
src/services/sharedFolder.js
View file @
40c8a8bb
...
@@ -12,8 +12,9 @@ module.exports = {
...
@@ -12,8 +12,9 @@ module.exports = {
this
.
websocket
=
websocket
this
.
websocket
=
websocket
},
},
sharedFolder
:
function
(
sharedFolder
)
{
sharedFolder
:
function
(
sharedFolder
,
readOnly
)
{
this
.
sharedFolder
=
sharedFolder
this
.
sharedFolder
=
sharedFolder
this
.
readOnly
=
readOnly
},
},
list
:
function
(
args
,
cb
)
{
list
:
function
(
args
,
cb
)
{
...
@@ -62,6 +63,7 @@ module.exports = {
...
@@ -62,6 +63,7 @@ module.exports = {
},
},
set
:
function
(
args
,
cb
)
{
set
:
function
(
args
,
cb
)
{
if
(
this
.
readOnly
)
return
cb
(
'Cannot write file: read-only mode selected'
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
if
(
fs
.
existsSync
(
path
)
&&
!
isRealPath
(
path
,
cb
))
return
if
(
fs
.
existsSync
(
path
)
&&
!
isRealPath
(
path
,
cb
))
return
if
(
args
.
content
===
'undefined'
)
{
// no !!!!!
if
(
args
.
content
===
'undefined'
)
{
// no !!!!!
...
@@ -76,6 +78,7 @@ module.exports = {
...
@@ -76,6 +78,7 @@ module.exports = {
},
},
rename
:
function
(
args
,
cb
)
{
rename
:
function
(
args
,
cb
)
{
if
(
this
.
readOnly
)
return
cb
(
'Cannot rename file: read-only mode selected'
)
var
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
sharedFolder
)
var
oldpath
=
utils
.
absolutePath
(
args
.
oldPath
,
this
.
sharedFolder
)
if
(
!
fs
.
existsSync
(
oldpath
))
{
if
(
!
fs
.
existsSync
(
oldpath
))
{
return
cb
(
'File not found '
+
oldpath
)
return
cb
(
'File not found '
+
oldpath
)
...
@@ -89,6 +92,7 @@ module.exports = {
...
@@ -89,6 +92,7 @@ module.exports = {
},
},
remove
:
function
(
args
,
cb
)
{
remove
:
function
(
args
,
cb
)
{
if
(
this
.
readOnly
)
return
cb
(
'Cannot remove file: read-only mode selected'
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
var
path
=
utils
.
absolutePath
(
args
.
path
,
this
.
sharedFolder
)
if
(
!
fs
.
existsSync
(
path
))
{
if
(
!
fs
.
existsSync
(
path
))
{
return
cb
(
'File not found '
+
path
)
return
cb
(
'File not found '
+
path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment