Commit c26b8d09 authored by rgaudin's avatar rgaudin
Browse files

Updated JSON export/import format for WiFI : now using a single `wifi_password` entry

parent 84999451
2.0-rc13
* Updated Wikifundi language packs (2018-10-02)
* Updated Wikifundi language packs (2018-10-24)
* Fixed latex in WikiFundi
* Added Proxy Configuration Support
* Removed StaticSites catalog as it is no longer available online
* Changed JSON format for WiFi: single `wifi_password` entry
2.0-rc12
* macOS binary name (Kiwix Hotspot instead of kiwix-hotspot)
......
......@@ -71,10 +71,13 @@ def set_config(config, args):
else:
setif(key, os.path.abspath(fpath))
# wifi
# wifi (previous format)
if "wifi" in config and isinstance(config["wifi"], dict):
if "password" in config["wifi"] and config["wifi"].get("protected", True):
setif("wifi_pwd", config["wifi"]["password"])
# wifi (new format)
if "wifi_password" in config:
setif("wifi_pwd", config["wifi_password"])
# admin account
if "admin_account" in config and isinstance(config["admin_account"], dict):
......
......@@ -638,7 +638,7 @@ class Application:
""" restore UI to its initial (non-configured) state """
# name
self.component.project_name_entry.set_text("Kiwix Hotspot")
self.component.project_name_entry.set_text("Kiwix")
# language
index = -1
......@@ -1282,7 +1282,7 @@ class Application:
else:
self.component.timezone_combobox.set_active(item_id)
# wifi
# wifi (previous format)
if "wifi" in config and isinstance(config["wifi"], dict):
if "protected" in config["wifi"]:
self.component.wifi_password_switch.set_active(
......@@ -1290,6 +1290,13 @@ class Application:
)
if "password" in config["wifi"]:
self.component.wifi_password_entry.set_text(config["wifi"]["password"])
# wifi (new format)
if "wifi_password" in config:
self.component.wifi_password_switch.set_active(
config["wifi_password"] is None
)
if config["wifi_password"] is not None:
self.component.wifi_password_entry.set_text(config["wifi_password"])
# admin account
if "admin_account" in config and isinstance(config["admin_account"], dict):
......@@ -1453,16 +1460,10 @@ class Application:
("language", language),
("timezone", timezone),
(
"wifi",
OrderedDict(
[
(
"protected",
not self.component.wifi_password_switch.get_active(),
),
("password", self.component.wifi_password_entry.get_text()),
]
),
"wifi_password",
None
if self.component.wifi_password_switch.get_active()
else self.component.wifi_password_entry.get_text(),
),
(
"admin_account",
......
......@@ -408,7 +408,7 @@
<object class="GtkEntry" id="project_name_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">Kiwix Hotspot</property>
<property name="text" translatable="yes">Kiwix</property>
</object>
<packing>
<property name="expand">False</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment