fgfg
This commit is contained in:
parent
e6dec74577
commit
f52fe75be8
7 changed files with 18 additions and 11 deletions
|
@ -2,7 +2,6 @@ from flask import *
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship, deferred
|
from sqlalchemy.orm import relationship, deferred
|
||||||
from .mix_ins import *
|
from .mix_ins import *
|
||||||
from drama.helpers.base36 import *
|
|
||||||
from drama.helpers.lazy import lazy
|
from drama.helpers.lazy import lazy
|
||||||
from drama.__main__ import Base
|
from drama.__main__ import Base
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from drama.helpers.base36 import *
|
|
||||||
from drama.helpers.lazy import lazy
|
from drama.helpers.lazy import lazy
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
|
|
|
@ -4,7 +4,6 @@ from sqlalchemy.orm import relationship, deferred
|
||||||
import re, random
|
import re, random
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from .mix_ins import *
|
from .mix_ins import *
|
||||||
from drama.helpers.base36 import *
|
|
||||||
from drama.helpers.lazy import lazy
|
from drama.helpers.lazy import lazy
|
||||||
from drama.__main__ import Base
|
from drama.__main__ import Base
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
from flask import *
|
from flask import *
|
||||||
from time import time
|
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from drama.helpers.base36 import *
|
|
||||||
from drama.__main__ import Base
|
from drama.__main__ import Base
|
||||||
|
|
||||||
class Vote(Base):
|
class Vote(Base):
|
||||||
|
|
|
@ -46,10 +46,7 @@ def get_user(username, v=None, graceful=False):
|
||||||
|
|
||||||
def get_account(id, v=None, graceful=False):
|
def get_account(id, v=None, graceful=False):
|
||||||
|
|
||||||
user = g.db.query(User
|
user = g.db.query(User).filter(User.id == id).first()
|
||||||
).filter(
|
|
||||||
User.id == id
|
|
||||||
).first()
|
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
if not graceful:
|
if not graceful:
|
||||||
|
|
|
@ -7,7 +7,6 @@ from PIL import Image as IMAGE
|
||||||
|
|
||||||
from drama.helpers.wrappers import *
|
from drama.helpers.wrappers import *
|
||||||
from drama.helpers.alerts import *
|
from drama.helpers.alerts import *
|
||||||
from drama.helpers.base36 import *
|
|
||||||
from drama.helpers.sanitize import *
|
from drama.helpers.sanitize import *
|
||||||
from drama.helpers.markdown import *
|
from drama.helpers.markdown import *
|
||||||
from drama.helpers.security import *
|
from drama.helpers.security import *
|
||||||
|
@ -489,7 +488,22 @@ def admin_image_ban(v):
|
||||||
i.save(tempname)
|
i.save(tempname)
|
||||||
|
|
||||||
h=imagehash.phash(IMAGE.open(tempname))
|
h=imagehash.phash(IMAGE.open(tempname))
|
||||||
h=hex2bin(str(h))
|
|
||||||
|
value = int(str(h), 16)
|
||||||
|
bindigits = []
|
||||||
|
|
||||||
|
# Seed digit: 2**0
|
||||||
|
digit = (value % 2)
|
||||||
|
value //= 2
|
||||||
|
bindigits.append(digit)
|
||||||
|
|
||||||
|
while value > 0:
|
||||||
|
# Next power of 2**n
|
||||||
|
digit = (value % 2)
|
||||||
|
value //= 2
|
||||||
|
bindigits.append(digit)
|
||||||
|
|
||||||
|
h = ''.join([str(d) for d in bindigits])
|
||||||
|
|
||||||
#check db for existing
|
#check db for existing
|
||||||
badpic = g.db.query(BadPic).filter_by(
|
badpic = g.db.query(BadPic).filter_by(
|
||||||
|
|
|
@ -530,6 +530,7 @@ def user_profile(username):
|
||||||
@app.route("/uid/<uid>/pic/profile")
|
@app.route("/uid/<uid>/pic/profile")
|
||||||
@limiter.exempt
|
@limiter.exempt
|
||||||
def user_profile_uid(uid):
|
def user_profile_uid(uid):
|
||||||
|
if isinstance(uid, str): uid = int(uid, 36)
|
||||||
x=get_account(uid)
|
x=get_account(uid)
|
||||||
return redirect(x.profile_url)
|
return redirect(x.profile_url)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue