fdsfsd
This commit is contained in:
parent
e5ab485f10
commit
a08abfc592
2 changed files with 7 additions and 4 deletions
|
@ -390,11 +390,15 @@ def edit_post(pid, v):
|
||||||
def get_post_title(v):
|
def get_post_title(v):
|
||||||
|
|
||||||
url = request.values.get("url", None)
|
url = request.values.get("url", None)
|
||||||
if not url: return abort(400)
|
if not url: abort(400)
|
||||||
|
|
||||||
x = requests.get(url, headers=titleheaders, timeout=5)
|
x = requests.get(url, headers=titleheaders, timeout=5)
|
||||||
|
|
||||||
soup = BeautifulSoup(x.content, 'html.parser')
|
soup = BeautifulSoup(x.content, 'html.parser')
|
||||||
|
|
||||||
|
title = soup.find('title')
|
||||||
|
if not title: abort(400)
|
||||||
|
|
||||||
return {"url": url, "title": soup.find('title').string}
|
return {"url": url, "title": soup.find('title').string}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -825,10 +825,9 @@ def settings_block_user(v):
|
||||||
|
|
||||||
user = get_user(request.values.get("username"), graceful=True)
|
user = get_user(request.values.get("username"), graceful=True)
|
||||||
|
|
||||||
if user.unblockable: return {"error": "This user is unblockable."}, 403
|
if not user: return {"error": "That user doesn't exist."}, 404
|
||||||
|
|
||||||
if not user:
|
if user.unblockable: return {"error": "This user is unblockable."}, 403
|
||||||
return {"error": "That user doesn't exist."}, 404
|
|
||||||
|
|
||||||
if user.id == v.id:
|
if user.id == v.id:
|
||||||
return {"error": "You can't block yourself."}, 409
|
return {"error": "You can't block yourself."}, 409
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue