Esempio n. 1
0
    def get(self, path=''):
        statsreporter.stats().incr('homepage_view')
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' % (parsed.port,) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        dev_js_should_hit_host = current_app.config['DEV_JS_SHOULD_HIT_HOST']

        # use new react code
        if path.startswith("experimental"):
            return render_template('experimental.html', **{
                'SENTRY_PUBLIC_DSN': dsn,
                'VERSION': changes.get_version(),
                'DEV_JS_SHOULD_HIT_HOST': dev_js_should_hit_host
            })

        return render_template('index.html', **{
            'SENTRY_PUBLIC_DSN': dsn,
            'VERSION': changes.get_version(),
            'DEV_JS_SHOULD_HIT_HOST': dev_js_should_hit_host
        })
Esempio n. 2
0
    def get(self, path=''):
        # get user options, e.g. colorblind
        current_user = get_current_user()
        user_options = {}
        if current_user:
            user_options = dict(db.session.query(
                ItemOption.name, ItemOption.value,
            ).filter(
                ItemOption.item_id == current_user.id,
            ))

        statsreporter.stats().incr('homepage_view')
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' % (parsed.port,) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        # variables to ship down to the webapp
        use_another_host = current_app.config['WEBAPP_USE_ANOTHER_HOST']

        # if we have custom js, embed it in the html (making sure we
        # only do one file read in prod).
        fetch_custom_js = (current_app.config['WEBAPP_CUSTOM_JS'] and
            (current_app.debug or not IndexView.custom_js))

        if fetch_custom_js:
            IndexView.custom_js = open(current_app.config['WEBAPP_CUSTOM_JS']).read()

        disable_custom = request.args and "disable_custom" in request.args

        # use new react code
        if self.use_v2:
            return render_template('webapp.html', **{
                'SENTRY_PUBLIC_DSN': dsn,
                'RELEASE_INFO': changes.get_revision_info(),
                'WEBAPP_USE_ANOTHER_HOST': use_another_host,
                'WEBAPP_CUSTOM_JS': (IndexView.custom_js if
                    not disable_custom else None),
                'USE_PACKAGED_JS': not current_app.debug,
                'HAS_CUSTOM_CSS': (current_app.config['WEBAPP_CUSTOM_CSS'] and
                    not disable_custom),
                'IS_DEBUG': current_app.debug,
                'PHABRICATOR_HOST': current_app.config['PHABRICATOR_HOST'],
                'COLORBLIND': (user_options.get('user.colorblind') and
                    user_options.get('user.colorblind') != '0'),
            })

        return render_template('index.html', **{
            'SENTRY_PUBLIC_DSN': dsn,
            'VERSION': changes.get_version(),
            'WEBAPP_USE_ANOTHER_HOST': use_another_host
        })
Esempio n. 3
0
    def get(self, path=""):
        # get user options, e.g. colorblind
        current_user = get_current_user()
        user_options = {}
        if current_user:
            user_options = dict(
                db.session.query(ItemOption.name, ItemOption.value).filter(ItemOption.item_id == current_user.id)
            )

        statsreporter.stats().incr("homepage_view")
        if current_app.config["SENTRY_DSN"] and False:
            parsed = urlparse.urlparse(current_app.config["SENTRY_DSN"])
            dsn = "%s://%s@%s/%s" % (
                parsed.scheme.rsplit("+", 1)[-1],
                parsed.username,
                parsed.hostname + (":%s" % (parsed.port,) if parsed.port else ""),
                parsed.path,
            )
        else:
            dsn = None

        # variables to ship down to the webapp
        use_another_host = current_app.config["WEBAPP_USE_ANOTHER_HOST"]

        # if we have custom js, embed it in the html (making sure we
        # only do one file read in prod).
        fetch_custom_js = current_app.config["WEBAPP_CUSTOM_JS"] and (current_app.debug or not IndexView.custom_js)

        if fetch_custom_js:
            IndexView.custom_js = open(current_app.config["WEBAPP_CUSTOM_JS"]).read()

        disable_custom = request.args and "disable_custom" in request.args

        # use new react code
        if self.use_v2:
            return render_template(
                "webapp.html",
                **{
                    "SENTRY_PUBLIC_DSN": dsn,
                    "RELEASE_INFO": changes.get_revision_info(),
                    "WEBAPP_USE_ANOTHER_HOST": use_another_host,
                    "WEBAPP_CUSTOM_JS": (IndexView.custom_js if not disable_custom else None),
                    "USE_PACKAGED_JS": not current_app.debug,
                    "HAS_CUSTOM_CSS": (current_app.config["WEBAPP_CUSTOM_CSS"] and not disable_custom),
                    "IS_DEBUG": current_app.debug,
                    "PHABRICATOR_LINK_HOST": current_app.config["PHABRICATOR_LINK_HOST"],
                    "COLORBLIND": (user_options.get("user.colorblind") and user_options.get("user.colorblind") != "0"),
                }
            )

        return render_template(
            "index.html",
            **{"SENTRY_PUBLIC_DSN": dsn, "VERSION": changes.get_version(), "WEBAPP_USE_ANOTHER_HOST": use_another_host}
        )
Esempio n. 4
0
    def get(self, path=''):
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' % (parsed.port,) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        return render_template('index.html', **{
            'SENTRY_PUBLIC_DSN': dsn,
            'VERSION': changes.get_version(),
        })
Esempio n. 5
0
    def get(self, path=''):
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' %
                                   (parsed.port, ) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        return render_template(
            'index.html', **{
                'SENTRY_PUBLIC_DSN': dsn,
                'VERSION': changes.get_version(),
            })
Esempio n. 6
0
    def get(self, path=""):
        statsreporter.stats().incr("homepage_view")
        if current_app.config["SENTRY_DSN"] and False:
            parsed = urlparse.urlparse(current_app.config["SENTRY_DSN"])
            dsn = "%s://%s@%s/%s" % (
                parsed.scheme.rsplit("+", 1)[-1],
                parsed.username,
                parsed.hostname + (":%s" % (parsed.port,) if parsed.port else ""),
                parsed.path,
            )
        else:
            dsn = None

        # variables to ship down to the webapp
        webapp_use_another_host = current_app.config["WEBAPP_USE_ANOTHER_HOST"]
        # note that we're only shipping down the filename!
        webapp_customized_content = None
        if current_app.config["WEBAPP_CUSTOMIZED_CONTENT_FILE"]:
            webapp_customized_content = open(current_app.config["WEBAPP_CUSTOMIZED_CONTENT_FILE"]).read()

        # use new react code
        if self.use_v2:
            return render_template(
                "webapp.html",
                **{
                    "SENTRY_PUBLIC_DSN": dsn,
                    "RELEASE_INFO": changes.get_revision_info(),
                    "WEBAPP_USE_ANOTHER_HOST": webapp_use_another_host,
                    "WEBAPP_CUSTOMIZED_CONTENT": webapp_customized_content,
                    "USE_PACKAGED_JS": not current_app.debug,
                    "IS_DEBUG": current_app.debug,
                }
            )

        return render_template(
            "index.html",
            **{
                "SENTRY_PUBLIC_DSN": dsn,
                "VERSION": changes.get_version(),
                "WEBAPP_USE_ANOTHER_HOST": webapp_use_another_host,
            }
        )
Esempio n. 7
0
    def get(self, path=''):
        # require auth
        if not session.get('email'):
            return redirect(url_for('login'))

        if current_app.config['SENTRY_DSN']:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme,
                parsed.username,
                parsed.hostname + (':%s' % (parsed.port,) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        return render_template('index.html', **{
            'SENTRY_PUBLIC_DSN': dsn,
            'VERSION': changes.get_version(),
        })
Esempio n. 8
0
    def get(self, path=''):
        statsreporter.stats().incr('homepage_view')
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' % (parsed.port,) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        # variables to ship down to the webapp
        use_another_host = current_app.config['WEBAPP_USE_ANOTHER_HOST']

        # if we have custom js, embed it in the html (making sure we
        # only do one file read in prod).
        fetch_custom_js = (current_app.config['WEBAPP_CUSTOM_JS'] and
            (current_app.debug or not IndexView.custom_js))

        if fetch_custom_js:
            IndexView.custom_js = open(current_app.config['WEBAPP_CUSTOM_JS']).read()

        # use new react code
        if self.use_v2:
            return render_template('webapp.html', **{
                'SENTRY_PUBLIC_DSN': dsn,
                'RELEASE_INFO': changes.get_revision_info(),
                'WEBAPP_USE_ANOTHER_HOST': use_another_host,
                'WEBAPP_CUSTOM_JS': IndexView.custom_js,
                'USE_PACKAGED_JS': not current_app.debug,
                'IS_DEBUG': current_app.debug
            })

        return render_template('index.html', **{
            'SENTRY_PUBLIC_DSN': dsn,
            'VERSION': changes.get_version(),
            'WEBAPP_USE_ANOTHER_HOST': use_another_host
        })
Esempio n. 9
0
    def get(self, path=''):
        statsreporter.stats().incr('homepage_view')
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' %
                                   (parsed.port, ) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        # variables to ship down to the webapp
        webapp_use_another_host = current_app.config['WEBAPP_USE_ANOTHER_HOST']
        # note that we're only shipping down the filename!
        webapp_customized_content = None
        if current_app.config['WEBAPP_CUSTOMIZED_CONTENT_FILE']:
            webapp_customized_content = open(
                current_app.config['WEBAPP_CUSTOMIZED_CONTENT_FILE']).read()

        # use new react code
        if self.use_v2:
            return render_template(
                'webapp.html', **{
                    'SENTRY_PUBLIC_DSN': dsn,
                    'RELEASE_INFO': changes.get_revision_info(),
                    'WEBAPP_USE_ANOTHER_HOST': webapp_use_another_host,
                    'WEBAPP_CUSTOMIZED_CONTENT': webapp_customized_content,
                    'USE_PACKAGED_JS': not current_app.debug,
                    'IS_DEBUG': current_app.debug
                })

        return render_template(
            'index.html', **{
                'SENTRY_PUBLIC_DSN': dsn,
                'VERSION': changes.get_version(),
                'WEBAPP_USE_ANOTHER_HOST': webapp_use_another_host
            })
Esempio n. 10
0
    def get(self, path=''):
        # get user options, e.g. colorblind
        current_user = get_current_user()
        user_options = {}
        if current_user:
            user_options = dict(
                db.session.query(
                    ItemOption.name,
                    ItemOption.value,
                ).filter(ItemOption.item_id == current_user.id, ))

        statsreporter.stats().incr('homepage_view')
        if current_app.config['SENTRY_DSN'] and False:
            parsed = urlparse.urlparse(current_app.config['SENTRY_DSN'])
            dsn = '%s://%s@%s/%s' % (
                parsed.scheme.rsplit('+', 1)[-1],
                parsed.username,
                parsed.hostname + (':%s' %
                                   (parsed.port, ) if parsed.port else ''),
                parsed.path,
            )
        else:
            dsn = None

        # variables to ship down to the webapp
        use_another_host = current_app.config['WEBAPP_USE_ANOTHER_HOST']

        # if we have custom js, embed it in the html (making sure we
        # only do one file read in prod).
        fetch_custom_js = (current_app.config['WEBAPP_CUSTOM_JS']
                           and (current_app.debug or not IndexView.custom_js))

        if fetch_custom_js:
            IndexView.custom_js = open(
                current_app.config['WEBAPP_CUSTOM_JS']).read()

        disable_custom = request.args and "disable_custom" in request.args

        # use new react code
        if self.use_v2:
            return render_template(
                'webapp.html', **{
                    'SENTRY_PUBLIC_DSN':
                    dsn,
                    'RELEASE_INFO':
                    changes.get_revision_info(),
                    'WEBAPP_USE_ANOTHER_HOST':
                    use_another_host,
                    'WEBAPP_CUSTOM_JS':
                    (IndexView.custom_js if not disable_custom else None),
                    'USE_PACKAGED_JS':
                    not current_app.debug,
                    'HAS_CUSTOM_CSS': (current_app.config['WEBAPP_CUSTOM_CSS']
                                       and not disable_custom),
                    'IS_DEBUG':
                    current_app.debug,
                    'PHABRICATOR_LINK_HOST':
                    current_app.config['PHABRICATOR_LINK_HOST'],
                    'COLORBLIND':
                    (user_options.get('user.colorblind')
                     and user_options.get('user.colorblind') != '0'),
                })

        return render_template(
            'index.html', **{
                'SENTRY_PUBLIC_DSN': dsn,
                'VERSION': changes.get_version(),
                'WEBAPP_USE_ANOTHER_HOST': use_another_host
            })