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"), }
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") }
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") }
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))
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))
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(), }
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(), }
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)
def domain_url(path): if is_tor(): return "%s/%s" % (_cfg("tor_domain"), path) return "%s://%s/%s" % (_cfg("protocol"), _cfg("domain"), path)
def tor_redirect(path): if is_tor(): return redirect(_cfg("tor_domain") + '/' + path) return redirect(path)
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)