diff options
Diffstat (limited to 'fbin')
-rw-r--r-- | fbin/db.py | 4 | ||||
-rwxr-xr-x | fbin/fbin.py | 2 |
2 files changed, 4 insertions, 2 deletions
@@ -4,7 +4,7 @@ import mimetypes import os from flask import current_app -from sqlalchemy import create_engine, Column, Integer, String, DateTime, Text, Index, ForeignKey, Boolean +from sqlalchemy import create_engine, Column, Integer, String, DateTime, Text, Index, ForeignKey, Boolean, JSON from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relation, backref from sqlalchemy.orm.exc import NoResultFound @@ -52,6 +52,8 @@ class File(Base): user_id = Column(Integer, ForeignKey('users.id'), nullable = True) ip = Column(String) accessed = Column(DateTime) + scanned = Column(Boolean, nullable=False, default=False) + blocked_reason = Column(JSON) def __init__(self, hash, filename, date, user_id = None, ip = None): self.hash = hash diff --git a/fbin/fbin.py b/fbin/fbin.py index 91fa1c9..19f82ed 100755 --- a/fbin/fbin.py +++ b/fbin/fbin.py @@ -207,7 +207,7 @@ def uploaded(hash): @app.route('/file/<hash:hash>/<path:filename>', endpoint = 'file') def _file(hash, ext=None, filename=None): f = get_file(hash) - if not f or not f.exists: + if not f or not f.exists or f.blocked_reason: abort(404) return send_file(f.get_path()) |