Changeset - 6a5a15855897
[Not reviewed]
version_5
0 5 0
Dennis Fink - 10 years ago 2015-08-26 18:32:29
dennis.fink@c3l.lu
Remove status from model

tor_status was renamed to status. Because people are only interested in if the
tor process is actually running!
5 files changed with 5 insertions and 16 deletions:
0 comments (0 inline, 0 general)
ennstatus/api/model.py
Show inline comments
 
@@ -84,13 +84,12 @@ class Server:
 

	
 
    def __init__(self, *args, **kwargs):
 

	
 
        self.name = kwargs['name']
 
        self.type = kwargs['type']
 
        self.status = kwargs.get('status')
 
        self.tor_status = kwargs.get('tor_status')
 
        self.fingerprint = kwargs['fingerprint']
 
        self.last_updated = kwargs['last_updated']
 
        self.country = kwargs['country']
 
        self.bandwith = kwargs.get('bandwith')
 

	
 
        if self.type == 'bridge':
 
@@ -232,10 +231,8 @@ class Server:
 

	
 
        now = datetime.utcnow()
 
        delta = now - self.last_updated
 

	
 
        if delta.seconds >= 3600:
 
            self.status = False
 
            self.tor_status = False
 
            return False
 
        else:
 
            return True
 
        elif delta.seconds >= 600:
 
            self.status = None
ennstatus/api/schema/server.json
Show inline comments
 
@@ -6,15 +6,12 @@
 
        "name": {
 
            "type": "string"
 
        },
 
        "status": {
 
            "$ref": "#/definitions/status_data"
 
        },
 
        "tor_status": {
 
            "$ref": "#/definitions/status_data"
 
        },
 
        "country": {
 
            "type": "string",
 
            "enum": [
 
                "Afghanistan", "Aland Islands", "Albania", "Algeria", 
 
                "American Samoa", "Andorra", "Angola", "Anguilla",
 
                "Anonymous Proxy", "Antarctica", "Antigua and Barbuda",
 
@@ -105,13 +102,12 @@
 
            "type": "string"
 
        }
 
    },
 
    "required": [
 
        "name",
 
        "status",
 
        "tor_status",
 
        "last_updated",
 
        "country",
 
        "fingerprint",
 
        "type"
 
    ],
 
    "definitions": {
ennstatus/api/views.py
Show inline comments
 
@@ -58,13 +58,12 @@ def update():
 
    else:
 
        data['country'] = None
 

	
 
    data['last_updated'] = strict_rfc3339.timestamp_to_rfc3339_utcoffset(
 
        datetime.utcnow().timestamp()
 
    )
 
    data['status'] = True
 

	
 
    try:
 
        server = Server.from_json(json.dumps(data))
 
    except Exception as e:
 
        current_app.logger.warning(' '.join([str(e), str(data)]))
 
        return str(e), 409, {'Content-Type': 'text/plain'}
ennstatus/templates/api/export/xml/server.xml
Show inline comments
 
<server>
 
    <type>{{ server.type }}</type>
 
    <name>{{ server.name }}</name>
 
    <status>{{ server.status }}</status>
 
    <tor_status>{{ server.tor_status }}</tor_status>
 
    <country>{{ server.country }}</country>
 
    <last_updated>{{ server.last_updated }}</last_updated>
 
    <fingerprint>{{ serverfingerprint }}</fingerprint>
 
    {% if server.type == 'bridge' %}
 
    <obfs>{{ server.obfs }}</obfs>
 
    <fteproxy>{{ server.fteproxy }}</fteproxy>
ennstatus/templates/status/macros.html
Show inline comments
 
@@ -47,15 +47,15 @@
 
  {{ moment(date).format(config['ENNSTATUS_MOMENTJS_FORMAT']) }}
 
  <noscript>{{ date.strftime(config['ENNSTATUS_STRFTIME_FORMAT']) }}</noscript>
 
{% endmacro %}
 

	
 
{% macro create_server_table(server_type, servers) %}
 
  {% if server_type in ('exit', 'relay') %}
 
    {% set headers = ('#', 'Name', 'IP', 'IP6', 'Server Status', 'Tor Status', 'Country', 'Fingerprint', 'Last Updated <noscript>(UTC)</noscript>') %}
 
    {% set headers = ('#', 'Name', 'IP', 'IP6', 'Tor Status', 'Country', 'Fingerprint', 'Last Updated <noscript>(UTC)</noscript>') %}
 
  {% else %}
 
    {% set headers = ('#', 'Name', 'Server Status', 'Tor Status', 'Country', 'Fingerprint', 'OBFS', 'FTEProxy', 'Flashproxy', 'meek', 'Last Updated <noscript>(UTC)</noscript>') %}
 
    {% set headers = ('#', 'Name', 'Tor Status', 'Country', 'Fingerprint', 'OBFS', 'FTEProxy', 'Flashproxy', 'meek', 'Last Updated <noscript>(UTC)</noscript>') %}
 
  {% endif %}
 
  <h2>{{ server_type|title }}</h2>
 
  <table class="table table-bordered table-striped sortable">
 
    <thead>
 
      <tr>
 
        {% for name in headers %}
 
@@ -77,15 +77,13 @@
 
                <a href="{{ url_for('root.bridgeprogram') }}">{{ server.name }}</a>
 
              {% else %}
 
                {{ server.name }}
 
              {% endif %}
 
            </td>
 
          {% endif %}
 
          {% for status in (server.status, server.tor_status) %}
 
            <td>{{ colorize_status(status) }}</td>
 
          {% endfor %}
 
          <td>{{ colorize_status(server.status) }}</td>
 
          <td>{{ create_country(server.country) }}</td>
 
          <td>{{ create_fingerprint(server.fingerprint, server.type) }}</td>
 
          {% if server_type == 'bridge' %}
 
            <td>{{ colorize_obfs(server.obfs) }}</td>
 
            <td>{{ colorize_obfs(server.fteproxy) }}</td>
 
            <td>{{ colorize_obfs(server.flashproxy) }}</td>
0 comments (0 inline, 0 general)