Esempio n. 1
0
def is_website_enabled(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({'result': 'error', 'message': 'no website given'})

    website, _ = Website.get_or_create(hostname=hostname)
    request.reply({'result': 'success', 'enabled': website.enabled})
Esempio n. 2
0
    def serverconnect(self, server_conn):
        if self._check_should_skip(server_conn=server_conn):
            return SKIP_PIPES

        hostname = server_conn.address.host
        website, _ = Website.get_or_create(hostname=hostname)

        if not website.enabled:
            return self._skip(server_conn=server_conn)
Esempio n. 3
0
    def response(self, flow):
        if self._check_should_skip(flow=flow):
            return SKIP_PIPES

        hostname = urlparse(flow.request.url).netloc
        website, _ = Website.get_or_create(hostname=hostname)

        if not website.enabled:
            return self._skip(flow=flow)
Esempio n. 4
0
def is_website_enabled(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({
            'result': 'error',
            'message': 'no website given'
        })

    website, _ = Website.get_or_create(hostname=hostname)
    request.reply({'result': 'success', 'enabled': website.enabled})
Esempio n. 5
0
def enable_website(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({'result': 'error', 'message': 'no website given'})

    website, _ = Website.get_or_create(hostname=hostname)

    if not website.enabled:
        website.enabled = True
        website.save()
    request.reply({'result': 'success'})
Esempio n. 6
0
def enable_website(context, request):
    hostname = request.params.get('website', None)

    if hostname is None:
        return request.reply({
            'result': 'error',
            'message': 'no website given'
        })

    website, _ = Website.get_or_create(hostname=hostname)

    if not website.enabled:
        website.enabled = True
        website.save()
    request.reply({'result': 'success'})