mirror of
https://github.com/vale981/dirkules
synced 2025-03-04 17:01:40 -05:00
more samba
This commit is contained in:
parent
f4cc0bc354
commit
bccec3111e
4 changed files with 14 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
from dirkules.config import staticDir
|
||||
|
||||
from dirkules import db, app_version
|
||||
from dirkules import db, app_version, app
|
||||
|
||||
from dirkules.samba.models import SambaGlobal
|
||||
|
||||
|
@ -18,15 +18,16 @@ def generate_smb():
|
|||
if SambaGlobal.query.first() is None:
|
||||
workgroup = 'WORKGROUP'
|
||||
server_string = '%h dirkules'
|
||||
app.logger.warning("Samba not configured. Using default fallback.")
|
||||
else:
|
||||
workgroup = SambaGlobal.query.get(1)
|
||||
server_string = SambaGlobal.query.get(2)
|
||||
f = open("smb.conf.txt", "w")
|
||||
samba_global = open(staticDir + "/conf/samba_global.conf", "r")
|
||||
f.write("# This file was generated by dirkules v{}".format(app_version))
|
||||
f.write()
|
||||
f.write("# Global Config")
|
||||
f.write("server string = {}".format(server_string))
|
||||
f.write("workgroup = {}".format(workgroup))
|
||||
f.write("# This file was generated by dirkules v{}\n".format(app_version))
|
||||
f.write("")
|
||||
f.write("# Global Config\n")
|
||||
f.write("server string = {}\n".format(server_string))
|
||||
f.write("workgroup = {}\n".format(workgroup))
|
||||
f.write(samba_global.read())
|
||||
f.close()
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Dashboard{% endblock %}
|
||||
{% block title %}Freigabe hinzufügen{% endblock %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<div class="ui container">
|
||||
<t2>Neue Samba Share einrichten</t2>
|
||||
{% from "_formhelpers.html" import render_field %}
|
||||
<form method=post class="ui form error">
|
||||
{{ form.hidden_tag() }}
|
||||
<h4 class="ui dividing header">Allgemeine Informationen</h4>
|
||||
{{ render_field(form.name) }}
|
||||
<div class="fields">
|
||||
|
@ -17,12 +17,12 @@
|
|||
</div>
|
||||
<h4 class="ui dividing header">Erweiterte Informationen</h4>
|
||||
{{ render_field(form.path) }}
|
||||
{{ render_field(form.user) }}
|
||||
<div class="fields">
|
||||
{{ render_field(form.user) }}
|
||||
{{ render_field(form.create_mask) }}
|
||||
{{ render_field(form.dir_mask) }}
|
||||
</div>
|
||||
<button class="ui button" type="submit"><i class="plus icon"></i> Freigabe hinzufügen</button>
|
||||
{{ render_field(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
|
|
|
@ -35,4 +35,4 @@ class SambaAddForm(FlaskForm):
|
|||
validators.NumberRange(min=4, max=4,
|
||||
message="Bitte 4 Zahlen eingeben!")],
|
||||
render_kw={"placeholder": "0700"})
|
||||
submit = SubmitField("Speichern")
|
||||
submit = SubmitField("Freigabe hinzufügen")
|
|
@ -3,7 +3,7 @@ from dirkules import db
|
|||
from dirkules.config import staticDir
|
||||
from flask import render_template, url_for, request, redirect
|
||||
from dirkules.samba import bp_samba
|
||||
from dirkules.samba.manager import set_samba_global
|
||||
from dirkules.samba.manager import set_samba_global, generate_smb
|
||||
from dirkules.samba.models import SambaShare
|
||||
from dirkules.samba.validation import SambaConfigForm, SambaAddForm
|
||||
|
||||
|
@ -41,4 +41,5 @@ def add():
|
|||
|
||||
@bp_samba.route('/generate')
|
||||
def generate():
|
||||
generate_smb()
|
||||
return redirect(url_for('.index'))
|
||||
|
|
Loading…
Add table
Reference in a new issue