mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add html tags to improve readability of some results (in particular DNS records stuff) on webadmin
This commit is contained in:
parent
f9dd634ebe
commit
3869c2f68e
2 changed files with 24 additions and 21 deletions
|
@ -159,19 +159,19 @@
|
|||
"diagnosis_ip_no_ipv4": "The server does not have working IPv4.",
|
||||
"diagnosis_ip_connected_ipv6": "The server is connected to the Internet through IPv6 !",
|
||||
"diagnosis_ip_no_ipv6": "The server does not have working IPv6.",
|
||||
"diagnosis_ip_global": "Global IP: {global}",
|
||||
"diagnosis_ip_local": "Local IP: {local}",
|
||||
"diagnosis_ip_global": "Global IP: <code>{global}</code>",
|
||||
"diagnosis_ip_local": "Local IP: <code>{local}</code>",
|
||||
"diagnosis_ip_not_connected_at_all": "The server does not seem to be connected to the Internet at all!?",
|
||||
"diagnosis_ip_dnsresolution_working": "Domain name resolution is working!",
|
||||
"diagnosis_ip_broken_dnsresolution": "Domain name resolution seems to be broken for some reason... Is a firewall blocking DNS requests ?",
|
||||
"diagnosis_ip_broken_resolvconf": "Domain name resolution seems to be broken on your server, which seems related to /etc/resolv.conf not pointing to 127.0.0.1.",
|
||||
"diagnosis_ip_weird_resolvconf": "DNS resolution seems to be working, but be careful that you seem to be using a custom /etc/resolv.conf.",
|
||||
"diagnosis_ip_weird_resolvconf_details": "Instead, this file should be a symlink to /etc/resolvconf/run/resolv.conf itself pointing to 127.0.0.1 (dnsmasq). The actual resolvers should be configured in /etc/resolv.dnsmasq.conf.",
|
||||
"diagnosis_ip_broken_resolvconf": "Domain name resolution seems to be broken on your server, which seems related to <code>/etc/resolv.conf</code> not pointing to <code>127.0.0.1</code>.",
|
||||
"diagnosis_ip_weird_resolvconf": "DNS resolution seems to be working, but it looks like you're using a custom <code>/etc/resolv.conf</code>.",
|
||||
"diagnosis_ip_weird_resolvconf_details": "The file <code>/etc/resolv.conf</code> should be a symlink to <code>/etc/resolvconf/run/resolv.conf</code> itself pointing to <code>127.0.0.1</code> (dnsmasq). If you want to manually configure DNS resolvers, please edit <code>/etc/resolv.dnsmasq.conf</code>.",
|
||||
"diagnosis_dns_good_conf": "Good DNS configuration for domain {domain} (category {category})",
|
||||
"diagnosis_dns_bad_conf": "Bad or missing DNS configuration for domain {domain} (category {category})",
|
||||
"diagnosis_dns_missing_record": "According to the recommended DNS configuration, you should add a DNS record with the following info.\nType: {type}\nName: {name}\nValue: {value}",
|
||||
"diagnosis_dns_discrepancy": "The DNS record with type {type} and name {name} does not match the recommended configuration.\nCurrent value: {current}\nExcepted value: {value}",
|
||||
"diagnosis_dns_point_to_doc": "Please check the documentation at https://yunohost.org/dns_config if you need help about configuring DNS records",
|
||||
"diagnosis_dns_missing_record": "According to the recommended DNS configuration, you should add a DNS record with the following info.<br>Type: <code>{type}</code><br>Name: <code>{name}</code><br>Value: <code>{value}</code>",
|
||||
"diagnosis_dns_discrepancy": "The following DNS record does not seem to follow the recommended configuration:<br>Type: <code>{type}</code><br>Name: <code>{name}</code><br>Current value: <code>{current}</code><br>Excepted value: <code>{value}</code>",
|
||||
"diagnosis_dns_point_to_doc": "Please check the documentation at <a href='https://yunohost.org/dns_config'>https://yunohost.org/dns_config</a> if you need help about configuring DNS records.",
|
||||
"diagnosis_services_running": "Service {service} is running!",
|
||||
"diagnosis_services_conf_broken": "Configuration is broken for service {service}!",
|
||||
"diagnosis_services_bad_status": "Service {service} is {status} :(",
|
||||
|
@ -209,7 +209,9 @@
|
|||
"diagnosis_ports_unreachable": "Port {port} is not reachable from outside.",
|
||||
"diagnosis_ports_ok": "Port {port} is reachable from outside.",
|
||||
"diagnosis_ports_needed_by": "Exposing this port is needed for {category} features (service {service})",
|
||||
"diagnosis_ports_forwarding_tip": "To fix this issue, you most probably need to configure port forwarding on your internet router as described in https://yunohost.org/isp_box_config",
|
||||
"diagnosis_ports_forwarding_tip": "To fix this issue, you most probably need to configure port forwarding on your internet router as described in <a href='https://yunohost.org/isp_box_config'>https://yunohost.org/isp_box_config</a>",
|
||||
"diagnosis_http_hairpinning_issue": "Your local network does not seem to have hairpinning enabled.",
|
||||
"diagnosis_http_hairpinning_issue_details": "This is probably because of your ISP box / router. As a result, people from outside your local network will be able to access your server as expected, but not people from inside the local network (like you, probably?). You may be able to improve the situation by having a look at <a href='https://yunohost.org/dns_local_network'>https://yunohost.org/dns_local_network</a>",
|
||||
"diagnosis_http_could_not_diagnose": "Could not diagnose if domain is reachable from outside. Error: {error}",
|
||||
"diagnosis_http_ok": "Domain {domain} is reachable through HTTP from outside the local network.",
|
||||
"diagnosis_http_timeout": "Timed-out while trying to contact your server from outside. It appears to be unreachable. You should check that you're correctly forwarding port 80, that nginx is running, and that a firewall is not interfering.",
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
Look for possible issues on the server
|
||||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
import time
|
||||
|
||||
|
@ -457,9 +458,6 @@ class Diagnoser():
|
|||
|
||||
report["description"] = Diagnoser.get_description(report["id"])
|
||||
|
||||
def is_tuple_or_list(stuff):
|
||||
return isinstance(stuff, tuple) or isinstance(stuff, list)
|
||||
|
||||
for item in report["items"]:
|
||||
|
||||
# For the summary and each details, we want to call
|
||||
|
@ -472,18 +470,21 @@ class Diagnoser():
|
|||
meta_data = item.get("meta", {}).copy()
|
||||
meta_data.update(item.get("data", {}))
|
||||
|
||||
if not is_tuple_or_list(item["summary"]):
|
||||
item["summary"] = (item["summary"], {})
|
||||
summary_key, summary_args = item["summary"]
|
||||
summary_args.update(meta_data)
|
||||
html_tags = re.compile(r'<[^>]+>')
|
||||
def m18n_(info):
|
||||
if not isinstance(info, tuple) and not isinstance(info, list):
|
||||
info = (info, {})
|
||||
info[1].update(meta_data)
|
||||
s = m18n.n(info[0], **(info[1]))
|
||||
# In cli, we remove the html tags
|
||||
if msettings.get("interface") != "api":
|
||||
s = html_tags.sub('', s.replace("<br>","\n"))
|
||||
return s
|
||||
|
||||
item["summary"] = m18n.n(summary_key, **summary_args)
|
||||
item["summary"] = m18n_(item["summary"])
|
||||
|
||||
if "details" in item:
|
||||
item["details"] = [(d[0], d[1]) if is_tuple_or_list(d) else (d, {}) for d in item["details"]]
|
||||
for d in item["details"]:
|
||||
d[1].update(meta_data)
|
||||
item["details"] = [m18n.n(key, **values) for key, values in item["details"]]
|
||||
item["details"] = [m18n_(info) for info in item["details"]]
|
||||
|
||||
|
||||
def _list_diagnosis_categories():
|
||||
|
|
Loading…
Add table
Reference in a new issue