Merge pull request #128 from mweinelt/magnetico-noauth
magneticow: allow no-auth also in feed url
This commit is contained in:
commit
35f07d84b9
@ -118,8 +118,12 @@ def torrents():
|
|||||||
else:
|
else:
|
||||||
context["next_page_exists"] = True
|
context["next_page_exists"] = True
|
||||||
|
|
||||||
username, password = flask.request.authorization.username, flask.request.authorization.password
|
if app.arguments.noauth:
|
||||||
context["subscription_url"] = "/feed?filter=%s&hash=%s" % (search, generate_feed_hash(username, password, search))
|
context["subscription_url"] = "/feed/?filter%s" % search
|
||||||
|
else:
|
||||||
|
username, password = flask.request.authorization.username, flask.request.authorization.password
|
||||||
|
context["subscription_url"] = "/feed?filter=%s&hash=%s" % (
|
||||||
|
search, generate_feed_hash(username, password, search))
|
||||||
|
|
||||||
if sort_by:
|
if sort_by:
|
||||||
context["sorted_by"] = sort_by
|
context["sorted_by"] = sort_by
|
||||||
@ -210,17 +214,18 @@ def statistics():
|
|||||||
@app.route("/feed")
|
@app.route("/feed")
|
||||||
def feed():
|
def feed():
|
||||||
filter_ = flask.request.args["filter"]
|
filter_ = flask.request.args["filter"]
|
||||||
hash_ = flask.request.args["hash"]
|
|
||||||
# Check for all possible users who might be requesting.
|
# Check for all possible users who might be requesting.
|
||||||
# pylint disabled: because we do monkey-patch! [in magneticow.__main__.py:main()]
|
# pylint disabled: because we do monkey-patch! [in magneticow.__main__.py:main()]
|
||||||
for username, password in app.arguments.user: # pylint: disable=maybe-no-member
|
if not app.arguments.noauth:
|
||||||
if generate_feed_hash(username, password, filter_) == hash_:
|
hash_ = flask.request.args["hash"]
|
||||||
break
|
for username, password in app.arguments.user: # pylint: disable=maybe-no-member
|
||||||
else:
|
if generate_feed_hash(username, password, filter_) == hash_:
|
||||||
return flask.Response(
|
break
|
||||||
"Could not verify your access level for that URL (wrong hash).\n",
|
else:
|
||||||
401
|
return flask.Response(
|
||||||
)
|
"Could not verify your access level for that URL (wrong hash).\n",
|
||||||
|
401
|
||||||
|
)
|
||||||
|
|
||||||
context = {}
|
context = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user