예제 #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"),
    }
예제 #2
0
파일: app.py 프로젝트: wub/MediaCrush
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")
    }
예제 #3
0
파일: app.py 프로젝트: JIVS/MediaCrush
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")
    }
예제 #4
0
파일: api.py 프로젝트: Janakas/MediaCrush
    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))
예제 #5
0
파일: api.py 프로젝트: nerdzeu/NERDZCrush
    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))
예제 #6
0
파일: api.py 프로젝트: Janakas/MediaCrush
    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))
예제 #7
0
파일: app.py 프로젝트: zenny/MediaCrush
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(),
    }
예제 #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(),
    }
예제 #9
0
파일: api.py 프로젝트: Janakas/MediaCrush
    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)
예제 #10
0
파일: api.py 프로젝트: Janakas/MediaCrush
    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)
예제 #11
0
파일: config.py 프로젝트: habi/MediaCrush
def domain_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)
예제 #12
0
파일: tor.py 프로젝트: imgrush/Imgrush
def tor_redirect(path):
    if is_tor():
        return redirect(_cfg("tor_domain") + '/' + path)
    return redirect(path)
예제 #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)
예제 #14
0
파일: config.py 프로젝트: wub/MediaCrush
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)
예제 #15
0
파일: config.py 프로젝트: wub/MediaCrush
def domain_url(path):
    if is_tor():
        return "%s/%s" % (_cfg("tor_domain"), path)
    return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)