Browse Source

[enh] Add question for specific isp data

zamentur 8 years ago
parent
commit
8562f23343
4 changed files with 134 additions and 19 deletions
  1. 14 3
      conf/local.py
  2. 80 10
      manifest.json
  3. 39 5
      scripts/install
  4. 1 1
      sources

+ 14 - 3
conf/local.py

@@ -1,11 +1,22 @@
 # -*- coding: utf-8 -*-
 # -*- coding: utf-8 -*-
 DEBUG=True
 DEBUG=True
 
 
-ISP_NAME='YNH_APP_ARG_ISP_NAME'
-ISP_LATITUDE='YNH_APP_ARG_LATITUDE'
-ISP_LONGITUDE='YNH_APP_ARG_LONGITUDE'
 URL_PREFIX='YNH_APP_PREFIX/'
 URL_PREFIX='YNH_APP_PREFIX/'
 NOTIFICATION_EMAILS=['YNH_APP_ARG_EMAIL']
 NOTIFICATION_EMAILS=['YNH_APP_ARG_EMAIL']
 DEFAULT_FROM_EMAIL='notifier@YNH_APP_ARG_DOMAIN'
 DEFAULT_FROM_EMAIL='notifier@YNH_APP_ARG_DOMAIN'
 SITE_URL="https://YNH_APP_ARG_DOMAINYNH_APP_ARG_PATH"
 SITE_URL="https://YNH_APP_ARG_DOMAINYNH_APP_ARG_PATH"
 SECRET_KEY = 'YNH_APP_SECRET_KEY'
 SECRET_KEY = 'YNH_APP_SECRET_KEY'
+ISP={
+    'NAME':'YNH_APP_ARG_ISP_NAME',
+    'SITE':'YNH_APP_ARG_ISP_SITE',
+    'EMAIL':'YNH_APP_ARG_EMAIL',
+    'ZONE':'YNH_APP_ARG_ISP_ZONE',
+    'URL_CONTACT':'YNH_APP_ARG_URL_CONATCT',
+    'LATITUDE':YNH_APP_ARG_LATITUDE,
+    'LONGITUDE':YNH_APP_ARG_LONGITUDE,
+    'ZOOM':YNH_APP_ARG_ZOOM,
+    'CNIL':{
+        'LINK':'YNH_APP_ARG_CNIL_LINK',
+        'NUMBER':YNH_APP_ARG_CNIL_NUMBER
+    }
+}

+ 80 - 10
manifest.json

@@ -24,8 +24,7 @@
                 "type": "domain",
                 "type": "domain",
                 "ask": {
                 "ask": {
                     "en": "Choose a domain for Wifi With Me",
                     "en": "Choose a domain for Wifi With Me",
-                    "fr": "Choisissez un nom de domaine pour Wifi With Me",
-                    "de": "Wählen Sie bitte einen Domain für Wifi With Me"
+                    "fr": "Choisissez un nom de domaine pour Wifi With Me"
                 },
                 },
                 "example": "domain.org"
                 "example": "domain.org"
             },
             },
@@ -34,8 +33,7 @@
                 "type": "path",
                 "type": "path",
                 "ask": {
                 "ask": {
                     "en": "Choose a path for Wifi With Me",
                     "en": "Choose a path for Wifi With Me",
-                    "fr": "Choisissez l'adresse pour Wifi With Me",
-                    "de": "Tragen Sie bitte den Pfad für Wifi With Me ein"
+                    "fr": "Choisissez l'adresse pour Wifi With Me"
                 },
                 },
                 "example": "/wifi-with-me",
                 "example": "/wifi-with-me",
                 "default": "/wifi-with-me"
                 "default": "/wifi-with-me"
@@ -45,8 +43,7 @@
                 "type": "user",
                 "type": "user",
                 "ask": {
                 "ask": {
                     "en": "Choose the Wifi With Me administrator (must be an existing YunoHost user)",
                     "en": "Choose the Wifi With Me administrator (must be an existing YunoHost user)",
-                    "fr": "Choisissez l'administrateur de Wifi With Me (doit être un utilisateur YunoHost)",
-                    "de": "Wählen Sie bitte den WifiWithMeadministrator (muss ein vorhandener YunoHost Nutzer sein)"
+                    "fr": "Choisissez l'administrateur de Wifi With Me (doit être un utilisateur YunoHost)"
                 },
                 },
                 "example": "johndoe"
                 "example": "johndoe"
             },
             },
@@ -55,13 +52,86 @@
                 "type": "email",
                 "type": "email",
                 "ask": {
                 "ask": {
                     "en": "Choose email were send notification",
                     "en": "Choose email were send notification",
-                    "fr": "Choisissez l'email vers lequel envoyer les notifications",
-                    "de": "Wählen Sie bitte den email"
+                    "fr": "Choisissez l'email vers lequel envoyer les notifications"
                 },
                 },
                 "example": "admin@example.tld"
                 "example": "admin@example.tld"
+            },
+            {
+                "name": "isp_name",
+                "ask": {
+                    "en": "Enter your ISP name",
+                    "fr": "Indiquez le nom de votre FAI"
+                },
+                "example": "My ISP"
+            },
+            {
+                "name": "isp_site",
+                "ask": {
+                    "en": "Enter the address of your ISP website",
+                    "fr": "Saisissez l'adresse du siteweb de votre FAI"
+                },
+                "example": "//www.exemple.tld"
+            },
+            {
+                "name": "url_contact",
+                "ask": {
+                    "en": "Enter the address of your contact page",
+                    "fr": "Saisissez l'adresse de votre page de contact"
+                },
+                "example": "//www.exemple.tld/contact"
+            },
+            {
+                "name": "isp_zone",
+                "ask": {
+                    "en": "Choose the zone inside of which you want create your wireless network",
+                    "fr": "Choisissez la zone dans laquelle vous envisagez votre réseau sans fil"
+                },
+                "example": "Paris et environ"
+            },
+            {
+                "name": "latitude",
+                "ask": {
+                    "en": "Enter the default latitude",
+                    "fr": "Saisissez une latitude par défault"
+                },
+                "example": "47.218371"
+            },
+            {
+                "name": "longitude",
+                "ask": {
+                    "en": "Enter the default longitude",
+                    "fr": "Saisissez une longitude par défault"
+                },
+                "example": "-1.553621"
+            },
+            {
+                "name": "zoom",
+                "ask": {
+                    "en": "Choose the default zoom level",
+                    "fr": "Choisissez un niveau de zoom par défault "
+                },
+                "choices":["13","12","11","10","9","8","7","6","5","4","3","2","1"],
+                "example": "13",
+                "default": "13"
+            },
+            {
+                "name": "cnil_link",
+                "ask": {
+                    "en": "Enter the url of your CNIL declaration",
+                    "fr": "Saisissez l'adresse de votre déclaration CNIL"
+                },
+                "example": "//www.exemple.tld/files/cnil-1819000-withwithme.pdf",
+                "default": ""
+            },
+            {
+                "name": "cnil_number",
+                "ask": {
+                    "en": "Enter the number of your CNIL declaration",
+                    "fr": "Saisissez votre numéro CNIL"
+                },
+                "example": "18190003",
+                "default": ""
             }
             }
-
-
         ]
         ]
     }
     }
 }
 }

+ 39 - 5
scripts/install

@@ -10,6 +10,18 @@ path=$YNH_APP_ARG_PATH
 admin=$YNH_APP_ARG_ADMIN
 admin=$YNH_APP_ARG_ADMIN
 email=$YNH_APP_ARG_EMAIL
 email=$YNH_APP_ARG_EMAIL
 
 
+
+isp_name=$YNH_APP_ARG_ISP_NAME
+isp_site=$YNH_APP_ARG_ISP_SITE
+isp_zone=$YNH_APP_ARG_ISP_ZONE
+latitude=$YNH_APP_ARG_LATITUDE
+longitude=$YNH_APP_ARG_LONGITUDE
+zoom=$YNH_APP_ARG_ZOOM
+cnil_link=$YNH_APP_ARG_CNIL_LINK
+cnil_number=$YNH_APP_ARG_CNIL_NUMBER
+url_contact=$YNH_APP_ARG_URL_CONTACT
+secret=$(ynh_string_random 120)
+
 # Source YunoHost helpers
 # Source YunoHost helpers
 . /usr/share/yunohost/helpers
 . /usr/share/yunohost/helpers
 
 
@@ -20,6 +32,17 @@ ynh_user_exists $admin \
 ynh_app_setting_set "$app" admin "$admin"
 ynh_app_setting_set "$app" admin "$admin"
 ynh_app_setting_set "$app" email "$email"
 ynh_app_setting_set "$app" email "$email"
 
 
+ynh_app_setting_set "$app" isp_name "$isp_name"
+ynh_app_setting_set "$app" isp_site "$isp_site"
+ynh_app_setting_set "$app" isp_zone "$isp_zone"
+ynh_app_setting_set "$app" latitude "$latitude"
+ynh_app_setting_set "$app" longitude "$longitude"
+ynh_app_setting_set "$app" zoom "$zoom"
+ynh_app_setting_set "$app" cnil_link "$cnil_link"
+ynh_app_setting_set "$app" cnil_number "$cnil_number"
+ynh_app_setting_set "$app" url_contact "$url_contact"
+ynh_app_setting_set "$app" secret "$secret"
+
 # Check domain/path availability
 # Check domain/path availability
 sudo yunohost app checkurl "${domain}${path}" -a "$app" \
 sudo yunohost app checkurl "${domain}${path}" -a "$app" \
     || ynh_die "Path not available: ${domain}${path}"
     || ynh_die "Path not available: ${domain}${path}"
@@ -79,11 +102,16 @@ sed -i "s@YNH_APP_ARG_DOMAIN@$domain@g" ../conf/local.py
 sed -i "s@YNH_APP_ARG_PATH@$path@g" ../conf/local.py
 sed -i "s@YNH_APP_ARG_PATH@$path@g" ../conf/local.py
 sed -i "s@YNH_APP_PREFIX@${path#"/"}@g" ../conf/local.py
 sed -i "s@YNH_APP_PREFIX@${path#"/"}@g" ../conf/local.py
 sed -i "s#YNH_APP_ARG_EMAIL#$email#g" ../conf/local.py
 sed -i "s#YNH_APP_ARG_EMAIL#$email#g" ../conf/local.py
-sed -i "s#YNH_APP_SECRET_KEY#ssss#g" ../conf/local.py #TODO
-sed -i "s#YNH_APP_ARG_ISP_NAME#ARN#g" ../conf/local.py #TODO
-sed -i "s#YNH_APP_ARG_ISP_LATITUDE#47.218371#g" ../conf/local.py #TODO
-sed -i "s#YNH_APP_ARG_ISP_LONGITUDE#-1.553621#g" ../conf/local.py #TODO
-sed -i "s#YNH_APP_ARG_ISP_ZOOM#13#g" ../conf/local.py #TODO
+sed -i "s#YNH_APP_SECRET_KEY#$secret#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_ISP_NAME#$isp_name#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_ISP_SITE#$isp_site#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_ISP_ZONE#$isp_zone#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_LATITUDE#$latitude#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_LONGITUDE#$longitude#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_ZOOM#$zoom#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_CNIL_LINK#$cnil_link#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_CNIL_NUMBER#$cnil_number#g" ../conf/local.py
+sed -i "s#YNH_APP_ARG_URL_CONTACT#$url_contact#g" ../conf/local.py
 sudo cp ../conf/local.py $final_path/wifiwithme/settings/local.py
 sudo cp ../conf/local.py $final_path/wifiwithme/settings/local.py
 
 
 # Set production
 # Set production
@@ -95,6 +123,12 @@ sudo ln -s $final_path/wifiwithme/static $final_path/static
 sudo useradd $app -d $final_path || echo "User already exists"
 sudo useradd $app -d $final_path || echo "User already exists"
 sudo chown -R $app:www-data $final_path
 sudo chown -R $app:www-data $final_path
 
 
+
+# Log folder
+sudo mkdir -p /var/log/$app
+sudo chown -R $app /var/log/$app
+sudo chgrp -R www-data /var/log/$app
+
 # Reload Nginx and regenerate SSOwat conf
 # Reload Nginx and regenerate SSOwat conf
 sudo yunohost app addaccess $app -u $admin
 sudo yunohost app addaccess $app -u $admin
 
 

+ 1 - 1
sources

@@ -1 +1 @@
-Subproject commit 140d10b6e11c586bfdc87aab9a2a7c95053eaa05
+Subproject commit 40d4acb0c4ee9a785273775d4059ce1fc4b542ee