Skip to content

Commit 4be5080

Browse files
committed
Packaging fixes
1 parent 57783bc commit 4be5080

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

debian/tor2web.postinst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ if ! id -u tor2web >/dev/null 2>&1; then
66
useradd tor2web -b /home/tor2web -s /bin/false
77
fi
88

9-
if [ ! -d /home/tor2web ]; then
10-
mkdir -p /home/tor2web
11-
mkdir -p /home/tor2web/certs
12-
mkdir -p /home/tor2web/lists
13-
mkdir -p /home/tor2web/logs
14-
chown tor2web:tor2web /home/tor2web/ -R
15-
fi
9+
mkdir -p /home/tor2web
10+
mkdir -p /home/tor2web/certs
11+
mkdir -p /home/tor2web/lists
12+
mkdir -p /home/tor2web/logs
13+
mkdir -p /home/tor2web/torbrowser
14+
15+
chown tor2web:tor2web /home/tor2web/ -R
1616

1717
# XXX. Hardcore installation of tor2web dependencies using pip.
1818
# This is needed until tor2web will be packaged removing the need

tor2web/t2w.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ def process(self):
871871

872872
clientOS, clientLang = getOSandLC(
873873
self.requestHeaders,
874-
config.t2w_file_path('lists')
874+
List(config.t2w_file_path('lists/gettor_locales.txt'))
875875
)
876876

877877
if clientOS == 'iphone' or \
@@ -1540,6 +1540,10 @@ def daemon_main(self):
15401540

15411541
reactor.listenUNIX(os.path.join(config.rundir, 'rpc.socket'), factory=pb.PBServerFactory(self.rpc_server))
15421542

1543+
if not config.disable_gettor:
1544+
gtt = LoopingCall(getTorTask, config)
1545+
gtt.start(3600)
1546+
15431547
for i in range(config.processes):
15441548
subprocess = spawnT2W(self, self.childFDs, self.fds_https, self.fds_http)
15451549
self.subprocesses.append(subprocess.pid)

tor2web/utils/gettor.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def language_only(lc):
138138
return 'en-US' # last resort
139139

140140

141-
def getOSandLC(headers, t2w_lists_path):
141+
def getOSandLC(headers, locales):
142142
"""Get OS and LC of user.
143143
144144
The user-agent and accept-language headers of the client's browser
@@ -150,9 +150,6 @@ def getOSandLC(headers, t2w_lists_path):
150150
agent = str(headers.getRawHeaders(b'user-agent'))
151151
alang = str(headers.getRawHeaders(b'accept-language'))
152152

153-
# list of supported locales for Tor Browser
154-
locales = List('%s/gettor_locales.txt' % t2w_lists_path)
155-
156153
client = None
157154

158155
if re.search('Windows', agent):
@@ -298,7 +295,7 @@ def getTorTask(config):
298295
filenames_regexp = ''
299296

300297
i = 0
301-
for lang in List('%s/lists/gettor_locales.txt' % config.datadir):
298+
for lang in List(config.t2w_file_path('lists/gettor_locales.txt')):
302299
if i:
303300
filenames_regexp += '|'
304301

0 commit comments

Comments
 (0)