@@ -39,6 +39,7 @@ const {
3939 getDarwinDirs,
4040 getLinuxDirs,
4141 ENTRYPOINT ,
42+ question
4243} = require ( "./common" ) ;
4344
4445switch ( process . platform ) {
@@ -62,15 +63,14 @@ async function install(installations) {
6263 // Attempt to give flatpak perms
6364 if ( selected . isFlatpak ) {
6465 try {
65- const { branch } = selected ;
6666 const cwd = process . cwd ( ) ;
67- const globalCmd = `flatpak override ${ branch } --filesystem=${ cwd } ` ;
68- const userCmd = `flatpak override --user ${ branch } --filesystem=${ cwd } ` ;
67+ const globalCmd = `flatpak override ${ selected . branch } --filesystem=${ cwd } ` ;
68+ const userCmd = `flatpak override --user ${ selected . branch } --filesystem=${ cwd } ` ;
6969 const cmd = selected . location . startsWith ( "/home" )
7070 ? userCmd
7171 : globalCmd ;
7272 execSync ( cmd ) ;
73- console . log ( "Successfully gave write perms to Discord Flatpak." ) ;
73+ console . log ( "Gave write perms to Discord Flatpak." ) ;
7474 } catch ( e ) {
7575 console . log ( "Failed to give write perms to Discord Flatpak." ) ;
7676 console . log (
@@ -79,6 +79,29 @@ async function install(installations) {
7979 ) ;
8080 process . exit ( 1 ) ;
8181 }
82+
83+ const answer = await question (
84+ `Would you like to allow ${ selected . branch } to talk to org.freedesktop.Flatpak?\n` +
85+ "This is essentially full host access but necessary to spawn git. Without it, the updater will not work\n" +
86+ "Consider using the http based updater (using the gui installer) instead if you want to maintain the sandbox.\n" +
87+ "[y/N]: "
88+ ) ;
89+
90+ if ( [ "y" , "yes" , "yeah" ] . includes ( answer . toLowerCase ( ) ) ) {
91+ try {
92+ const globalCmd = `flatpak override ${ selected . branch } --talk-name=org.freedesktop.Flatpak` ;
93+ const userCmd = `flatpak override --user ${ selected . branch } --talk-name=org.freedesktop.Flatpak` ;
94+ const cmd = selected . location . startsWith ( "/home" )
95+ ? userCmd
96+ : globalCmd ;
97+ execSync ( cmd ) ;
98+ console . log ( "Sucessfully gave talk permission" ) ;
99+ } catch ( err ) {
100+ console . error ( "Failed to give talk permission\n" , err ) ;
101+ }
102+ } else {
103+ console . log ( `Not giving full host access. If you change your mind later, you can run:\nflatpak override ${ selected . branch } --talk-name=org.freedesktop.Flatpak` ) ;
104+ }
82105 }
83106
84107 for ( const version of selected . versions ) {
0 commit comments