@@ -19,8 +19,10 @@ const configLocation = require('path').join(homedir, "sidenoder-config.json")
19
19
20
20
if ( `${ platform } ` != "win64" && `${ platform } ` != "win32" ) {
21
21
global . nullcmd = "> /dev/null"
22
+ global . nullerror = "2> /dev/null"
22
23
} else {
23
24
global . nullcmd = "> null"
25
+ global . nullerror = "2> null"
24
26
}
25
27
26
28
@@ -111,12 +113,15 @@ function execShellCommand(cmd, buffer = 5000) {
111
113
return new Promise ( ( resolve , reject ) => {
112
114
exec ( cmd , { maxBuffer : 1024 * buffer } , ( error , stdout , stderr ) => {
113
115
if ( error ) {
114
- console . warn ( error ) ;
116
+ console . log ( 'exec_error' )
117
+ //console.warn(error);
115
118
}
116
119
if ( stdout ) {
120
+ console . log ( 'exec_stdout' )
117
121
console . log ( stdout )
118
122
resolve ( stdout ) ;
119
123
} else {
124
+ console . log ( 'exec_stderr' )
120
125
console . log ( stderr )
121
126
resolve ( stderr ) ;
122
127
}
@@ -226,22 +231,22 @@ async function mount(){
226
231
227
232
228
233
if ( `${ global . platform } ` != "win64" && `${ global . platform } ` != "win32" ) {
229
- await execShellCommand ( `umount ${ mountFolder } ` ) ;
230
- await execShellCommand ( `fusermount -uz ${ mountFolder } ` ) ;
231
- console . log ( mountFolder ) ;
234
+ await execShellCommand ( `umount ${ mountFolder } ${ global . nullerror } ` ) ;
235
+ await execShellCommand ( `fusermount -uz ${ mountFolder } ${ global . nullerror } ` ) ;
232
236
await fs . mkdir ( mountFolder , { } , ( ) => { } ) // folder must exist on windows
233
- console . log ( mountFolder ) ;
234
237
}
238
+
235
239
if ( `${ global . platform } ` == "win64" || `${ global . platform } ` == "win32" ) {
236
- await execShellCommand ( `rmdir "${ mountFolder } "` ) ; // folder must NOT exist on windows
240
+ await execShellCommand ( `rmdir "${ mountFolder } " ${ global . nullerror } ` ) ; // folder must NOT exist on windows
237
241
}
242
+
238
243
let content = await fetch ( "https://raw.githubusercontent.com/whitewhidow/quest-sideloader-linux/main/extras/k" )
239
244
content = await content . text ( )
240
245
let buff = Buffer . from ( content , 'base64' ) ;
241
246
const key = buff . toString ( 'ascii' ) ;
242
247
243
248
kpath = require ( 'path' ) . join ( tmpdir , "k" )
244
- console . log ( kpath )
249
+ // console.log(kpath)
245
250
fs . writeFileSync ( kpath , key )
246
251
247
252
@@ -252,11 +257,11 @@ async function mount(){
252
257
253
258
config = config . replace ( "XXX" , kpath ) ;
254
259
cpath = require ( 'path' ) . join ( tmpdir , "c" )
255
- console . log ( cpath )
260
+ // console.log(cpath)
256
261
257
262
fs . writeFileSync ( cpath , config )
258
263
259
- console . log ( "voor" )
264
+ // console.log("voor")
260
265
261
266
if ( `${ platform } ` === "darwin" ) {
262
267
var mountCmd = "cmount"
@@ -279,7 +284,7 @@ async function mount(){
279
284
console . log ( `stdout: ${ stdout } ` ) ;
280
285
} ) ;
281
286
282
- console . log ( "na" )
287
+ // console.log("na")
283
288
}
284
289
285
290
@@ -681,21 +686,19 @@ function updateRcloneProgress() {
681
686
}
682
687
683
688
function reloadConfig ( ) {
684
- console . log ( configLocation )
685
689
const defaultConfig = { autoMount : false } ;
686
690
try {
687
691
if ( fs . existsSync ( configLocation ) ) {
688
- console . log ( "Config exist, using" ) ;
692
+ console . log ( "Config exist, using " + configLocation ) ;
689
693
global . currentConfiguration = require ( configLocation ) ;
690
694
} else {
691
- console . log ( "Config doesnt exist, creating" ) ;
695
+ console . log ( "Config doesnt exist, creating " ) + configLocation ;
692
696
fs . writeFileSync ( configLocation , JSON . stringify ( defaultConfig ) )
693
697
global . currentConfiguration = defaultConfig ;
694
698
}
695
699
} catch ( err ) {
696
700
console . error ( err ) ;
697
701
}
698
- console . log ( global . currentConfiguration ) ;
699
702
}
700
703
701
704
0 commit comments