mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Create a group container for macOS sandbox, and on Mac put the Tor data dir in it
This commit is contained in:
parent
0794d7fb90
commit
d8b873a208
@ -4,6 +4,8 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.network.server</key>
|
||||||
|
<true/>
|
||||||
<key>com.apple.security.network.client</key>
|
<key>com.apple.security.network.client</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.files.user-selected.read-only</key>
|
<key>com.apple.security.files.user-selected.read-only</key>
|
||||||
@ -11,6 +13,10 @@
|
|||||||
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
|
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
|
||||||
<array>
|
<array>
|
||||||
<string>/OnionShare</string>
|
<string>/OnionShare</string>
|
||||||
|
</array>
|
||||||
|
<key>com.apple.security.application-groups</key>
|
||||||
|
<array>
|
||||||
|
<string>com.micahflee.onionshare</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -166,6 +166,11 @@ class Onion(object):
|
|||||||
raise BundledTorNotSupported(strings._('settings_error_bundled_tor_not_supported'))
|
raise BundledTorNotSupported(strings._('settings_error_bundled_tor_not_supported'))
|
||||||
|
|
||||||
# Create a torrc for this session
|
# Create a torrc for this session
|
||||||
|
if self.common.platform == 'Darwin':
|
||||||
|
group_container_dir = os.path.expanduser('~/Library/Group Containers/com.micahflee.onionshare')
|
||||||
|
os.makedirs(group_container_dir, exist_ok=True)
|
||||||
|
self.tor_data_directory = tempfile.TemporaryDirectory(dir=group_container_dir)
|
||||||
|
else:
|
||||||
self.tor_data_directory = tempfile.TemporaryDirectory()
|
self.tor_data_directory = tempfile.TemporaryDirectory()
|
||||||
|
|
||||||
if self.common.platform == 'Windows':
|
if self.common.platform == 'Windows':
|
||||||
|
@ -163,11 +163,7 @@ class Settings(object):
|
|||||||
Save settings to file.
|
Save settings to file.
|
||||||
"""
|
"""
|
||||||
self.common.log('Settings', 'save')
|
self.common.log('Settings', 'save')
|
||||||
|
os.makedirs(os.path.dirname(self.filename), exist_ok=True)
|
||||||
try:
|
|
||||||
os.makedirs(os.path.dirname(self.filename))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
open(self.filename, 'w').write(json.dumps(self._settings))
|
open(self.filename, 'w').write(json.dumps(self._settings))
|
||||||
self.common.log('Settings', 'save', 'Settings saved in {}'.format(self.filename))
|
self.common.log('Settings', 'save', 'Settings saved in {}'.format(self.filename))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user