Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • firmware/gluon
  • 0x4A6F/gluon
  • patrick/gluon
3 results
Select Git revision
Loading items
Show changes
Showing
with 379 additions and 331 deletions
#!/bin/sh
# shellcheck source=package/gluon-autoupdater/files/lib/gluon/autoupdater/lib.sh
. /lib/gluon/autoupdater/lib.sh
stop cron
stop haveged
stop urngd
stop micrond
stop sysntpd
#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require 'luci.model.uci'
local site = require 'gluon.site'
local uci = require('simple-uci').cursor()
local unistd = require 'posix.unistd'
local c = uci.cursor()
local has_tls = unistd.access('/lib/gluon/features/tls') ~= nil
local default_scheme = has_tls and 'https:' or 'http:'
local min_branch
for name, config in pairs(site.autoupdater.branches) do
c:delete('autoupdater', name)
c:section('autoupdater', 'branch', name,
{
local function mirror_urls(mirrors)
local ret = {}
for _, mirror in ipairs(mirrors) do
if string.match(mirror, '^//') ~= nil then
table.insert(ret, default_scheme .. mirror)
else
table.insert(ret, mirror)
end
end
return ret
end
for name, config in pairs(site.autoupdater.branches()) do
uci:delete('autoupdater', name)
uci:section('autoupdater', 'branch', name, {
name = config.name,
mirror = config.mirrors,
mirror = mirror_urls(config.mirrors),
good_signatures = config.good_signatures,
pubkey = config.pubkeys,
}
)
end
})
if not c:get('autoupdater', 'settings') then
local enabled = 0
local branch = site.autoupdater.branch
if not min_branch or (name < min_branch) then
min_branch = name
end
end
local function default_branch()
local f = io.open('/lib/gluon/autoupdater/default_branch')
if f then
enabled = 1
branch = f:read('*line')
local ret = f:read('*line')
f:close()
return ret
end
c:section('autoupdater', 'autoupdater', 'settings',
{
enabled = enabled,
branch = branch,
}
)
return site.autoupdater.branch(min_branch)
end
c:set('autoupdater', 'settings', 'version_file', '/lib/gluon/release')
local enabled, branch
if not uci:get('autoupdater', 'settings') then
enabled = unistd.access('/lib/gluon/autoupdater/default_enabled') ~= nil
end
local old_branch = uci:get('autoupdater', 'settings', 'branch')
if not old_branch or not uci:get('autoupdater', old_branch) then
branch = default_branch()
if not branch then
enabled = false
end
end
uci:section('autoupdater', 'autoupdater', 'settings', {
enabled = enabled,
branch = branch,
})
c:save('autoupdater')
uci:set('autoupdater', 'settings', 'version_file', '/lib/gluon/release')
uci:save('autoupdater')
local autoupdater_util = require 'autoupdater.util'
autoupdater_util.randomseed()
local urandom = io.open('/dev/urandom', 'r')
local seed1, seed2 = urandom:read(2):byte(1, 2)
math.randomseed(seed1*0x100 + seed2)
urandom:close()
-- Perform updates at a random time between 04:00 and 05:00, and once an hour
-- a fallback update (used after the regular updates haven't worked for
-- (priority+1) days after a firmware release, for example because the node
-- is always offline at night)
local minute = math.random(0, 59)
local f = io.open('/usr/lib/micron.d/autoupdater', 'w')
......
/*
Copyright (c) 2016, Matthias Schiffer <mschiffer@universe-factory.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* SPDX-FileCopyrightText: 2016, Matthias Schiffer <mschiffer@universe-factory.net> */
/* SPDX-License-Identifier: BSD-2-Clause */
#include <respondd.h>
......@@ -36,6 +14,8 @@
static struct json_object * get_autoupdater(void) {
struct uci_context *ctx = uci_alloc_context();
if (!ctx)
return NULL;
ctx->flags &= ~UCI_FLAG_STRICT;
struct uci_package *p;
......
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-client-bridge
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
define Package/gluon-client-bridge
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Provides a bridge and a wireless interface for clients to connect to
DEPENDS:=+gluon-core
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-client-bridge/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
endef
define Package/gluon-client-bridge/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
DEPENDS:=+gluon-core +kmod-veth
endef
$(eval $(call BuildPackage,gluon-client-bridge))
$(eval $(call BuildPackageGluon,gluon-client-bridge))
need_string_match('next_node.mac', '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$')
need_string_match(in_domain({'next_node', 'mac'}), '^%x[02468aAcCeE]:%x%x:%x%x:%x%x:%x%x:%x%x$', false)
if need_string_match('next_node.ip4', '^%d+.%d+.%d+.%d+$', false) then
need_string_match('prefix4', '^%d+.%d+.%d+.%d+/%d+$')
if need_string_match(in_domain({'next_node', 'ip4'}), '^%d+.%d+.%d+.%d+$', false) then
need_string_match(in_domain({'prefix4'}), '^%d+.%d+.%d+.%d+/%d+$')
end
need_string_match('next_node.ip6', '^[%x:]+$', false)
need_string_match(in_domain({'next_node', 'ip6'}), '^[%x:]+$', false)
for _, config in ipairs({'wifi24', 'wifi5'}) do
if need_table(config .. '.ap', nil, false) then
need_string(config .. '.ap.ssid')
need_boolean(config .. '.ap.disabled', false)
if need_table({config, 'ap'}, nil, false) then
need_boolean({config, 'ap', 'disabled'}, false)
if need_boolean({config, 'ap', 'owe_transition_mode'}, false) then
need_string_match(in_domain({config, 'ap', 'ssid'}), '^' .. ('.?'):rep(32) .. '$')
need_string_match(in_domain({config, 'ap', 'owe_ssid'}), '^' .. ('.?'):rep(32) .. '$')
else
need_string_match(in_domain({config, 'ap', 'ssid'}), '^' .. ('.?'):rep(32) .. '$', false)
need_string_match(in_domain({config, 'ap', 'owe_ssid'}), '^' .. ('.?'):rep(32) .. '$', false)
end
end
end
#!/usr/bin/lua
local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig'
local util = require 'gluon.util'
local ip = require 'luci.ip'
local lutil = require 'luci.util'
local uci = require('luci.model.uci').cursor()
local uci = require('simple-uci').cursor()
local ip4, netmask, ip6
local interfaces = util.get_role_interfaces(uci, 'client', true)
util.add_to_set(interfaces, 'local-port')
if site.next_node.ip4 then
ip4 = site.next_node.ip4
netmask = ip.IPv4(site.prefix4):mask():string()
end
if site.next_node.ip6 then
ip6 = site.next_node.ip6 .. '/128'
end
uci:section('network', 'interface', 'client',
{
uci:section('network', 'interface', 'client', {
type = 'bridge',
proto = 'static',
macaddr = site.next_node.mac,
ipaddr = ip4,
netmask = netmask,
ip6addr = ip6,
}
)
uci:delete('network', 'client', 'reqprefix')
uci:delete('network', 'client', 'peerdns')
uci:delete('network', 'client', 'sourcefilter')
ifname = interfaces,
proto = 'none',
auto = true,
ipv6 = false,
macaddr = sysconfig.primary_mac,
igmp_snooping = true,
multicast_querier = true,
ra_holdoff = 30,
})
local interfaces = uci:get('network', 'client', 'ifname') or {}
if type(interfaces) == 'string' then
local ifname = interfaces
interfaces = {}
for iface in ifname:gmatch("[^%s]+") do
util.add_to_set(interfaces, iface)
end
end
if sysconfig.lan_ifname and not ifname and not uci:get_bool('network', 'mesh_lan', 'auto') then
for _, lanif in ipairs(lutil.split(sysconfig.lan_ifname, ' ')) do
util.add_to_set(interfaces, lanif)
end
end
uci:save('network')
uci:set_list('network', 'client', 'ifname', interfaces)
uci:section('firewall', 'zone', 'drop', {
name = 'drop',
network = {'client'},
input = 'DROP',
output = 'DROP',
forward = 'DROP',
})
uci:save('network')
local networks = uci:get_list('firewall', 'loc_client', 'network')
util.add_to_set(networks, 'local_node')
uci:set_list('firewall', 'loc_client', 'network', networks)
local dnsmasq = uci:get_first('dhcp', 'dnsmasq')
uci:set('dhcp', dnsmasq, 'boguspriv', 0)
uci:set('dhcp', dnsmasq, 'localise_queries', 0)
uci:set('dhcp', dnsmasq, 'rebind_protection', 0)
uci:set('dhcp', dnsmasq, 'boguspriv', false)
uci:set('dhcp', dnsmasq, 'localise_queries', false)
uci:set('dhcp', dnsmasq, 'rebind_protection', false)
uci:delete('dhcp', 'client')
uci:section('dhcp', 'dhcp', 'client',
{
uci:section('dhcp', 'dhcp', 'local_client', {
interface = 'client',
ignore = 1,
}
)
ignore = true,
})
uci:save('dhcp')
uci:save('firewall')
#!/usr/bin/lua
local client_bridge = require 'gluon.client_bridge'
local site = require 'gluon.site'
local sysconfig = require 'gluon.sysconfig'
local uci = require('simple-uci').cursor()
local next_node = site.next_node({})
uci:section('network', 'device', 'local_node_dev', {
type = 'veth',
name = 'local-node',
macaddr = client_bridge.next_node_macaddr(),
peer_name = 'local-port',
peer_macaddr = sysconfig.primary_mac,
})
local ip4, ip6
if next_node.ip4 then
local plen = site.prefix4():match('/%d+$')
ip4 = next_node.ip4 .. plen
end
if next_node.ip6 then
ip6 = next_node.ip6 .. '/128'
end
uci:section('network', 'interface', 'local_node', {
ifname = 'local-node',
proto = 'static',
ipaddr = ip4,
ip6addr = ip6,
ip6deprecated = true,
})
uci:save('network')
uci:delete('dhcp', 'local_node')
uci:section('dhcp', 'dhcp', 'local_node', {
interface = 'local_node',
ignore = true,
})
uci:save('dhcp')
#!/usr/bin/lua
local site = require 'gluon.site_config'
local util = require 'gluon.util'
local wireless = require 'gluon.wireless'
local uci = require('luci.model.uci').cursor()
local uci = require('simple-uci').cursor()
local function is_disabled(config, name)
local disabled = config and config.disabled
if uci:get('wireless', name) then
disabled = uci:get_bool('wireless', name, 'disabled')
return uci:get_bool('wireless', name, 'disabled')
end
return disabled and 1 or 0
return config.disabled(false)
end
local function configure_client(config, radio, index, suffix)
local name = 'client_' .. radio
local disabled = is_disabled(config, name)
local function configure_ap(radio, index, config, radio_name)
local name = 'client_' .. radio_name
local suffix = radio_name:match('^radio(%d+)$')
local ap = config.ap
local disabled = is_disabled(ap, name)
uci:delete('wireless', name)
local macaddr = wireless.get_wlan_mac('client', index, radio)
if not ap.ssid() or not macaddr then
return
end
uci:section('wireless', 'wifi-iface', name, {
device = radio_name,
network = 'client',
mode = 'ap',
ssid = ap.ssid(),
macaddr = macaddr,
ifname = suffix and 'client' .. suffix,
disabled = disabled or false,
})
end
local function configure_owe(radio, index, config, radio_name)
local name = 'owe_' .. radio_name
local suffix = radio_name:match('^radio(%d+)$')
local ap = config.ap
local disabled = is_disabled(ap, 'client_' .. radio_name)
uci:delete('wireless', name)
if not config then
-- Don't configure OWE in case our device
-- can't do MFP, as it's mandatory for OWE.
if not wireless.device_supports_mfp(uci) then
return
end
local macaddr = util.get_wlan_mac(radio, index, 1)
if not macaddr then
local macaddr = wireless.get_wlan_mac('mesh', index, radio)
if not ap.owe_ssid() or not macaddr then
return
end
uci:section('wireless', 'wifi-iface', name,
{
device = radio,
uci:section('wireless', 'wifi-iface', name, {
device = radio_name,
network = 'client',
mode = 'ap',
ssid = config.ssid,
ssid = ap.owe_ssid(),
macaddr = macaddr,
ifname = suffix and 'client' .. suffix,
disabled = disabled,
}
)
ifname = suffix and 'owe' .. suffix,
disabled = disabled or false,
encryption = 'owe',
ieee80211w = 2,
})
end
local function configure_owe_transition_mode(config, radio_name)
local ap = config.ap
-- Don't configure OWE in case our device
-- can't do MFP, as it's mandatory for OWE.
if not wireless.device_supports_mfp(uci) then
return
end
if not ap.owe_transition_mode(false) then
return
end
local name_client = 'client_' .. radio_name
local name_owe = 'owe_' .. radio_name
local ifname_client = uci:get('wireless', name_client, 'ifname')
local ifname_owe = uci:get('wireless', name_owe, 'ifname')
if not (ifname_client and ifname_owe) then
return
end
local function configure_radio(radio, index, config)
local suffix = radio:match('^radio(%d+)$')
uci:set('wireless', name_client, 'owe_transition_ifname', ifname_owe)
uci:set('wireless', name_owe, 'owe_transition_ifname', ifname_client)
configure_client(config.ap, radio, index, suffix)
uci:set('wireless', name_owe, 'hidden', '1')
end
util.iterate_radios(configure_radio)
wireless.foreach_radio(uci, function(radio, index, config)
local radio_name = radio['.name']
configure_ap(radio, index, config, radio_name)
configure_owe(radio, index, config, radio_name)
configure_owe_transition_mode(config, radio_name)
end)
uci:save('wireless')
local site = require 'gluon.site'
local M = {}
function M.next_node_macaddr()
return site.next_node.mac('16:41:95:40:f7:dc')
end
return M
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-autoupdater
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-autoupdater
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Let the user know whether the autoupdater is enabled or not.
DEPENDS:=gluon-config-mode-core-virtual +gluon-autoupdater
endef
define Package/gluon-config-mode-autoupdater/description
Luci based config mode
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-autoupdater,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-config-mode-autoupdater/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-autoupdater,$(1))
TITLE:=Config Mode: Let the user know whether the autoupdater is enabled or not
DEPENDS:=+gluon-config-mode-core +gluon-autoupdater
endef
$(eval $(call BuildPackage,gluon-config-mode-autoupdater))
$(eval $(call BuildPackageGluon,gluon-config-mode-autoupdater))
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-18 16:03+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"Automatic updates are disabled. They can be enabled in <em>Advanced "
"settings</em>."
msgstr ""
"Automatische Updates sind deaktiviert. Sie können in den <em>Erweiterten "
"Einstellungen</em> aktiviert werden."
msgid ""
"This node will automatically update its firmware when a new version is "
"available."
msgstr "Dieser Knoten aktualisiert seine Firmware automatisch, sobald "
"eine neue Version vorliegt."
msgstr ""
"Dieser Knoten aktualisiert seine Firmware automatisch, sobald eine neue "
"Version vorliegt."
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-08-04 20:20+0100\n"
"Last-Translator: Bernot Tobias <tqbs@airmail.cc>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"Automatic updates are disabled. They can be enabled in <em>Advanced "
"settings</em>."
msgstr ""
"Mises à jour automatiques sont désactivées. Ils peuvent être activés dans "
"<em>Paramètres avancés</em>."
msgid ""
"This node will automatically update its firmware when a new version is "
"available."
msgstr "Ce nœud s'actualisera automatiquement quand une nouvelle "
"version sera disponible."
msgstr ""
"Ce nœud s'actualisera automatiquement quand une nouvelle version sera "
"disponible."
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid ""
"Automatic updates are disabled. They can be enabled in <em>Advanced "
"settings</em>."
msgstr ""
msgid ""
"This node will automatically update its firmware when a new version is "
"available."
......
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-autoupdater'
local M = {}
function M.section(form)
local enabled = uci:get_bool("autoupdater", "settings", "enabled")
if enabled then
local s = form:section(cbi.SimpleSection, nil,
i18n.translate('This node will automatically update its firmware when a new version is available.'))
end
form:section(
Section, nil,
pkg_i18n.translate('This node will automatically update its firmware when a new version is available.')
)
else
form:section(
Section, nil,
pkg_i18n.translate('Automatic updates are disabled. They can be enabled in <em>Advanced settings</em>.')
)
end
function M.handle(data)
return
end
return M
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-contact-info
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-contact-info
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Allows the user to provide contact information to be distributed in the mesh
DEPENDS:=gluon-config-mode-core-virtual +gluon-node-info
endef
define Package/gluon-config-mode-contact-info/description
Allows the user to provide contact information to be distributed in the mesh.
Can be made obligatory in site.conf
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-contact-info,i18n)
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-config-mode-contact-info/install
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-contact-info,$(1))
endef
define Package/gluon-config-mode-contact-info/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
DEPENDS:=+gluon-config-mode-core +gluon-node-info
endef
$(eval $(call BuildPackage,gluon-config-mode-contact-info))
$(eval $(call BuildPackageGluon,gluon-config-mode-contact-info))
if need_table('config_mode', nil, false) and need_table('config_mode.owner', nil, false) then
need_boolean('config_mode.owner.obligatory', false)
end
......@@ -14,14 +14,20 @@ msgid "Contact info"
msgstr "Kontakt"
msgid ""
"Please provide your contact information here to allow others to contact "
"you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
"Please provide your contact information here to allow others to contact you. "
"Note that this information will be visible <em>publicly</em> on the internet "
"together with your node's coordinates. This means it can be downloaded and "
"processed by anyone. This information is not required to operate a node. If "
"you chose to enter data, it will be stored on this node and can be deleted "
"by yourself at any time."
msgstr ""
"Bitte hinterlege hier einen Hinweis, um anderen zu ermöglichen, "
"Kontakt mit dir aufzunehmen. Beachte, dass dieser Hinweis auch "
"<em>öffentlich</em> im Internet, zusammen mit den Koordinaten "
"deines Knotens, einsehbar sein wird."
"Bitte hinterlege hier einen Hinweis, um anderen zu ermöglichen, Kontakt mit "
"dir aufzunehmen. Beachte, dass dieser Hinweis auch <em>öffentlich</em> im "
"Internet, zusammen mit den Koordinaten deines Knotens, einsehbar sein wird. "
"Das bedeutet, dass diese Informationen von jedem heruntergeladen und "
"verarbeitet werden können. Für den Betrieb sind diese Informationen nicht "
"erforderlich. Eine Speicherung erfolgt auf diesem Knoten. Die Daten können "
"durch dich in diesem Menü eigenständig gelöscht werden."
msgid "e.g. E-mail or phone number"
msgstr "z.B. E-Mail oder Telefonnummer"
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-08-12 23:30+0100\n"
"Last-Translator:Tobias Bernot <tqbs@airmail.cc>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
......@@ -14,13 +14,19 @@ msgid "Contact info"
msgstr "Informations de Contact"
msgid ""
"Please provide your contact information here to allow others to contact "
"you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
"Please provide your contact information here to allow others to contact you. "
"Note that this information will be visible <em>publicly</em> on the internet "
"together with your node's coordinates. This means it can be downloaded and "
"processed by anyone. This information is not required to operate a node. If "
"you chose to enter data, it will be stored on this node and can be deleted "
"by yourself at any time."
msgstr ""
"S'il vous plaît entrez ici des informations <em>publiques</em> pour "
"permettre aux autres de vous contacter. "
"Ces informations seront affichées en ligne, avec les coordonnées du nœud."
"Entrez vos coordonnées ici si vous souhaitez permettre à d'autres personnes "
"de communiquer avec vous. Ces informations seront affichées <em>en ligne</"
"em> avec les coordonnées du nœud. Il peut être téléchargé et traité par "
"tous. Il n'est pas obligatoire de fournir ces informations pour pouvoir "
"opérer un nœud. Si vous avez choisi d'entrer des données, elles seront "
"stockées sur ce nœud et vous pourrez les effacer par vous-même à tout moment."
msgid "e.g. E-mail or phone number"
msgstr "Ex : E-mail ou numéro de téléphone"
......@@ -5,9 +5,12 @@ msgid "Contact info"
msgstr ""
msgid ""
"Please provide your contact information here to allow others to contact "
"you. Note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
"Please provide your contact information here to allow others to contact you. "
"Note that this information will be visible <em>publicly</em> on the internet "
"together with your node's coordinates. This means it can be downloaded and "
"processed by anyone. This information is not required to operate a node. If "
"you chose to enter data, it will be stored on this node and can be deleted "
"by yourself at any time."
msgstr ""
msgid "e.g. E-mail or phone number"
......
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local site = require 'gluon.site_config'
return function(form, uci)
local pkg_i18n = i18n 'gluon-config-mode-contact-info'
local site_i18n = i18n 'gluon-site'
local M = {}
local owner = uci:get_first("gluon-node-info", "owner")
function M.section(form)
local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'Please provide your contact information here to '
.. 'allow others to contact you. Note that '
.. 'this information will be visible <em>publicly</em> '
.. 'on the internet together with your node\'s coordinates.'
local help = site_i18n._translate("gluon-config-mode:contact-help") or pkg_i18n.translate(
'Please provide your contact information here to allow others to contact '
.. 'you. Note that this information will be visible <em>publicly</em> on '
.. 'the internet together with your node\'s coordinates. This means it can '
.. 'be downloaded and processed by anyone. This information is '
.. 'not required to operate a node. If you chose to enter data, it will be '
.. 'stored on this node and can be deleted by yourself at any time.'
)
)
local o = s:option(cbi.Value, "_contact", i18n.translate("Contact info"))
o.default = uci:get_first("gluon-node-info", "owner", "contact", "")
o.rmempty = not ((site.config_mode or {}).owner or {}).obligatory
o.datatype = "string"
o.description = i18n.translate("e.g. E-mail or phone number")
o.maxlen = 140
end
local s = form:section(Section, nil, help)
function M.handle(data)
if data._contact ~= nil then
uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact)
else
uci:delete("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact")
end
local o = s:option(Value, "contact", pkg_i18n.translate("Contact info"),
site_i18n._translate("gluon-config-mode:contact-note") or pkg_i18n.translate("e.g. E-mail or phone number"))
o.default = uci:get("gluon-node-info", owner, "contact")
o.datatype = 'minlength(1)'
o.optional = true
function o:write(data)
uci:set("gluon-node-info", owner, "contact", data)
uci:save("gluon-node-info")
uci:commit("gluon-node-info")
end
return M
end