@@ -17,7 +17,7 @@ export const getStats = () => {
17
17
}
18
18
19
19
/**
20
- *
20
+ * getCurrentBandwidthSetting fetches the current limit that is max which the rclone can send request at.
21
21
* @returns {Promise<unknown> }
22
22
*/
23
23
export const getCurrentBandwidthSetting = ( ) => {
@@ -46,12 +46,13 @@ export const setCurrentBandwidthSetting = (newRate) => {
46
46
}
47
47
48
48
/**
49
- * Create a public link for a supported remote
49
+ * createPublicLink creates a public link for a supported remote
50
50
* @param remoteName {string}
51
51
* @param remotePath {string}
52
52
* @returns {Function }
53
53
*/
54
- export const createPublicLink = ( remoteName , remotePath ) => {
54
+ export const createNewPublicLink = ( remoteName , remotePath ) => {
55
+ remoteName = addColonAtLast ( remoteName ) ;
55
56
return new Promise ( ( resolve , reject ) => {
56
57
axiosInstance . post ( urls . createPublicLink , { fs : remoteName , remote : remotePath } ) . then ( res => {
57
58
resolve ( res . data ) ;
@@ -68,7 +69,7 @@ export const createPublicLink = (remoteName, remotePath) => {
68
69
export const getAllProviders = ( ) => {
69
70
return new Promise ( ( resolve , reject ) => {
70
71
axiosInstance . post ( urls . getProviders ) . then ( res => {
71
- resolve ( res . data . providers ) ;
72
+ resolve ( res . data ) ;
72
73
} , error => {
73
74
reject ( error ) ;
74
75
} )
@@ -79,7 +80,7 @@ export const getAllProviders = () => {
79
80
* getConfigDump return the configured remotes from the rclone backend
80
81
* @returns {Promise<unknown> }
81
82
*/
82
- export const getConfigDump = ( ) => {
83
+ export const getAllConfigDump = ( ) => {
83
84
return new Promise ( ( resolve , reject ) => {
84
85
axiosInstance . post ( urls . getConfigDump ) . then ( res => {
85
86
resolve ( res . data ) ;
@@ -89,7 +90,7 @@ export const getConfigDump = () => {
89
90
} )
90
91
}
91
92
/**
92
- * getFsInfo fetches the information regarding features, hashes from the rclone backend. Stores into redux store.
93
+ * getFsInfo fetches the information regarding features, hashes from the rclone backend.
93
94
* @param remoteName {string} The name of the remote
94
95
* @returns {Function }
95
96
*/
@@ -110,7 +111,7 @@ export const getFsInfo = (remoteName) => {
110
111
}
111
112
112
113
/**
113
- * getFilesList fetches the files for a specified remote path (remoteName + remotePath). Stores into redux store.
114
+ * getFilesList fetches the files for a specified remote path (remoteName + remotePath).
114
115
* @param fs {string} Name of the remote config/ ("/" for local path). May contain abc:bucketName for bucket based remotes
115
116
* @param remotePath {string} Name of the path in the remote
116
117
* @returns {Function }
@@ -124,7 +125,7 @@ export const getFilesList = (fs, remotePath) => {
124
125
// check if it is a local path
125
126
fs = fs . indexOf ( '/' ) !== 0 ? addColonAtLast ( fs ) : fs ;
126
127
127
- axiosInstance . post ( urls . getFsInfo , {
128
+ axiosInstance . post ( urls . getFilesList , {
128
129
fs,
129
130
remote : remotePath
130
131
} ) . then ( res => {
@@ -152,8 +153,8 @@ export const getRemoteInfo = (remoteName) => {
152
153
if ( ! isLocalRemoteName ( remoteName ) ) {
153
154
remoteName = addColonAtLast ( remoteName ) ;
154
155
}
155
- axiosInstance . post ( urls . getAbout , {
156
- fs : remoteName
156
+ axiosInstance . post ( urls . getFsInfo , {
157
+ fs : remoteName
157
158
} ) . then ( res => {
158
159
resolve ( res . data ) ;
159
160
} , error => {
@@ -164,8 +165,7 @@ export const getRemoteInfo = (remoteName) => {
164
165
}
165
166
166
167
/**
167
- * getRemoteInfo fetches the information about a provider.
168
- * @param remoteName
168
+ * getRcloneVersion fetches the version and details about the running rclone version.
169
169
* @returns {Promise<unknown> }
170
170
*/
171
171
export const getRcloneVersion = ( ) => {
@@ -178,3 +178,102 @@ export const getRcloneVersion = () => {
178
178
} )
179
179
}
180
180
181
+
182
+ /**
183
+ * getAllRemoteNames fetches all the remotes in the config.
184
+ * @returns {Promise<unknown> }
185
+ */
186
+ export const getAllRemoteNames = ( ) => {
187
+ return new Promise ( ( resolve , reject ) => {
188
+ axiosInstance . post ( urls . listRemotes ) . then ( res => {
189
+ resolve ( res . data ) ;
190
+ } , error => {
191
+ reject ( error ) ;
192
+ } )
193
+ } )
194
+ }
195
+
196
+ /**
197
+ * getJobStatus returns the status of a job with jobId
198
+ * @param jobId {number} Valid job id
199
+ * @return {Promise<unknown> }
200
+ */
201
+ export const getJobStatus = ( jobId ) => {
202
+ return new Promise ( ( resolve , reject ) => {
203
+ axiosInstance . post ( urls . getStatusForJob , { jobId} ) . then ( res => {
204
+ resolve ( res . data ) ;
205
+ } , error => {
206
+ reject ( error ) ;
207
+ } )
208
+ } )
209
+ }
210
+
211
+ /**
212
+ * purgeDir returns the status of a job with jobId
213
+ * @param jobId {number} Valid job id
214
+ * @return {Promise<unknown> }
215
+ */
216
+ export const purgeDir = ( fs , remote ) => {
217
+ return new Promise ( ( resolve , reject ) => {
218
+ axiosInstance . post ( urls . purge ) . then ( res => {
219
+ resolve ( res . data ) ;
220
+ } , error => {
221
+ reject ( error ) ;
222
+ } )
223
+ } )
224
+ }
225
+
226
+
227
+ /**
228
+ * deleteFile returns the status of a job with jobId
229
+ * @param fs {string} Remote Name
230
+ * @param remote {string} Remote Path
231
+ * @return {Promise<unknown> }
232
+ */
233
+ export const deleteFile = ( fs , remote ) => {
234
+ fs = addColonAtLast ( fs )
235
+ return new Promise ( ( resolve , reject ) => {
236
+ axiosInstance . post ( urls . deleteFile , {
237
+ fs,
238
+ remote
239
+ } ) . then ( res => {
240
+ resolve ( res . data ) ;
241
+ } , error => {
242
+ reject ( error ) ;
243
+ } )
244
+ } )
245
+ }
246
+
247
+ /**
248
+ * cleanTrashForRemote returns the status of a job with jobId
249
+ * @param fs {string} Remote Name
250
+ * @return {Promise<unknown> }
251
+ */
252
+ export const cleanTrashForRemote = ( fs ) => {
253
+ if ( ! isLocalRemoteName ( fs ) ) {
254
+ fs = addColonAtLast ( fs ) ;
255
+ }
256
+ return new Promise ( ( resolve , reject ) => {
257
+ axiosInstance . post ( urls . cleanUpRemote , {
258
+ fs,
259
+ } ) . then ( res => {
260
+ resolve ( res . data ) ;
261
+ } , error => {
262
+ reject ( error ) ;
263
+ } )
264
+ } )
265
+ }
266
+
267
+ export const getDownloadURLForFile = ( ipAddress , fsInfo , remoteName , remotePath , item ) => {
268
+ let downloadURL = "" ;
269
+
270
+ if ( fsInfo . Features . BucketBased ) {
271
+ downloadURL = ipAddress + `[${ remoteName } ]/${ remotePath } /${ item . Name } ` ;
272
+
273
+ } else {
274
+
275
+ downloadURL = ipAddress + `[${ remoteName } :${ remotePath } ]/${ item . Name } ` ;
276
+
277
+ }
278
+ return downloadURL ;
279
+ }
0 commit comments