mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-26 09:21:23 -05:00
Make separate routes for send and receive modes
This commit is contained in:
parent
4a0c6e8dcd
commit
fa9f714651
@ -113,6 +113,17 @@ class Web(object):
|
|||||||
# shutting down the server only works within the context of flask, so the easiest way to do it is over http
|
# shutting down the server only works within the context of flask, so the easiest way to do it is over http
|
||||||
self.shutdown_slug = common.random_string(16)
|
self.shutdown_slug = common.random_string(16)
|
||||||
|
|
||||||
|
# Define the ewb app routes
|
||||||
|
self.common_routes()
|
||||||
|
if self.receive_mode:
|
||||||
|
self.receive_routes()
|
||||||
|
else:
|
||||||
|
self.send_routes()
|
||||||
|
|
||||||
|
def send_routes(self):
|
||||||
|
"""
|
||||||
|
The web app routes for sharing files
|
||||||
|
"""
|
||||||
@self.app.route("/<slug_candidate>")
|
@self.app.route("/<slug_candidate>")
|
||||||
def index(slug_candidate):
|
def index(slug_candidate):
|
||||||
"""
|
"""
|
||||||
@ -258,6 +269,19 @@ class Web(object):
|
|||||||
r.headers.set('Content-Type', content_type)
|
r.headers.set('Content-Type', content_type)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def receive_routes(self):
|
||||||
|
"""
|
||||||
|
The web app routes for sharing files
|
||||||
|
"""
|
||||||
|
@self.app.route("/<slug_candidate>")
|
||||||
|
def index(slug_candidate):
|
||||||
|
return "Receive Mode"
|
||||||
|
|
||||||
|
|
||||||
|
def common_routes(self):
|
||||||
|
"""
|
||||||
|
Common web app routes between sending and receiving
|
||||||
|
"""
|
||||||
@self.app.errorhandler(404)
|
@self.app.errorhandler(404)
|
||||||
def page_not_found(e):
|
def page_not_found(e):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user