diff --git a/README.md b/README.md
index b9d743a..5d66324 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,36 @@
-# Jeu de belote
+# SFS - Simple file system
-Simple file server to be used easily with curl.
+Simple file server (web-based) to be used easily with curl. Written in python with framework flask. By default it used a simple SQLite database, but this can be adapted to your needs by editing config files.
-L'ensemble de ce dépôt est sous licence GPL v3.
+Scripts to use with bash and curl are available in the scripts folder. You can set your default server, username and password in the header of the script.
+
+This repository is licensed under GPL v3.
## Installation
- 1. Créer un environnement virtuel `venv` (`python3 -m venv venv`)
- 2. Activer l'environnement virtuel (`. venv/bin/activate`)
- 3. Installer les prérequis (`pip install -r requirements.txt`)
- 4. Vous pouvez démarrer le serveur `python fs.py` !
+ 1. Create a virtual environment `venv` (`python3 -m venv venv`)
+ 2. Activate (`. venv/bin/activate`)
+ 3. Install prerequisite python packages (`pip install -r requirements.txt`)
+ 4. You will have to create a folder to store uploaded files (default is `./data`)
+ 5. Copy files `settings.example.cfg` and `settings.example.py` to `settings.cfg` and `settings.py` and adjust parameters
+ 6. You can start the test server with `python fs.py`
+## Configuration an deployment
+
+For deployment, see [Flask documentation](https://flask.palletsprojects.com/en/1.1.x/deploying/).
+
+Configuration of uploading server and limitation of file size, as well as listening url for web server is configured in `settings.py`. Configuration of database is done in `settings.cfg` (use of SQLAlchemy, see corresponding documentation for advanced parameterizations).
## Principe
- * `fs.py` définit les routes
- * `db.py` gère le jeu et l'enregistrement en base de donnée
- * Le dossier `templates` contient les template jinja2 pour le rendu web
- * Le dossier `static` contient les scripts, images et feuilles de style
+ * `fs.py` is the core file
+ * `db.py` defines the database structure
+ * `templates` folder contains all web views to be rendered with Jinja2
+ * `static` folder contains scripts, css and images
-Si aucun utilisateur n'existe dans la base de donnée, un premier utilisateur
-de login `admin` et de mot de passe `admin` est créé.
-A vous de changer le mot de passe avant mise en ligne !
+If at running time, there is no user in database, a first user is created with admin
+rights. The login is `admin` and password is `admin`. You have to change it before
+deployment, of course !
## Licence
diff --git a/fs.py b/fs.py
index 2124c0a..4a8c15d 100644
--- a/fs.py
+++ b/fs.py
@@ -143,7 +143,7 @@ def uploaderpage():
graphical = True
else:
graphical = False
- if 'visible' in flask.request.form and flask.request.form['visible']:
+ if 'visible' in flask.request.form and '1' in flask.request.form['visible']:
visible = True
else:
visible = False
@@ -154,6 +154,7 @@ def uploaderpage():
# Check auth first
if user is None:
+ print(flask.request.form)
if 'username' not in flask.request.form or 'password' not in flask.request.form:
return returnuploader(graphical, 'ERR: You have to provide creedentials or log in', None)
username = flask.request.form['username']
@@ -172,7 +173,7 @@ def uploaderpage():
ldesc = flask.request.form.getlist('desc[]')
done = 0
- ret="OK"
+ ret="OK\n"
for i in range(len(lfiles)):
# if user does not select file, browser also
# submit an empty part without filename
@@ -204,7 +205,7 @@ def uploaderpage():
if not os.path.isdir(os.path.dirname(path)):
os.mkdir(os.path.dirname(path))
f.save(path)
- ret += "\n/d/{}/{}".format(user.login, name1)
+ ret += "/d/{}/{}\n".format(user.login, name1)
except IOError as err:
return returnuploader(graphical, 'ERR: Something went wrong when trying to write file to disk', user)
diff --git a/templates/up.html b/templates/up.html
index 04cb4a9..43f89d1 100644
--- a/templates/up.html
+++ b/templates/up.html
@@ -38,7 +38,7 @@
Publicly visible: | + | Publicly visible: | |
Set a password: | + | ` addElement('filelist', 'tr', 'line' + maxline, html); } |