Add favicon for wssshd web interface

parent a57e71e6
logos/favicon.ico

4.19 KB | W: | H:

logos/favicon.ico

14.7 KB | W: | H:

logos/favicon.ico
logos/favicon.ico
logos/favicon.ico
logos/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}WebSocket SSH Daemon{% endblock %}</title> <title>{% block title %}WebSocket SSH Daemon{% endblock %}</title>
<link rel="icon" href="/logos/favicon.ico" type="image/x-icon">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style> <style>
......
...@@ -27,7 +27,7 @@ import json ...@@ -27,7 +27,7 @@ import json
import sys import sys
import os import os
import threading import threading
from flask import Flask, render_template, request, redirect, url_for, flash, jsonify from flask import Flask, render_template, request, redirect, url_for, flash, jsonify, send_from_directory
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.security import generate_password_hash, check_password_hash
...@@ -38,6 +38,7 @@ clients = {} ...@@ -38,6 +38,7 @@ clients = {}
active_tunnels = {} active_tunnels = {}
debug = False debug = False
server_password = None server_password = None
args = None
# Flask app for web interface # Flask app for web interface
app = Flask(__name__) app = Flask(__name__)
...@@ -60,7 +61,7 @@ class User(UserMixin, db.Model): ...@@ -60,7 +61,7 @@ class User(UserMixin, db.Model):
@login_manager.user_loader @login_manager.user_loader
def load_user(user_id): def load_user(user_id):
return User.query.get(int(user_id)) return db.session.get(User, int(user_id))
# Create database and default admin user # Create database and default admin user
with app.app_context(): with app.app_context():
...@@ -74,6 +75,7 @@ with app.app_context(): ...@@ -74,6 +75,7 @@ with app.app_context():
@app.route('/') @app.route('/')
@login_required @login_required
def index(): def index():
global args
return render_template('index.html', return render_template('index.html',
clients=list(clients.keys()), clients=list(clients.keys()),
websocket_port=args.port, websocket_port=args.port,
...@@ -168,6 +170,10 @@ def get_clients(): ...@@ -168,6 +170,10 @@ def get_clients():
'count': len(clients) 'count': len(clients)
}) })
@app.route('/logos/<path:filename>')
def logos_files(filename):
return send_from_directory('logos', filename)
async def handle_websocket(websocket, path=None): async def handle_websocket(websocket, path=None):
try: try:
async for message in websocket: async for message in websocket:
...@@ -270,6 +276,7 @@ async def main(): ...@@ -270,6 +276,7 @@ async def main():
parser.add_argument('--web-https', action='store_true', help='Enable HTTPS for web interface') parser.add_argument('--web-https', action='store_true', help='Enable HTTPS for web interface')
parser.add_argument('--debug', action='store_true', help='Enable debug output') parser.add_argument('--debug', action='store_true', help='Enable debug output')
global args
args = parser.parse_args() args = parser.parse_args()
global debug global debug
debug = args.debug debug = args.debug
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment