From 8f85bb7d6cd2aece131aa33ca1922d7d6ac59a90 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 1 May 2019 18:57:10 +0200 Subject: [PATCH] more things for samba --- dirkules/config.py | 1 + dirkules/static/conf/samba_global.conf | 11 +++++++++++ dirkules/templates/samba.html | 6 +++++- dirkules/templates/samba_global.html | 15 +++++++++++++++ dirkules/views.py | 20 +++++++++++++++++--- 5 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 dirkules/static/conf/samba_global.conf create mode 100644 dirkules/templates/samba_global.html diff --git a/dirkules/config.py b/dirkules/config.py index c965d26..0131edc 100644 --- a/dirkules/config.py +++ b/dirkules/config.py @@ -3,6 +3,7 @@ import os from apscheduler.jobstores.memory import MemoryJobStore baseDir = os.path.abspath(os.path.dirname(__file__)) +staticDir = os.path.join(baseDir, 'static') SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(baseDir, 'dirkules.db') SQLALCHEMY_TRACK_MODIFICATIONS = False diff --git a/dirkules/static/conf/samba_global.conf b/dirkules/static/conf/samba_global.conf new file mode 100644 index 0000000..c515550 --- /dev/null +++ b/dirkules/static/conf/samba_global.conf @@ -0,0 +1,11 @@ +socket options = TCP_NODELAY +security = user +encrypt passwords = yes +invalid users = root +usershare allow guests = no +log file = /var/log/samba/log.%m +max log size = 1000 +log level = 3 +unix extensions = yes +time server = yes +server role = standalone server diff --git a/dirkules/templates/samba.html b/dirkules/templates/samba.html index 7d3d596..dc282b1 100644 --- a/dirkules/templates/samba.html +++ b/dirkules/templates/samba.html @@ -4,5 +4,9 @@ {{ super() }} {% endblock %} {% block body %} -HAHA + +
+ Samba Global conf +
+
{% endblock %} diff --git a/dirkules/templates/samba_global.html b/dirkules/templates/samba_global.html new file mode 100644 index 0000000..6ec1e96 --- /dev/null +++ b/dirkules/templates/samba_global.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% block title %}Dashboard{% endblock %} +{% block head %} + {{ super() }} +{% endblock %} +{% block body %} +
+ Feste Bestandteile der Samba global conf +
+ {% for line in conf %} + {{ line }}
+ {% endfor %} +
+
+{% endblock %} diff --git a/dirkules/views.py b/dirkules/views.py index e1c8f56..07d8922 100644 --- a/dirkules/views.py +++ b/dirkules/views.py @@ -6,6 +6,7 @@ from dirkules.models import Drive, Cleaning import dirkules.viewManager.viewManager as viewManager from dirkules.validation.validators import CleaningForm from sqlalchemy import asc, collate +from dirkules.config import staticDir @app.route('/', methods=['GET']) @@ -22,9 +23,6 @@ def drives(): dbDrives.append(d) return render_template('drives.html', drives=dbDrives) -@app.route('/samba', methods=['GET']) -def samba(): - return render_template('samba.html') @app.route('/about', methods=['GET']) def about(): @@ -71,3 +69,19 @@ def add_cleaning(): viewManager.create_cleaning_obj(form.jobname.data, form.path.data, form.active.data) return redirect(url_for('cleaning')) return render_template('add_cleaning.html', form=form) + +@app.route('/samba', methods=['GET']) +def samba(): + return render_template('samba.html') + +@app.route('/samba/global', methods=['GET']) +def samba_global(): + file = open(staticDir + "/conf/samba_global.conf") + conf = list() + while True: + line = file.readline() + if line != '': + conf.append(line.rstrip()) + else: + break + return render_template('samba_global.html', conf=conf) \ No newline at end of file