forked from rDrama/rDrama
fgfg
parent
b3e70c0012
commit
ba409b19f1
|
@ -2,7 +2,6 @@ from flask import *
|
|||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship, deferred
|
||||
from .mix_ins import *
|
||||
from drama.helpers.base36 import *
|
||||
from drama.helpers.lazy import lazy
|
||||
from drama.__main__ import Base
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from drama.helpers.base36 import *
|
||||
from drama.helpers.lazy import lazy
|
||||
import math
|
||||
import random
|
||||
|
|
|
@ -4,7 +4,6 @@ from sqlalchemy.orm import relationship, deferred
|
|||
import re, random
|
||||
from urllib.parse import urlparse
|
||||
from .mix_ins import *
|
||||
from drama.helpers.base36 import *
|
||||
from drama.helpers.lazy import lazy
|
||||
from drama.__main__ import Base
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from flask import *
|
||||
from time import time
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import relationship
|
||||
from drama.helpers.base36 import *
|
||||
from drama.__main__ import Base
|
||||
|
||||
class Vote(Base):
|
||||
|
|
|
@ -46,10 +46,7 @@ def get_user(username, v=None, graceful=False):
|
|||
|
||||
def get_account(id, v=None, graceful=False):
|
||||
|
||||
user = g.db.query(User
|
||||
).filter(
|
||||
User.id == id
|
||||
).first()
|
||||
user = g.db.query(User).filter(User.id == id).first()
|
||||
|
||||
if not user:
|
||||
if not graceful:
|
||||
|
|
|
@ -7,7 +7,6 @@ from PIL import Image as IMAGE
|
|||
|
||||
from drama.helpers.wrappers import *
|
||||
from drama.helpers.alerts import *
|
||||
from drama.helpers.base36 import *
|
||||
from drama.helpers.sanitize import *
|
||||
from drama.helpers.markdown import *
|
||||
from drama.helpers.security import *
|
||||
|
@ -489,7 +488,22 @@ def admin_image_ban(v):
|
|||
i.save(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
|
||||
badpic = g.db.query(BadPic).filter_by(
|
||||
|
|
|
@ -530,6 +530,7 @@ def user_profile(username):
|
|||
@app.route("/uid/<uid>/pic/profile")
|
||||
@limiter.exempt
|
||||
def user_profile_uid(uid):
|
||||
if isinstance(uid, str): uid = int(uid, 36)
|
||||
x=get_account(uid)
|
||||
return redirect(x.profile_url)
|
||||
|
||||
|
|
Loading…
Reference in New Issue