File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ class WebWorkflow extends WorkflowWithCredentials {
9393 }
9494 return this . version_info
9595 }
96- async is_editable ( ) {
96+ async is_editable_old ( ) {
9797 try {
9898 const status = await fetch ( this . api_url ( "/" ) ,
9999 {
@@ -111,6 +111,32 @@ class WebWorkflow extends WorkflowWithCredentials {
111111 return false
112112 }
113113 }
114+ async is_editable ( ) {
115+ if ( this . api_version <= 3 ) {
116+ return this . is_editable_old ( )
117+ }
118+ try {
119+ var heads = this . headers ( { "Accept" : "application/json" } )
120+ var url = this . api_url ( "/" )
121+ // console.log("URL", url)
122+ var response = await fetch (
123+ url ,
124+ {
125+ headers : heads ,
126+ credentials : "include" ,
127+ }
128+ )
129+ var data = await response . json ( )
130+ if ( "writable" in data ) {
131+ return data [ "writable" ]
132+ } else {
133+ return false
134+ }
135+ } catch ( e ) {
136+ console . log ( "Device inaccessible" )
137+ return false
138+ }
139+ }
114140 async get_file_content ( file_path , range = null ) {
115141 var heads = this . headers ( {
116142 'Accept' : 'application/octet-stream' ,
You can’t perform that action at this time.
0 commit comments