mirror of
https://github.com/simon987/Simple-Incremental-Search-Tool.git
synced 2025-04-19 18:16:45 +00:00
Translated to french and bugfixes
This commit is contained in:
parent
3b2d2bdd8d
commit
f76c935c49
@ -25,6 +25,9 @@ bcrypt_rounds = 14
|
|||||||
# sqlite3 database path
|
# sqlite3 database path
|
||||||
db_path = "./local_storage.db"
|
db_path = "./local_storage.db"
|
||||||
|
|
||||||
|
# Set to true to allow guests to search any directory
|
||||||
|
allow_guests = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import cairosvg
|
import cairosvg
|
||||||
cairosvg = True
|
cairosvg = True
|
||||||
|
@ -23,7 +23,7 @@ class Indexer:
|
|||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
time.sleep(15)
|
time.sleep(25)
|
||||||
|
|
||||||
if self.es.indices.exists(self.index_name):
|
if self.es.indices.exists(self.index_name):
|
||||||
print("Index is already setup")
|
print("Index is already setup")
|
||||||
|
164
run.py
164
run.py
@ -38,19 +38,16 @@ def get_dir_size(path):
|
|||||||
def user_manage(user):
|
def user_manage(user):
|
||||||
|
|
||||||
if "admin" in session and session["admin"]:
|
if "admin" in session and session["admin"]:
|
||||||
pass
|
return render_template("user_manage.html", directories=storage.dirs(), user=storage.users()[user])
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
return user
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/logout")
|
@app.route("/logout")
|
||||||
def logout():
|
def logout():
|
||||||
session.pop("username")
|
session.pop("username")
|
||||||
session.pop("admin")
|
session.pop("admin")
|
||||||
flash("Successfully logged out", "success")
|
flash("Déconnection réussie", "success")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -63,9 +60,9 @@ def login():
|
|||||||
session["username"] = username
|
session["username"] = username
|
||||||
session["admin"] = storage.users()[username].admin
|
session["admin"] = storage.users()[username].admin
|
||||||
|
|
||||||
flash("Successfully logged in", "success")
|
flash("Connexion réussie", "success")
|
||||||
else:
|
else:
|
||||||
flash("Invalid username or password", "danger")
|
flash("Nom d'utilisateur ou mot de passe invalide", "danger")
|
||||||
|
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
@ -83,10 +80,50 @@ def user_page():
|
|||||||
if not admin_account_present or ("admin" in session and session["admin"]):
|
if not admin_account_present or ("admin" in session and session["admin"]):
|
||||||
return render_template("user.html", users=storage.users(), admin_account_present=admin_account_present)
|
return render_template("user.html", users=storage.users(), admin_account_present=admin_account_present)
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/user/<username>/set_access")
|
||||||
|
def user_set_access(username):
|
||||||
|
|
||||||
|
if "admin" in session and session["admin"]:
|
||||||
|
dir_id = request.args["dir_id"]
|
||||||
|
user = storage.users()[username]
|
||||||
|
|
||||||
|
if request.args["access"] == "1":
|
||||||
|
user.readable_directories.add(int(dir_id))
|
||||||
|
else:
|
||||||
|
if int(dir_id) in user.readable_directories:
|
||||||
|
user.readable_directories.remove(int(dir_id))
|
||||||
|
|
||||||
|
storage.update_user(user)
|
||||||
|
|
||||||
|
flash("Permissions mises à jour", "success")
|
||||||
|
return redirect("/user/" + username)
|
||||||
|
else:
|
||||||
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/user/<username>/set_admin")
|
||||||
|
def user_set_admin(username):
|
||||||
|
|
||||||
|
if "admin" in session and session["admin"]:
|
||||||
|
|
||||||
|
user = storage.users()[username]
|
||||||
|
|
||||||
|
if user.username == session["username"]:
|
||||||
|
flash("Vous n'êtes pas autorisé à changer votre propre type de compte", "warning")
|
||||||
|
else:
|
||||||
|
user.admin = request.args["admin"] == "1"
|
||||||
|
storage.update_user(user)
|
||||||
|
|
||||||
|
flash("Permissions mises à jour", "success")
|
||||||
|
|
||||||
|
return redirect("/user/" + username)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/user/add", methods=['POST'])
|
@app.route("/user/add", methods=['POST'])
|
||||||
def user_add():
|
def user_add():
|
||||||
|
|
||||||
@ -104,21 +141,38 @@ def user_add():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
storage.save_user(User(username, password, is_admin))
|
storage.save_user(User(username, password, is_admin))
|
||||||
flash("Created new user", "success")
|
flash("Nouvel utilisateur créé", "success")
|
||||||
except DuplicateUserException:
|
except DuplicateUserException:
|
||||||
flash("<strong>Couldn't create user</strong> Make sure that the username is unique", "danger")
|
flash("<strong>L'utilisateur n'as pas pu être créé</strong> Assurez vous que le nom d'utilisateur est unique", "danger")
|
||||||
|
|
||||||
return redirect("/user")
|
return redirect("/user")
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/user/<username>/del")
|
||||||
|
def user_del(username):
|
||||||
|
|
||||||
|
if "admin" in session and session["admin"]:
|
||||||
|
|
||||||
|
if session["username"] == username:
|
||||||
|
flash("Vous ne pouvez pas supprimer votre propre compte", "warning")
|
||||||
|
return redirect("/user/" + username)
|
||||||
|
else:
|
||||||
|
storage.remove_user(username)
|
||||||
|
flash("Utilisateur supprimé", "success")
|
||||||
|
return redirect("/user")
|
||||||
|
else:
|
||||||
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
|
return redirect("/")
|
||||||
|
|
||||||
@app.route("/suggest")
|
@app.route("/suggest")
|
||||||
def suggest():
|
def suggest():
|
||||||
|
|
||||||
return json.dumps(search.suggest(request.args.get("prefix")))
|
return json.dumps(search.suggest(request.args.get("prefix")))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/document/<doc_id>")
|
@app.route("/document/<doc_id>")
|
||||||
def document(doc_id):
|
def document(doc_id):
|
||||||
|
|
||||||
@ -171,14 +225,12 @@ def thumb(doc_id):
|
|||||||
if os.path.isfile(tn_path):
|
if os.path.isfile(tn_path):
|
||||||
return send_file(tn_path)
|
return send_file(tn_path)
|
||||||
else:
|
else:
|
||||||
print("tn not found")
|
|
||||||
default_thumbnail = BytesIO()
|
default_thumbnail = BytesIO()
|
||||||
Image.new("RGB", (255, 128), (0, 0, 0)).save(default_thumbnail, "JPEG")
|
Image.new("RGB", (255, 128), (0, 0, 0)).save(default_thumbnail, "JPEG")
|
||||||
default_thumbnail.seek(0)
|
default_thumbnail.seek(0)
|
||||||
return send_file(default_thumbnail, "image/jpeg")
|
return send_file(default_thumbnail, "image/jpeg")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("doc is none")
|
|
||||||
default_thumbnail = BytesIO()
|
default_thumbnail = BytesIO()
|
||||||
Image.new("RGB", (255, 128), (0, 0, 0)).save(default_thumbnail, "JPEG")
|
Image.new("RGB", (255, 128), (0, 0, 0)).save(default_thumbnail, "JPEG")
|
||||||
default_thumbnail.seek(0)
|
default_thumbnail.seek(0)
|
||||||
@ -189,9 +241,13 @@ def thumb(doc_id):
|
|||||||
def search_page():
|
def search_page():
|
||||||
|
|
||||||
mime_map = search.get_mime_map()
|
mime_map = search.get_mime_map()
|
||||||
mime_map.append({"id": "any", "text": "Any"})
|
mime_map.append({"id": "any", "text": "Tous"})
|
||||||
|
|
||||||
return render_template("search.html", directories=storage.dirs(), mime_map=mime_map)
|
directories = [storage.dirs()[x] for x in get_allowed_dirs(session["username"] if "username" in session else None)]
|
||||||
|
|
||||||
|
return render_template("search.html",
|
||||||
|
directories=directories,
|
||||||
|
mime_map=mime_map)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/list")
|
@app.route("/list")
|
||||||
@ -199,6 +255,18 @@ def search_liste_page():
|
|||||||
return render_template("searchList.html")
|
return render_template("searchList.html")
|
||||||
|
|
||||||
|
|
||||||
|
def get_allowed_dirs(username):
|
||||||
|
|
||||||
|
if config.allow_guests:
|
||||||
|
return [x for x in storage.dirs() if x.enabled]
|
||||||
|
else:
|
||||||
|
if username:
|
||||||
|
user = storage.users()[username]
|
||||||
|
return [x for x in storage.dirs() if storage.dirs()[x].enabled and x in user.readable_directories]
|
||||||
|
else:
|
||||||
|
return list()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/search", methods=['POST'])
|
@app.route("/search", methods=['POST'])
|
||||||
def search_route():
|
def search_route():
|
||||||
|
|
||||||
@ -212,19 +280,8 @@ def search_route():
|
|||||||
directories = request.json["directories"]
|
directories = request.json["directories"]
|
||||||
|
|
||||||
# Remove disabled & non-existing directories
|
# Remove disabled & non-existing directories
|
||||||
for search_directory in directories:
|
allowed_dirs = get_allowed_dirs(session["username"] if "username" in session else None)
|
||||||
directory_exists = False
|
directories = [x for x in directories if x in allowed_dirs]
|
||||||
|
|
||||||
for dir_id in storage.dirs():
|
|
||||||
if search_directory == dir_id:
|
|
||||||
directory_exists = True
|
|
||||||
|
|
||||||
if not storage.dirs()[dir_id].enabled:
|
|
||||||
directories.remove(search_directory)
|
|
||||||
break
|
|
||||||
|
|
||||||
if not directory_exists:
|
|
||||||
directories.remove(search_directory)
|
|
||||||
|
|
||||||
path = request.json["path"]
|
path = request.json["path"]
|
||||||
|
|
||||||
@ -249,7 +306,7 @@ def dir_list():
|
|||||||
if "admin" in session and session["admin"]:
|
if "admin" in session and session["admin"]:
|
||||||
return render_template("directory.html", directories=storage.dirs())
|
return render_template("directory.html", directories=storage.dirs())
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -266,13 +323,13 @@ def directory_add():
|
|||||||
try:
|
try:
|
||||||
d.set_default_options()
|
d.set_default_options()
|
||||||
storage.save_directory(d)
|
storage.save_directory(d)
|
||||||
flash("<strong>Created directory</strong>", "success")
|
flash("<strong>Dossier créé</strong>", "success")
|
||||||
except DuplicateDirectoryException:
|
except DuplicateDirectoryException:
|
||||||
flash("<strong>Couldn't create directory</strong> Make sure that the path is unique", "danger")
|
flash("<strong>Le dossier n'a pas pu être créé</strong> Assurer vous de choisir un nom unique", "danger")
|
||||||
|
|
||||||
return redirect("/directory")
|
return redirect("/directory")
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -287,7 +344,7 @@ def directory_manage(dir_id):
|
|||||||
return render_template("directory_manage.html", directory=directory, tn_size=tn_size,
|
return render_template("directory_manage.html", directory=directory, tn_size=tn_size,
|
||||||
tn_size_formatted=tn_size_formatted)
|
tn_size_formatted=tn_size_formatted)
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -312,14 +369,14 @@ def directory_update(dir_id):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
storage.update_directory(updated_dir)
|
storage.update_directory(updated_dir)
|
||||||
flash("<strong>Updated directory</strong>", "success")
|
flash("<strong>Dossier mis à jour</strong>", "success")
|
||||||
|
|
||||||
except DuplicateDirectoryException:
|
except DuplicateDirectoryException:
|
||||||
flash("<strong>Couldn't update directory</strong> Make sure that the path is unique", "danger")
|
flash("<strong>Le dossier n'a pas pu être mis à jour</strong> Assurez vous que le chemin est unique", "danger")
|
||||||
|
|
||||||
return redirect("/directory/" + str(dir_id))
|
return redirect("/directory/" + str(dir_id))
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -335,7 +392,7 @@ def directory_update_opt(dir_id):
|
|||||||
|
|
||||||
return redirect("/directory/" + str(dir_id))
|
return redirect("/directory/" + str(dir_id))
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -347,11 +404,11 @@ def directory_del(dir_id):
|
|||||||
shutil.rmtree("static/thumbnails/" + str(dir_id))
|
shutil.rmtree("static/thumbnails/" + str(dir_id))
|
||||||
|
|
||||||
storage.remove_directory(dir_id)
|
storage.remove_directory(dir_id)
|
||||||
flash("<strong>Deleted directory</strong>", "success")
|
flash("<strong>Dossier supprimé</strong>", "success")
|
||||||
|
|
||||||
return redirect("/directory")
|
return redirect("/directory")
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -374,10 +431,10 @@ def directory_reset(dir_id):
|
|||||||
|
|
||||||
search.delete_directory(dir_id)
|
search.delete_directory(dir_id)
|
||||||
|
|
||||||
flash("<strong>Reset directory options to default settings</strong>", "success")
|
flash("<strong>Options du dossier réinitialisés</strong>", "success")
|
||||||
return redirect("directory/" + str(dir_id))
|
return redirect("directory/" + str(dir_id))
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -387,7 +444,7 @@ def task():
|
|||||||
return render_template("task.html", tasks=storage.tasks(), directories=storage.dirs(),
|
return render_template("task.html", tasks=storage.tasks(), directories=storage.dirs(),
|
||||||
task_list=json.dumps(list(storage.tasks().keys())))
|
task_list=json.dumps(list(storage.tasks().keys())))
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -400,7 +457,7 @@ def get_current_task():
|
|||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -410,11 +467,18 @@ def task_add():
|
|||||||
task_type = request.args.get("type")
|
task_type = request.args.get("type")
|
||||||
directory = request.args.get("directory")
|
directory = request.args.get("directory")
|
||||||
|
|
||||||
storage.save_task(Task(task_type, directory))
|
if task_type not in ("1", "2"):
|
||||||
|
flash("Vous devez choisir un type de tâche", "danger")
|
||||||
|
return redirect("/task")
|
||||||
|
|
||||||
|
if directory.isdigit() and int(directory) in storage.dirs():
|
||||||
|
storage.save_task(Task(task_type, directory))
|
||||||
|
else:
|
||||||
|
flash("Vous devez choisir un dossier", "danger")
|
||||||
|
|
||||||
return redirect("/task")
|
return redirect("/task")
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -428,14 +492,14 @@ def task_del(task_id):
|
|||||||
|
|
||||||
return redirect("/task")
|
return redirect("/task")
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@app.route("/reset_es")
|
@app.route("/reset_es")
|
||||||
def reset_es():
|
def reset_es():
|
||||||
if "admin" in session and session["admin"]:
|
if "admin" in session and session["admin"]:
|
||||||
flash("Elasticsearch index has been reset. Modifications made in <b>config.py</b> have been applied.", "success")
|
flash("Elasticsearch a été réinitialisé, les changements dans <strong>config.py</strong> ont été appliqués", "success")
|
||||||
|
|
||||||
tm.indexer.init()
|
tm.indexer.init()
|
||||||
if os.path.exists("static/thumbnails"):
|
if os.path.exists("static/thumbnails"):
|
||||||
@ -443,7 +507,7 @@ def reset_es():
|
|||||||
|
|
||||||
return redirect("/dashboard")
|
return redirect("/dashboard")
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
@ -470,7 +534,7 @@ def dashboard():
|
|||||||
index_size=humanfriendly.format_size(search.get_index_size()))
|
index_size=humanfriendly.format_size(search.get_index_size()))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
flash("You are not authorized to access this page", "warning")
|
flash("Vous n'êtes pas autorisé à accéder à cette page", "warning")
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ function makeStatsCard(searchResult) {
|
|||||||
statsCardBody.setAttribute("class", "card-body");
|
statsCardBody.setAttribute("class", "card-body");
|
||||||
|
|
||||||
let stat = document.createElement("p");
|
let stat = document.createElement("p");
|
||||||
stat.appendChild(document.createTextNode(searchResult["hits"]["total"] + " results in " + searchResult["took"] + "ms"));
|
stat.appendChild(document.createTextNode(searchResult["hits"]["total"] + " résultats en " + searchResult["took"] + "ms"));
|
||||||
|
|
||||||
let sizeStat = document.createElement("span");
|
let sizeStat = document.createElement("span");
|
||||||
sizeStat.appendChild(document.createTextNode(humanFileSize(searchResult["aggregations"]["total_size"]["value"])));
|
sizeStat.appendChild(document.createTextNode(humanFileSize(searchResult["aggregations"]["total_size"]["value"])));
|
||||||
@ -173,8 +173,8 @@ function gifOver(thumbnail, documentId) {
|
|||||||
|
|
||||||
function downloadPopover(element, documentId) {
|
function downloadPopover(element, documentId) {
|
||||||
element.setAttribute("data-content",
|
element.setAttribute("data-content",
|
||||||
'<a class="btn btn-sm btn-primary" href="/dl/'+ documentId +'"><i class="fas fa-download"></i> Download</a>' +
|
'<a class="btn btn-sm btn-primary" href="/dl/'+ documentId +'"><i class="fas fa-download"></i> Télécharger</a>' +
|
||||||
'<a class="btn btn-sm btn-success" style="margin-left:3px;" href="/file/'+ documentId + '" target="_blank"><i class="fas fa-eye"></i> View</a>');
|
'<a class="btn btn-sm btn-success" style="margin-left:3px;" href="/file/'+ documentId + '" target="_blank"><i class="fas fa-eye"></i> Consulter</a>');
|
||||||
element.setAttribute("data-toggle", "popover");
|
element.setAttribute("data-toggle", "popover");
|
||||||
element.addEventListener("mouseover", function() {
|
element.addEventListener("mouseover", function() {
|
||||||
element.focus();
|
element.focus();
|
||||||
@ -267,7 +267,7 @@ function createDocCard(hit) {
|
|||||||
}
|
}
|
||||||
thumbnailOverlay.appendChild(resolutionBadge);
|
thumbnailOverlay.appendChild(resolutionBadge);
|
||||||
|
|
||||||
var format = hit["_source"]["format"];
|
var format = hit["_source"]["format_name"];
|
||||||
|
|
||||||
//Hover
|
//Hover
|
||||||
if(format === "GIF") {
|
if(format === "GIF") {
|
||||||
@ -592,4 +592,4 @@ document.getElementById("pathBar").addEventListener("keyup", function () {
|
|||||||
searchQueued = true;
|
searchQueued = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
window.setInterval(search, 150);
|
window.setInterval(search, 300);
|
17
storage.py
17
storage.py
@ -28,6 +28,7 @@ class User:
|
|||||||
self.username = username
|
self.username = username
|
||||||
self.hashed_password = hashed_password
|
self.hashed_password = hashed_password
|
||||||
self.admin = admin
|
self.admin = admin
|
||||||
|
self.readable_directories = set()
|
||||||
|
|
||||||
|
|
||||||
class Option:
|
class Option:
|
||||||
@ -224,7 +225,15 @@ class LocalStorage:
|
|||||||
db_users = c.fetchall()
|
db_users = c.fetchall()
|
||||||
|
|
||||||
for db_user in db_users:
|
for db_user in db_users:
|
||||||
self.cached_users[db_user[0]] = User(db_user[0], b"", bool(db_user[1]))
|
user = User(db_user[0], b"", bool(db_user[1]))
|
||||||
|
|
||||||
|
c.execute("SELECT username, directory_id FROM User_canRead_Directory WHERE username=?", (db_user[0],))
|
||||||
|
db_accesses = c.fetchall()
|
||||||
|
|
||||||
|
for db_access in db_accesses:
|
||||||
|
user.readable_directories.add(db_access[1])
|
||||||
|
|
||||||
|
self.cached_users[db_user[0]] = user
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
@ -256,6 +265,12 @@ class LocalStorage:
|
|||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute("UPDATE User SET is_admin=? WHERE username=?", (user.admin, user.username))
|
c.execute("UPDATE User SET is_admin=? WHERE username=?", (user.admin, user.username))
|
||||||
|
|
||||||
|
c.execute("DELETE FROM User_canRead_Directory WHERE username=?", (user.username, ))
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
for access in user.readable_directories:
|
||||||
|
c.execute("INSERT INTO User_canRead_Directory VALUES (?,?)", (user.username, access))
|
||||||
|
|
||||||
c.close()
|
c.close()
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Global Information</div>
|
<div class="card-header">Information globale</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table class="info-table table-hover table-striped">
|
<table class="info-table table-hover table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -14,45 +14,45 @@
|
|||||||
<td><pre>{{ version }}</pre></td>
|
<td><pre>{{ version }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total thumbnail cache size</th>
|
<th>Taille totale des miniatures</th>
|
||||||
<td><pre>{{ tn_size_total }}</pre></td>
|
<td><pre>{{ tn_size_total }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total document count</th>
|
<th>Nombre de documents totals</th>
|
||||||
<td><pre>{{ doc_count }}</pre></td>
|
<td><pre>{{ doc_count }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total size of indexed documents</th>
|
<th>Taille totale des documents indexés</th>
|
||||||
<td><pre>{{ doc_size }}</pre></td>
|
<td><pre>{{ doc_size }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Total index size</th>
|
<th>Taille totale de l'index</th>
|
||||||
<td><pre>{{ index_size }}</pre></td>
|
<td><pre>{{ index_size }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User count</th>
|
<th>Nombre d'utilisateurs</th>
|
||||||
<td><pre>1</pre></td>
|
<td><pre>1</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>SQLite database path</th>
|
<th>Chemin de la base de donnée SQLite</th>
|
||||||
<td><pre>{{ db_path }}</pre></td>
|
<td><pre>{{ db_path }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Elasticsearch URL</th>
|
<th>Adresse Elasticsearch</th>
|
||||||
<td><pre>{{ elasticsearch_url }}</pre></td>
|
<td><pre>{{ elasticsearch_url }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer text-muted">Change global settings in <b>config.py</b></div>
|
<div class="card-footer text-muted">Changez les paramètres dans <b>config.py</b></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Actions</div>
|
<div class="card-header">Actions</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<button class="btn btn-danger" onclick="resetAll()">
|
<button class="btn btn-danger" onclick="resetAll()">
|
||||||
<i class="fas fa-exclamation-triangle"></i> Reset elasticsearch index
|
<i class="fas fa-exclamation-triangle"></i> Réinitialiser l'index elasticsearch
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -60,8 +60,8 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
function resetAll() {
|
function resetAll() {
|
||||||
if (confirm("This will entirely reset the index and documents will need to be re-indexed.\n\n" +
|
if (confirm("Cela va entièrement réinitialiser l'index et ses documents devrons être réindexés.\n\n" +
|
||||||
"Do you want to proceed?")) {
|
"Voulez-vous procéder?")) {
|
||||||
window.location = "/reset_es"
|
window.location = "/reset_es"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% set active_page = "directory" %}
|
{% set active_page = "directory" %}
|
||||||
|
|
||||||
{% block title %}An Excellent title{% endblock title %}
|
{% block title %}Liste des dossiers{% endblock title %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
{# Add directory form #}
|
{# Add directory form #}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">An excellent form</div>
|
<div class="card-header">Ajouter un dossier</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<form method="GET" action="/directory/add">
|
<form method="GET" action="/directory/add">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" placeholder="Display name" name="name">
|
<input type="text" class="form-control" placeholder="Nom du dossier" name="name">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="text" class="form-control" placeholder="Absolute path" name="path">
|
<input type="text" class="form-control" placeholder="Chemin absolu" name="path">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Add Directory</button>
|
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Ajouter</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -26,16 +26,15 @@
|
|||||||
|
|
||||||
{# List of directories #}
|
{# List of directories #}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">An excellent list</div>
|
<div class="card-header">Liste des dossiers</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<table class="info-table table-hover table-striped">
|
<table class="info-table table-hover table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Display Name</th>
|
<th>Nom</th>
|
||||||
<th>Path</th>
|
<th>Chemin</th>
|
||||||
<th>Enabled</th>
|
<th>Activé</th>
|
||||||
<th>Last indexed</th>
|
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -45,8 +44,7 @@
|
|||||||
<td>{{ directories[dir].name }}</td>
|
<td>{{ directories[dir].name }}</td>
|
||||||
<td style="word-break: break-all"><pre>{{ directories[dir].path }}</pre></td>
|
<td style="word-break: break-all"><pre>{{ directories[dir].path }}</pre></td>
|
||||||
<td><i class="far {{ "fa-check-square" if directories[dir].enabled else "fa-square" }}"></i></td>
|
<td><i class="far {{ "fa-check-square" if directories[dir].enabled else "fa-square" }}"></i></td>
|
||||||
<td>2018-02-21</td>
|
<td><a href="directory/{{ dir }}" class="btn btn-primary"><i class="fas fa-cog"></i> Gérer</a> </td>
|
||||||
<td><a href="directory/{{ dir }}" class="btn btn-primary"><i class="fas fa-cog"></i> Manage</a> </td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% set active_page = "directory" %}
|
{% set active_page = "directory" %}
|
||||||
|
|
||||||
{% block title %}An excellent title{% endblock title %}
|
{% block title %}{{ directory.name }}{% endblock title %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
@ -63,40 +63,40 @@
|
|||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|
||||||
<div class="card-header">Summary</div>
|
<div class="card-header">Sommaire</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<table class="info-table">
|
<table class="info-table">
|
||||||
<tr onclick="modifyDisplayName()">
|
<tr onclick="modifyDisplayName()">
|
||||||
<th style="width: 20%">Display name</th>
|
<th style="width: 20%">Nom</th>
|
||||||
<td>
|
<td>
|
||||||
<pre id="display-name" title="Click to update">{{ directory.name }}</pre>
|
<pre id="display-name" title="Cliquer pour mettre à jour">{{ directory.name }}</pre>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr onclick="modifyPath()">
|
<tr onclick="modifyPath()">
|
||||||
<th style="width: 20%">Path</th>Task
|
<th style="width: 20%">Chemin</th>
|
||||||
<td>
|
<td>
|
||||||
<pre id="path" title="Click to update">{{ directory.path }}</pre>
|
<pre id="path" title="Cliquer pour mettre à jour">{{ directory.path }}</pre>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 20%">Enabled</th>
|
<th style="width: 20%">Activé</th>
|
||||||
<td>
|
<td>
|
||||||
<form action="/directory/{{ directory.id }}/update" style="display: inline;margin-left: 6px;">
|
<form action="/directory/{{ directory.id }}/update" style="display: inline;margin-left: 6px;">
|
||||||
<input type="hidden" name="enabled" value="{{ "0" if directory.enabled else "1" }}">
|
<input type="hidden" name="enabled" value="{{ "0" if directory.enabled else "1" }}">
|
||||||
<button class="btn btn-sm {{ "btn-danger" if directory.enabled else "btn-success" }}">
|
<button class="btn btn-sm {{ "btn-danger" if directory.enabled else "btn-success" }}">
|
||||||
<i class="far {{ "fa-check-square" if directory.enabled else "fa-square" }}"></i>
|
<i class="far {{ "fa-check-square" if directory.enabled else "fa-square" }}"></i>
|
||||||
{{ "Disable" if directory.enabled else "Enable" }}
|
{{ "Désactiver" if directory.enabled else "Activer" }}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Thumbnail cache size</th>
|
<th>Taille des miniatures</th>
|
||||||
<td><pre>{{ tn_size_formatted }} ({{ tn_size }} bytes)</pre></td>
|
<td><pre>{{ tn_size_formatted }} ({{ tn_size }} octets)</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -112,16 +112,16 @@
|
|||||||
<form action="/task/add" class="p-2">
|
<form action="/task/add" class="p-2">
|
||||||
<input type="hidden" value="1" name="type">
|
<input type="hidden" value="1" name="type">
|
||||||
<input type="hidden" value="{{ directory.id }}" name="directory">
|
<input type="hidden" value="{{ directory.id }}" name="directory">
|
||||||
<button class="btn btn-primary" href="/task/" value="Generate thumbnails">
|
<button class="btn btn-primary" href="/task/">
|
||||||
<i class="fas fa-book"></i> Generate index
|
<i class="fas fa-book"></i> Générer l'index
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="/task/add" class="p-2">
|
<form action="/task/add" class="p-2">
|
||||||
<input type="hidden" value="2" name="type">
|
<input type="hidden" value="2" name="type">
|
||||||
<input type="hidden" value="{{ directory.id }}" name="directory">
|
<input type="hidden" value="{{ directory.id }}" name="directory">
|
||||||
<button class="btn btn-primary" href="/task/" value="Generate thumbnails">
|
<button class="btn btn-primary" href="/task/">
|
||||||
<i class="far fa-images"></i> Generate thumbnails
|
<i class="far fa-images"></i> Générer les miniatures
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@ -129,8 +129,8 @@
|
|||||||
<button class="btn dropdown-toggle btn-danger" data-toggle="dropdown">Action</button>
|
<button class="btn dropdown-toggle btn-danger" data-toggle="dropdown">Action</button>
|
||||||
|
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="/directory/{{ directory.id }}/del">Delete directory</a>
|
<a class="dropdown-item" href="/directory/{{ directory.id }}/del">Supprimer le dossier</a>
|
||||||
<a class="dropdown-item" href="/directory/{{ directory.id }}/reset">Reset to default settings</a>
|
<a class="dropdown-item" href="/directory/{{ directory.id }}/reset">Réinitialiser aux paramètres par défaut</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -140,13 +140,13 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Options <a href="#" style="float:right">Learn more <i class="fas fa-external-link-alt"></i></a></div>
|
<div class="card-header">Options <a href="#" style="float:right">En savoir plus <i class="fas fa-external-link-alt"></i></a></div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<table class="info-table table-striped table-hover">
|
<table class="info-table table-striped table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Option</th>
|
<th>Option</th>
|
||||||
<th>Value</th>
|
<th>Valeur</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -154,7 +154,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 30%"><span>{{ option.key }}</span></td>
|
<td style="width: 30%"><span>{{ option.key }}</span></td>
|
||||||
<td onclick="modifyVal({{ option.id }}, '{{ option.key }}')" title="Click to update"><pre id="val-{{ option.id }}">{{ option.value }}</pre></td>
|
<td onclick="modifyVal({{ option.id }}, '{{ option.key }}')" title="Cliquer pour modifier"><pre id="val-{{ option.id }}">{{ option.value }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="card-header">{{ doc.name }}</div>
|
<div class="card-header">{{ doc.name }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h3>Document properties</h3>
|
<h3>Propriétés du document</h3>
|
||||||
|
|
||||||
<table class="info-table table-hover table-striped">
|
<table class="info-table table-hover table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -26,21 +26,21 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3>Raw json</h3>
|
<h3>JSON</h3>
|
||||||
<textarea class="form-control" style="min-height: 100px" readonly>{{ doc | tojson }}</textarea>
|
<textarea class="form-control" style="min-height: 100px" readonly>{{ doc | tojson }}</textarea>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<h3><a href="/directory/{{ directory.id }}">Directory</a></h3>
|
<h3><a href="/directory/{{ directory.id }}">Dossier</a></h3>
|
||||||
<table class="info-table table-hover table-striped">
|
<table class="info-table table-hover table-striped">
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>Path</th>
|
<th>Chemin</th>
|
||||||
<td><pre>{{ directory.path }}</pre></td>
|
<td><pre>{{ directory.path }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Nom</th>
|
||||||
<td><pre>{{ directory.name }}</pre></td>
|
<td><pre>{{ directory.name }}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav class="navbar navbar-expand-lg navbar-light" style="background: #F7F7F7; border-bottom: solid 1px #dfdfdf;">
|
<nav class="navbar navbar-expand-lg navbar-light" style="background: #F7F7F7; border-bottom: solid 1px #dfdfdf;">
|
||||||
<a class="navbar-brand" href="/"><i class="fa fa-search"></i> Search</a>
|
<a class="navbar-brand" href="/"><i class="fa fa-search"></i> Recherche</a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
@ -60,30 +60,30 @@
|
|||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if "directory" == active_page %}active{% endif %}" href="/directory">Directories</a>
|
<a class="nav-link {% if "directory" == active_page %}active{% endif %}" href="/directory">Dossiers</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if "task" == active_page %}active{% endif %}" href="/task">Tasks</a>
|
<a class="nav-link {% if "task" == active_page %}active{% endif %}" href="/task">Tâches</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if "user" == active_page %}active{% endif %}" href="/user">Users</a>
|
<a class="nav-link {% if "user" == active_page %}active{% endif %}" href="/user">Utilisateurs</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link {% if "dashboard" == active_page %}active{% endif %}" href="/dashboard">Dashboard</a>
|
<a class="nav-link {% if "dashboard" == active_page %}active{% endif %}" href="/dashboard">Panneau de contrôle</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% if session["username"] %}
|
{% if session["username"] %}
|
||||||
<span>
|
<span>
|
||||||
Logged in as <i>{{ session["username"] }}</i>
|
Connecté en tant que <i>{{ session["username"] }}</i>
|
||||||
{% if session["admin"] %}(Admin){% endif %}
|
{% if session["admin"] %}(Administrateur){% endif %}
|
||||||
</span>
|
</span>
|
||||||
<a href="/logout" class="btn btn-outline-warning" style="margin-left: 8px">Logout</a>
|
<a href="/logout" class="btn btn-outline-warning" style="margin-left: 8px">Déconnexion</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<form class="form-inline my-2 my-lg-0" method="POST" action="/login">
|
<form class="form-inline my-2 my-lg-0" method="POST" action="/login">
|
||||||
<input class="form-control mr-sm-2" placeholder="Username" name="username">
|
<input class="form-control mr-sm-2" placeholder="Nom d'utilisateur" name="username">
|
||||||
<input class="form-control mr-sm-2" type="password" placeholder="Password" name="password">
|
<input class="form-control mr-sm-2" type="password" placeholder="Mot de pass" name="password">
|
||||||
<button class="btn btn-outline-success my-2 my-sm-0">Login</button>
|
<button class="btn btn-outline-success my-2 my-sm-0">Connexion</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@ -97,7 +97,7 @@
|
|||||||
<div class="container" style="margin-top: 1em">
|
<div class="container" style="margin-top: 1em">
|
||||||
{% for category, message in messages %}
|
{% for category, message in messages %}
|
||||||
<div class="alert alert-{{ category }}">
|
<div class="alert alert-{{ category }}">
|
||||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
<a href="#" class="close" data-dismiss="alert" aria-label="fermer">×</a>
|
||||||
{{ message | safe }}
|
{{ message | safe }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Title</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.fit:hover {
|
|
||||||
-webkit-transform:scale(2.5);
|
|
||||||
-moz-transform:scale(2.5);
|
|
||||||
-ms-transform:scale(2.5);
|
|
||||||
-o-transform:scale(2.5);
|
|
||||||
transform:scale(2.5);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.fit {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.image-container{
|
|
||||||
width: 305px;
|
|
||||||
height: 300px;
|
|
||||||
background-color: #ccc;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.doc-container {
|
|
||||||
height: 330px;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.doc-caption {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="photos">
|
|
||||||
|
|
||||||
{% for doc in docs %}
|
|
||||||
{% if doc.type == "audio" %}
|
|
||||||
<div class="image-container">
|
|
||||||
<audio controls class="fit">
|
|
||||||
<!--<source src="files/{{doc.doc_id}}">-->
|
|
||||||
</audio>
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<a href="/files/{{doc.doc_id}}">
|
|
||||||
<div class="doc-container">
|
|
||||||
<div class="image-container">
|
|
||||||
<img class="fit" src="/thumbs/{{doc.doc_id}}">
|
|
||||||
</div>
|
|
||||||
<span class="doc-caption" style="font-size: 8pt">{{doc.name}}</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
{% set active_page = "search" %}
|
{% set active_page = "search" %}
|
||||||
|
|
||||||
{% block title %}Search{% endblock title %}
|
{% block title %}Recherche{% endblock title %}
|
||||||
|
|
||||||
{% block imports %}
|
{% block imports %}
|
||||||
<link href="/static/css/search.css" rel="stylesheet" type="text/css">
|
<link href="/static/css/search.css" rel="stylesheet" type="text/css">
|
||||||
@ -14,36 +14,38 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input id="pathBar" type="search" class="form-control" placeholder="Filter path">
|
<input id="pathBar" type="search" class="form-control" placeholder="Filtrer le chemin">
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<span onclick="document.getElementById('barToggle').click()">Must match </span>
|
<span onclick="document.getElementById('barToggle').click()">Doit être égal </span>
|
||||||
<input title="Toggle between 'Should' and 'Must' match mode" type="checkbox" id="barToggle" onclick="toggleSearchBar()" checked>
|
<input title="Basculer entre 'Devrait' and 'doit' être égal" type="checkbox" id="barToggle" onclick="toggleSearchBar()" checked>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input id="searchBar" type="search" class="form-control" placeholder="Search">
|
<input id="searchBar" type="search" class="form-control" placeholder="Recherche">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input title="File size" id="sizeSlider" name="size">
|
<input title="Taille des fichiers" id="sizeSlider" name="size">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label for="directories" >Search in directories</label>
|
<label for="directories" >Rechercher dans les dossiers</label>
|
||||||
|
|
||||||
<select class="custom-select" id="directories" multiple size="6">
|
<select class="custom-select" id="directories" multiple size="6">
|
||||||
{% for dir_id in directories %}
|
{% if directories | length > 0%}
|
||||||
{% if directories[dir_id].enabled %}
|
{% for dir in directories %}
|
||||||
<option selected value="{{ directories[dir_id].id }}">{{ directories[dir_id].name }}</option>
|
<option selected value="{{ dir.id }}">{{ dir.name }}</option>
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% else %}
|
||||||
|
<option disabled>Il n'existe aucun dossier actif auquel vous avez accès</option>
|
||||||
|
{% endif %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label>Mime types</label>
|
<label>Types de fichier</label>
|
||||||
|
|
||||||
<div class="tree"></div>
|
<div class="tree"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% set active_page = "task" %}
|
{% set active_page = "task" %}
|
||||||
|
|
||||||
{% block title %}An excellent title{% endblock title %}
|
{% block title %}Tâches{% endblock title %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
@ -43,23 +43,23 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Add task</div>
|
<div class="card-header">Ajouter un tâche</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="form-inline" action="/task/add">
|
<form class="form-inline" action="/task/add">
|
||||||
<select title="Select task type" class="form-control" id="type" name="type">
|
<select title="Sélectionner le type de tâche" class="form-control" id="type" name="type">
|
||||||
<option hidden>Create task...</option>
|
<option hidden>Créer un tâche...</option>
|
||||||
<option value="1">Indexing</option>
|
<option value="1">d'indexation</option>
|
||||||
<option value="2">Thumbnail Generation</option>
|
<option value="2">de génération des miniatures</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select title="Select directory" class="form-control" id="directory" name="directory" >
|
<select title="Sélectionner le dossier" class="form-control" id="directory" name="directory" >
|
||||||
<option hidden>For directory...</option>
|
<option hidden>Pour le dossier...</option>
|
||||||
{% for dir_id in directories %}
|
{% for dir_id in directories %}
|
||||||
<option value="{{ dir_id }}">{{ directories[dir_id].name }}</option>
|
<option value="{{ dir_id }}">{{ directories[dir_id].name }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button class="form-control btn btn-success"><i class="fas fa-plus"></i> Add</button>
|
<button class="form-control btn btn-success"><i class="fas fa-plus"></i> Ajouter</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
if (currentTask.total === 0) {
|
if (currentTask.total === 0) {
|
||||||
|
|
||||||
document.getElementById("task-label-" + currentTask.id).innerHTML = "Calculating file count...";
|
document.getElementById("task-label-" + currentTask.id).innerHTML = "Calcul du nombre de fichier...";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let bar = document.getElementById("task-bar-" + currentTask.id);
|
let bar = document.getElementById("task-bar-" + currentTask.id);
|
||||||
@ -107,16 +107,16 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Ongoing tasks</div>
|
<div class="card-header">Tâches en cours</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% for task_id in tasks | sort() %}
|
{% for task_id in tasks | sort() %}
|
||||||
<div class="task-wrapper container-fluid">
|
<div class="task-wrapper container-fluid">
|
||||||
<a class="task-name" href="/directory/{{ tasks[task_id].dir_id }}">{{ directories[tasks[task_id].dir_id].name }}</a>
|
<a class="task-name" href="/directory/{{ tasks[task_id].dir_id }}">{{ directories[tasks[task_id].dir_id].name }}</a>
|
||||||
<span class="task-info"> -
|
<span class="task-info"> -
|
||||||
{% if tasks[task_id].type == 1 %}
|
{% if tasks[task_id].type == 1 %}
|
||||||
Indexing
|
Indexation
|
||||||
{% else %}
|
{% else %}
|
||||||
Thumbnail generation
|
Génération des miniatures
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@ -124,12 +124,12 @@
|
|||||||
<div class="container-fluid p-2">
|
<div class="container-fluid p-2">
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div id="task-bar-{{ task_id }}" class="progress-bar" role="progressbar" style="width: 0;">
|
<div id="task-bar-{{ task_id }}" class="progress-bar" role="progressbar" style="width: 0;">
|
||||||
<span id="task-label-{{ task_id }}">Queued</span>
|
<span id="task-label-{{ task_id }}">En attente</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-2"><a class="btn btn-danger" href="/task/{{ task_id }}/del">Cancel</a></div>
|
<div class="p-2"><a class="btn btn-danger" href="/task/{{ task_id }}/del">Annuler</a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
|
|
||||||
{% set active_page = "user" %}
|
{% set active_page = "user" %}
|
||||||
|
{% block title %}Liste des utilisateurs{% endblock title %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container"> <div class="card">
|
||||||
<div class="card">
|
<div class="card-header">Créer un utilisateur</div>
|
||||||
<div class="card-header">Create user</div>
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
{% if not admin_account_present %}
|
{% if not admin_account_present %}
|
||||||
<p>This page is unlocked because there are no admin accounts</p>
|
<p>Cette page est débloquée parce qu'il n'y a aucun compte administrateur</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form method="POST" action="/user/add">
|
<form method="POST" action="/user/add">
|
||||||
@ -18,39 +18,37 @@
|
|||||||
<div class="input-group form-group">
|
<div class="input-group form-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<label for="is_admin" style="margin: 0 8px 0 0">Set admin</label>
|
<label for="is_admin" style="margin: 0 8px 0 0">Administrateur</label>
|
||||||
<input title="Set user as admin" type="checkbox" id="is_admin" name="is_admin">
|
<input title="administrateur" type="checkbox" id="is_admin" name="is_admin">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control" placeholder="Username" name="username">
|
<input type="text" class="form-control" placeholder="Nom d'utilisateur" name="username">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="password" class="form-control" placeholder="Password" name="password">
|
<input type="password" class="form-control" placeholder="Mot de passe" name="password">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Add User</button>
|
<button type="submit" class="btn btn-success"><i class="fas fa-plus"></i> Créer un utilissateur</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Users</div>
|
<div class="card-header">Utilisateurs</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<table class="info-table table-hover table-striped">
|
<table class="info-table table-hover table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User</th>
|
<th>Utilisateur</th>
|
||||||
<th>Admin</th>
|
<th>Administrateur</th>
|
||||||
<th>Actions</th>
|
<th>Actions</th>
|
||||||
</tr>
|
</tr> </thead>
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for user in users %}
|
{% for user in users %} <tr>
|
||||||
<tr>
|
|
||||||
<td style="width: 80%;">{% if session["username"] == user %}<b>{{ user }}{% else %}{{ user }}{% endif %}</b></td>
|
<td style="width: 80%;">{% if session["username"] == user %}<b>{{ user }}{% else %}{{ user }}{% endif %}</b></td>
|
||||||
<td><i class="far {{ "fa-check-square" if users[user].admin else "fa-square" }}"></i></td>
|
<td><i class="far {{ "fa-check-square" if users[user].admin else "fa-square" }}"></i></td>
|
||||||
<td><a href="/user/{{ user }}" class="btn btn-primary">Manage</a></td>
|
<td><a href="/user/{{ user }}" class="btn btn-primary">Gérer</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -1,19 +1,72 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
|
|
||||||
{% set active_page = "user" %}
|
{% set active_page = "user" %}
|
||||||
|
{% block title %}Gestion utilisateur{% endblock title %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header">Manage permission of <strong>{{ session["username"] }}</strong></div>
|
<div class="card-header">Gérer les permission de <strong>{{ user.username }}</strong></div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<h5>Administrateur: </h5>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<form action="/user/{{ user.username }}/set_admin" style="display: inline;margin-left: 6px;">
|
||||||
|
<input type="hidden" name="admin" value="{{ "0" if user.admin else "1" }}">
|
||||||
|
<button class="btn btn-sm {{ "btn-danger" if user.admin else "btn-success" }}">
|
||||||
|
<i class="far {{ "fa-check-square" if user.admin else "fa-square" }}"></i>
|
||||||
|
{{ "Rétrograder" if user.admin else "Faire administrateur" }}
|
||||||
|
</button>
|
||||||
|
<input type="hidden" name="dir_id" value="{{ dir_id }}">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<table class="info-table table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Dossier</th>
|
||||||
|
<th>Accès</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for dir_id in directories %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ directories[dir_id].name }}</td>
|
||||||
|
<td><form action="/user/{{ user.username }}/set_access" style="display: inline;margin-left: 6px;">
|
||||||
|
<input type="hidden" name="access" value="{{ "0" if dir_id in user.readable_directories else "1" }}">
|
||||||
|
<button class="btn btn-sm {{ "btn-danger" if dir_id in user.readable_directories else "btn-success" }}">
|
||||||
|
<i class="far {{ "fa-check-square" if dir_id in user.readable_directories else "fa-square" }}"></i>
|
||||||
|
{{ "Désactiver" if dir_id in user.readable_directories else "Activer" }}
|
||||||
|
</button>
|
||||||
|
<input type="hidden" name="dir_id" value="{{ dir_id }}">
|
||||||
|
</form></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<button class="btn btn-danger" onclick="userDelete()">Supprimer le compte</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function userDelete() {
|
||||||
|
if (confirm("Êtes vous certain de vouloir supprimer ce compte?")) {
|
||||||
|
window.location = "/user/{{ user.username }}/del"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock body %}
|
{% endblock body %}
|
Loading…
x
Reference in New Issue
Block a user