Exemple #1
0
def inject():
    cdn = _cfg("cdn")
    if is_tor():
        cdn = _cfg("tor_domain")
    return {
        "mobile": g.mobile,
        "analytics_id": _cfg("google_analytics_id"),
        "analytics_domain": _cfg("google_analytics_domain"),
        "dwolla_id": _cfg("dwolla_id"),
        "coinbase_id": _cfg("coinbase_id"),
        "flattr_id": _cfg("flattr_id"),
        "adsense_client": _cfg("adsense_client"),
        "adsense_slot": _cfg("adsense_slot"),
        "dark_theme": "dark_theme" in request.cookies,
        "ads": not "ad-opt-out" in request.cookies,
        "notice_text": notice_text,
        "notice_enabled": notice_enabled,
        "share": share,
        "render_media": render_media,
        "len": len,
        "str": str,
        "get_mimetype": get_mimetype,
        "cdn": cdn,
        "is_tor": is_tor(),
        "ip": get_ip(),
        "media_url": media_url,
        "root": _cfg("protocol") + "://" + _cfg("domain"),
    }
Exemple #2
0
def inject():
    cdn = _cfg("cdn")
    if is_tor():
        cdn = _cfg("tor_domain")
    ads = True
    if 'ad-opt-out' in request.cookies:
        ads = False
    if g.do_not_track:
        ads = False
    if not _cfg("project_wonderful_id"):
        ads = False
    return {
        'mobile': g.mobile,
        'ua_platform': request.user_agent.platform,
        'analytics_id': _cfg("google_analytics_id"),
        'analytics_domain': _cfg("google_analytics_domain"),
        'dwolla_id': _cfg("dwolla_id"),
        'coinbase_id': _cfg("coinbase_id"),
        'flattr_id': _cfg("flattr_id"),
        'dark_theme': "dark_theme" in request.cookies,
        'ads': ads,
        'ad_id': _cfg("project_wonderful_id"),
        'notice_text': notice_text,
        'notice_enabled': notice_enabled,
        'share': share,
        'render_media': render_media,
        'len': len,
        'str': str,
        'get_mimetype': get_mimetype,
        'cdn': cdn,
        'is_tor': is_tor(),
        'ip': get_ip(),
        'media_url': media_url,
        'root': _cfg("protocol") + "://" + _cfg("domain")
    }
Exemple #3
0
def inject():
    cdn = _cfg("cdn")
    if is_tor():
        cdn = _cfg("tor_domain")
    return {
        'mobile': g.mobile,
        'analytics_id': _cfg("google_analytics_id"),
        'analytics_domain': _cfg("google_analytics_domain"),
        'dwolla_id': _cfg("dwolla_id"),
        'coinbase_id': _cfg("coinbase_id"),
        'flattr_id': _cfg("flattr_id"),
        'adsense_client': _cfg("adsense_client"),
        'adsense_slot': _cfg("adsense_slot"),
        'dark_theme': "dark_theme" in request.cookies,
        'ads': not "ad-opt-out" in request.cookies,
        'notice_text': notice_text,
        'notice_enabled': notice_enabled,
        'share': share,
        'render_media': render_media,
        'len': len,
        'str': str,
        'get_mimetype': get_mimetype,
        'cdn': cdn,
        'is_tor': is_tor(),
        'ip': get_ip(),
        'media_url': media_url,
        'root': _cfg("protocol") + "://" + _cfg("domain")
    }
Exemple #4
0
    def upload_file(self):
        if is_tor():
            return {'error': 420}, 420

        f = request.files['file']
        filename = ''.join(c for c in f.filename if c.isalnum() or c == '.')

        return _upload_object(*upload(f, filename))
Exemple #5
0
    def upload_file(self):
        if is_tor():
            return {"error": 420}, 420

        f = request.files["file"]
        filename = "".join(c for c in f.filename if c.isalnum() or c == ".")

        return _upload_object(*upload(f, filename))
Exemple #6
0
    def upload_file(self):
        if is_tor():
            return {'error': 420}, 420

        f = request.files['file']
        filename = ''.join(c for c in f.filename if c.isalnum() or c == '.')

        return _upload_object(*upload(f, filename))
Exemple #7
0
def inject():
    if is_tor():
        cdn = _cfg("tor_domain")
    ads = True
    if "ad-opt-out" in request.cookies:
        ads = False
    if g.do_not_track:
        ads = False
    if not _cfg("project_wonderful_id"):
        ads = False

    return {
        "mobile": g.mobile,
        "ua_platform": request.user_agent.platform,
        "analytics_id": _cfg("google_analytics_id"),
        "analytics_domain": _cfg("google_analytics_domain"),
        "dwolla_id": _cfg("dwolla_id"),
        "coinbase_id": _cfg("coinbase_id"),
        "flattr_id": _cfg("flattr_id"),
        "dark_theme": "dark_theme" in request.cookies,
        "ads": ads,
        "ad_id": _cfg("project_wonderful_id"),
        "notice_text": notice_text,
        "notice_enabled": notice_enabled,
        "share": share,
        "render_media": render_media,
        "len": len,
        "str": str,
        "get_mimetype": get_mimetype,
        "cdn_url": cdn_url,
        "is_tor": is_tor(),
        "ip": get_ip(),
        "media_url": media_url,
        "root": _cfg("protocol") + "://" + _cfg("domain"),
        "random": random,
        "shard": shard,
        "max_file_size": get_maxsize(),
    }
Exemple #8
0
def inject():
    if is_tor():
        cdn = _cfg("tor_domain")
    ads = True
    if "ad-opt-out" in request.cookies:
        ads = False
    if g.do_not_track:
        ads = False
    if not _cfg("project_wonderful_id"):
        ads = False

    return {
        "mobile": g.mobile,
        "ua_platform": request.user_agent.platform,
        "analytics_id": _cfg("google_analytics_id"),
        "analytics_domain": _cfg("google_analytics_domain"),
        "dwolla_id": _cfg("dwolla_id"),
        "coinbase_id": _cfg("coinbase_id"),
        "flattr_id": _cfg("flattr_id"),
        "ads": ads,
        "ad_id": _cfg("project_wonderful_id"),
        "notice_text": notice_text,
        "notice_enabled": notice_enabled,
        "share": share,
        "render_media": render_media,
        "len": len,
        "str": str,
        "get_mimetype": get_mimetype,
        "cdn_url": cdn_url,
        "is_tor": is_tor(),
        "ip": get_ip(),
        "media_url": media_url,
        "root": _cfg("protocol") + "://" + _cfg("domain"),
        "random": random,
        "shard": shard,
        "max_file_size": get_maxsize(),
    }
Exemple #9
0
    def upload_url(self):
        if is_tor():
            return {'error': 420}, 420

        url = request.form['url']
        f = URLFile()

        try:
            success = f.download(url)
        except FileTooBig:
            return {'error': 413}, 413

        except Exception:
            return {'error': 400}, 400

        if not success:
            return {'error': 404}, 404

        result, status = upload(f, f.filename)
        r.set(_k("url.%s" % url), result)

        return _upload_object(result, status)
Exemple #10
0
    def upload_url(self):
        if is_tor():
            return {'error': 420}, 420

        url = request.form['url']
        f = URLFile()

        try:
            success = f.download(url)
        except FileTooBig:
            return {'error': 413}, 413

        except Exception:
            return {'error': 400}, 400

        if not success:
            return {'error': 404}, 404

        result, status = upload(f, f.filename)
        r.set(_k("url.%s" % url), result)

        return _upload_object(result, status)
Exemple #11
0
def domain_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)
Exemple #12
0
def tor_redirect(path):
    if is_tor():
        return redirect(_cfg("tor_domain") + '/' + path)
    return redirect(path)
Exemple #13
0
def cdn_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s/%s" % (_cfg("protocol") + "://" + _cfg("domain") if _cfg("cdn") == '' else _cfg("cdn"), path)
Exemple #14
0
def cdn_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s/%s" % (_cfg("protocol") + "://" + _cfg("domain")
                      if _cfg("cdn") == '' else _cfg("cdn"), path)
Exemple #15
0
def domain_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)