mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-07-07 01:24:06 +00:00
Minor fixes
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
FROM arm64v8/python:3-alpine
|
FROM python:3-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -10,4 +10,5 @@ COPY lib.py .
|
|||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
EXPOSE 5000
|
||||||
CMD ["python", "main.py"]
|
CMD ["python", "main.py"]
|
||||||
|
26
main.py
26
main.py
@ -17,7 +17,7 @@ log = logging.getLogger('OutFleet')
|
|||||||
|
|
||||||
SERVERS = list()
|
SERVERS = list()
|
||||||
CLIENTS = dict()
|
CLIENTS = dict()
|
||||||
HOSTNAME = 'test.local:5000'
|
HOSTNAME = ''
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ def format_timestamp(ts):
|
|||||||
return datetime.fromtimestamp(ts // 1000).strftime('%Y-%m-%d %H:%M:%S')
|
return datetime.fromtimestamp(ts // 1000).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
|
|
||||||
def random_string(length=12):
|
def random_string(length=64):
|
||||||
letters = string.ascii_letters + string.digits
|
letters = string.ascii_letters + string.digits
|
||||||
|
|
||||||
return ''.join(random.choice(letters) for i in range(length))
|
return ''.join(random.choice(letters) for i in range(length))
|
||||||
@ -34,6 +34,7 @@ def random_string(length=12):
|
|||||||
def update_state():
|
def update_state():
|
||||||
global SERVERS
|
global SERVERS
|
||||||
global CLIENTS
|
global CLIENTS
|
||||||
|
global HOSTNAME
|
||||||
SERVERS = list()
|
SERVERS = list()
|
||||||
CLIENTS = dict()
|
CLIENTS = dict()
|
||||||
config = dict()
|
config = dict()
|
||||||
@ -45,11 +46,15 @@ def update_state():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if config:
|
if config:
|
||||||
|
HOSTNAME = config.get('ui_hostname', 'my-own-ssl-ENABLED-domain.com')
|
||||||
servers = config.get('servers', list())
|
servers = config.get('servers', list())
|
||||||
for server_id, server_config in servers.items():
|
for server_id, server_config in servers.items():
|
||||||
server = Server(url=server_config["url"], cert=server_config["cert"], comment=server_config["comment"])
|
try:
|
||||||
SERVERS.append(server)
|
server = Server(url=server_config["url"], cert=server_config["cert"], comment=server_config["comment"])
|
||||||
log.info("Server found: %s", server.info()["name"])
|
SERVERS.append(server)
|
||||||
|
log.info("Server found: %s", server.info()["name"])
|
||||||
|
except Exception as e:
|
||||||
|
log.warning("Can't access server: %s - %s", server_config["url"], e)
|
||||||
|
|
||||||
CLIENTS = config.get('clients', list())
|
CLIENTS = config.get('clients', list())
|
||||||
|
|
||||||
@ -194,15 +199,10 @@ def dynamic(server_name, client_id):
|
|||||||
"server": server.data["hostname_for_access_keys"],
|
"server": server.data["hostname_for_access_keys"],
|
||||||
"server_port": key.port,
|
"server_port": key.port,
|
||||||
"password": key.password,
|
"password": key.password,
|
||||||
"method": key.method
|
"method": key.method,
|
||||||
|
"info": "Managed by OutFleet [github.com/house-of-vanity/OutFleet/]"
|
||||||
}
|
}
|
||||||
|
return "Hey buddy, i think you got the wrong door the leather-club is two blocks down"
|
||||||
log.info("CLIENT: %s", client)
|
|
||||||
log.info("SERVER: %s", server.data)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return f"{server_name}, {client_id}"
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
update_state()
|
update_state()
|
||||||
|
@ -94,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="pure-button pure-input-1 pure-button-primary">Save</button>
|
<button type="submit" class="pure-button pure-input-1 pure-button-primary">Save and apply</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -123,7 +123,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-u-1 pure-u-md-1">
|
<div class="pure-u-1">
|
||||||
<h3>Dynamic Access Keys</h3>
|
<h3>Dynamic Access Keys</h3>
|
||||||
<table class="pure-table">
|
<table class="pure-table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -138,7 +138,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ server.info()['name'] }}</td>
|
<td>{{ server.info()['name'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
<pre style="font-size: 10pt">{% for key in server.data["keys"] %}{% if key.name == client['name'] %}ssconf://{{ dynamic_hostname }}/dynamic/{{server.info()['name']}}/{{selected_client}}{% endif %}{% endfor %}</pre>
|
<p style="font-size: 10pt">{% for key in server.data["keys"] %}{% if key.name == client['name'] %}ssconf://{{ dynamic_hostname }}/dynamic/{{server.info()['name']}}/{{selected_client}}#{{server.info()['comment']}}{% endif %}{% endfor %}</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
<input type="radio" id="metrics_disabled" name="metrics" value="False" {% if server.info()['metrics_enabled'] == False %}checked{% endif %} /> Disable
|
<input type="radio" id="metrics_disabled" name="metrics" value="False" {% if server.info()['metrics_enabled'] == False %}checked{% endif %} /> Disable
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<button type="submit" class="pure-button pure-button-primary">Submit</button>
|
<button type="submit" class="pure-button pure-button-primary">Save and apply</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user