summaryrefslogtreecommitdiff
path: root/onionshare
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2019-09-15 16:44:24 -0700
committerMicah Lee <micah@micahflee.com>2019-09-15 16:44:24 -0700
commita5e01a18e2ccf31ff31184d28c90554ea2c61f70 (patch)
treefc4986694a3cd267f5c1e31438cd6696f6eb94fc /onionshare
parentecd65f37e35fecbce5efd38173a7573feebaef0c (diff)
downloadonionshare-a5e01a18e2ccf31ff31184d28c90554ea2c61f70.tar.gz
onionshare-a5e01a18e2ccf31ff31184d28c90554ea2c61f70.zip
Add breadcrumbs for website mode
Diffstat (limited to 'onionshare')
-rw-r--r--onionshare/web/send_base_mode.py8
-rw-r--r--onionshare/web/share_mode.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/onionshare/web/send_base_mode.py b/onionshare/web/send_base_mode.py
index 67fb26d0..24ad55d7 100644
--- a/onionshare/web/send_base_mode.py
+++ b/onionshare/web/send_base_mode.py
@@ -90,9 +90,15 @@ class SendBaseModeWeb:
'status_code': 200
})
+ breadcrumbs = [('☗', '/')]
+ parts = path.split('/')[:-1]
+ for i in range(len(parts)):
+ breadcrumbs.append(('{}'.format(parts[i]), '/{}/'.format('/'.join(parts[0:i+1]))))
+ breadcrumbs_leaf = breadcrumbs.pop()[0]
+
# If filesystem_path is None, this is the root directory listing
files, dirs = self.build_directory_listing(filenames, filesystem_path)
- r = self.directory_listing_template(path, files, dirs)
+ r = self.directory_listing_template(path, files, dirs, breadcrumbs, breadcrumbs_leaf)
return self.web.add_security_headers(r)
def build_directory_listing(self, filenames, filesystem_path):
diff --git a/onionshare/web/share_mode.py b/onionshare/web/share_mode.py
index f52bc2c7..3d1af447 100644
--- a/onionshare/web/share_mode.py
+++ b/onionshare/web/share_mode.py
@@ -168,7 +168,7 @@ class ShareModeWeb(SendBaseModeWeb):
r.headers.set('Content-Type', content_type)
return r
- def directory_listing_template(self, path, files, dirs):
+ def directory_listing_template(self, path, files, dirs, breadcrumbs, breadcrumbs_leaf):
return make_response(render_template(
'send.html',
file_info=self.file_info,