mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
domain:config: remove 'portal_logo' for now
This commit is contained in:
parent
6f085ad255
commit
163dd4d359
2 changed files with 7 additions and 36 deletions
|
@ -7,16 +7,16 @@ name = "Features"
|
|||
[feature.portal]
|
||||
name = "Portal"
|
||||
|
||||
# [feature.portal.show_other_domains_apps]
|
||||
# type = "boolean"
|
||||
# default = false
|
||||
[feature.portal.show_other_domains_apps]
|
||||
type = "boolean"
|
||||
default = false
|
||||
|
||||
[feature.portal.portal_title]
|
||||
type = "string"
|
||||
default = "YunoHost"
|
||||
|
||||
[feature.portal.portal_logo]
|
||||
type = "file"
|
||||
# [feature.portal.portal_logo]
|
||||
# type = "file"
|
||||
|
||||
[feature.portal.portal_theme]
|
||||
type = "select"
|
||||
|
|
|
@ -745,12 +745,12 @@ class DomainConfigPanel(ConfigPanel):
|
|||
"default_app",
|
||||
"show_other_domains_apps",
|
||||
"portal_title",
|
||||
"portal_logo",
|
||||
# "portal_logo",
|
||||
"portal_theme",
|
||||
]
|
||||
if any(
|
||||
option in self.future_values
|
||||
and self.future_values[option] != self.values.get(option)
|
||||
and self.new_values[option] != self.values.get(option)
|
||||
for option in portal_options
|
||||
):
|
||||
from yunohost.portal import PORTAL_SETTINGS_DIR
|
||||
|
@ -761,35 +761,6 @@ class DomainConfigPanel(ConfigPanel):
|
|||
portal_values = {
|
||||
option: self.future_values[option] for option in portal_options
|
||||
}
|
||||
if portal_values["portal_logo"].startswith("/tmp/ynh_filequestion_"):
|
||||
# FIXME rework this whole mess
|
||||
# currently only handling API sent images, need to adapt FileOption
|
||||
# to handle file extensions and file saving since "bind" is only
|
||||
# done in bash helpers which are not executed in domain config
|
||||
if "portal_logo[name]" in self.args or self.values["portal_logo"]:
|
||||
import mimetypes
|
||||
import base64
|
||||
|
||||
if "portal_logo[name]" in self.args:
|
||||
# FIXME choose where to save the file
|
||||
filepath = os.path.join("/tmp", self.args["portal_logo[name]"])
|
||||
# move the temp file created by FileOption with proper name and extension
|
||||
os.rename(self.new_values["portal_logo"], filepath)
|
||||
mimetype = mimetypes.guess_type(filepath)
|
||||
else:
|
||||
# image has already been saved, do not overwrite it with the empty temp file created by the FileOption
|
||||
filepath = self.values["portal_logo"]
|
||||
mimetype = mimetypes.guess_type(filepath)
|
||||
|
||||
# save the proper path to config panel settings
|
||||
self.new_values["portal_logo"] = filepath
|
||||
# save the base64 content with mimetype to portal settings
|
||||
with open(filepath, "rb") as f:
|
||||
portal_values["portal_logo"] = (
|
||||
mimetype[0]
|
||||
+ ":"
|
||||
+ base64.b64encode(f.read()).decode("utf-8")
|
||||
)
|
||||
|
||||
portal_settings_path = Path(f"{PORTAL_SETTINGS_DIR}/{self.entity}.json")
|
||||
portal_settings = {"apps": {}}
|
||||
|
|
Loading…
Add table
Reference in a new issue