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