From 1ce42beda7982b696df6a35554ed36824971f91b Mon Sep 17 00:00:00 2001
From: Confituurke <9595028+Confituurke@users.noreply.github.com>
Date: Tue, 17 Nov 2026 16:51:46 +0100
Subject: [PATCH 1/2] fix(meshmap): the owner row's link reads "View on #BEmesh
map" (fork-local)
The link opens the node on the #BEmesh map, so it carries the map's own name.
---
docs/release-notes/nl/v3.17.0-on8ar.7.md | 2 +-
public/meshmap-owner.js | 2 +-
tests/unit/test-meshmap-owner.js | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/release-notes/nl/v3.17.0-on8ar.7.md b/docs/release-notes/nl/v3.17.0-on8ar.7.md
index 912bfb0cb..8e0c0cab8 100644
--- a/docs/release-notes/nl/v3.17.0-on8ar.7.md
+++ b/docs/release-notes/nl/v3.17.0-on8ar.7.md
@@ -1,4 +1,4 @@
-**Wie beheert deze repeater?** Bij Repeater info op de nodepagina staat nu wie de repeater geclaimd heeft op de #BEmesh map (meshmap.radio-actief.be): de eigenaar en eventuele beheerders, met de naam die ze daar tonen en een link "view on meshmap" die de kaart op die repeater opent. Zo weet je bij wie je terechtkan.
+**Wie beheert deze repeater?** Bij Repeater info op de nodepagina staat nu wie de repeater geclaimd heeft op de #BEmesh map (meshmap.radio-actief.be): de eigenaar en eventuele beheerders, met de naam die ze daar tonen en een link "View on #BEmesh map" die de kaart op die repeater opent. Zo weet je bij wie je terechtkan.
De gegevens komen rechtstreeks van de #BEmesh map, met toestemming van de beheerder ervan, en worden elk uur bijgewerkt. Wat je daar instelt, geldt ook hier: verberg je je naam op de map, dan staat er alleen "claimed"; deel je je nodes niet met partnertools, dan verschijnt er niets. Een claim die op de map verdwijnt, verdwijnt hier bij de volgende update.
diff --git a/public/meshmap-owner.js b/public/meshmap-owner.js
index e042fac05..43d94711a 100644
--- a/public/meshmap-owner.js
+++ b/public/meshmap-owner.js
@@ -60,7 +60,7 @@
var managers = Array.isArray(c.managers) ? c.managers : [];
if (!c.owner && !managers.length) return '';
var link = ' · view on meshmap';
+ '" target="_blank" rel="noopener noreferrer">View on #BEmesh map';
var html = '';
if (c.owner) {
html += row('Owner', (c.owner.name ? '@' + escapeHtml(String(c.owner.name)) : 'claimed') + link);
diff --git a/tests/unit/test-meshmap-owner.js b/tests/unit/test-meshmap-owner.js
index 298066b32..2dadd3153 100644
--- a/tests/unit/test-meshmap-owner.js
+++ b/tests/unit/test-meshmap-owner.js
@@ -50,7 +50,7 @@ test('owner row: label, @name and a safe meshmap link', async () => {
const h = l.M.rowHtml({ public_key: PK, lat: 51.1378, lon: 5.5902 });
assert(h.includes('
Owner'), h);
assert(h.includes('@erwinfiten'), h);
- assert(h.includes('view on meshmap'), h);
+ assert(h.includes('View on #BEmesh map'), h);
assert(h.includes('target="_blank"') && h.includes('rel="noopener noreferrer"'), h);
assert(!h.includes('Managers'), 'no managers row without managers: ' + h);
});
@@ -61,7 +61,7 @@ test('hidden owner name shows "claimed" without a name', async () => {
const h = l.M.rowHtml({ public_key: PK });
assert(h.includes('Owner') && h.includes('claimed'), h);
assert(!h.includes('@'), h);
- assert(h.includes('view on meshmap'), h);
+ assert(h.includes('View on #BEmesh map'), h);
});
test('managers row lists named managers and counts hidden ones', async () => {
@@ -71,7 +71,7 @@ test('managers row lists named managers and counts hidden ones', async () => {
assert(h.includes('Managers'), h);
assert(h.includes('@amy, @zed'), h);
assert(h.includes('1 with a hidden name'), h);
- assert.strictEqual(h.split('view on meshmap').length - 1, 1, 'one meshmap link: ' + h);
+ assert.strictEqual(h.split('View on #BEmesh map').length - 1, 1, 'one meshmap link: ' + h);
});
test('only managers, no owner: managers row carries the link', async () => {
@@ -79,7 +79,7 @@ test('only managers, no owner: managers row carries the link', async () => {
await l.M.ready();
const h = l.M.rowHtml({ public_key: PK });
assert(!h.includes('Owner'), h);
- assert(h.includes('Managers') && h.includes('@amy') && h.includes('view on meshmap'), h);
+ assert(h.includes('Managers') && h.includes('@amy') && h.includes('View on #BEmesh map'), h);
});
test('names are escaped', async () => {
From f94b846f92d880fde3340c68a4dde3c104cafad2 Mon Sep 17 00:00:00 2001
From: Confituurke <9595028+Confituurke@users.noreply.github.com>
Date: Tue, 17 Nov 2026 18:14:32 +0100
Subject: [PATCH 2/2] feat(meshmap): link a named owner or manager to their
Discord profile (fork-local)
The map's partner claims feed now carries discordUrl, a link to the
person's Discord profile, only for people who show their name (null
otherwise). /api/meshmap/owners passes it on per person as discord,
kept only when it is a https://discord.com/users/ address. The
Repeater info section shows such a name as a link that opens the
profile, where people can send a message. Without one, the name stays
plain text as before.
---
cmd/server/meshmap_owners.go | 20 ++++++++++++++++++--
cmd/server/meshmap_owners_test.go | 22 +++++++++++-----------
cmd/server/openapi.go | 2 +-
public/meshmap-owner.js | 21 ++++++++++++++++-----
tests/unit/test-meshmap-owner.js | 22 ++++++++++++++++++++++
5 files changed, 68 insertions(+), 19 deletions(-)
diff --git a/cmd/server/meshmap_owners.go b/cmd/server/meshmap_owners.go
index e210f31c9..b758b60e1 100644
--- a/cmd/server/meshmap_owners.go
+++ b/cmd/server/meshmap_owners.go
@@ -64,9 +64,12 @@ func (c *MeshmapOwnersConfig) resolve() (string, string, time.Duration, bool) {
}
// meshmapPerson is one owner or manager. Name is empty when the person hides
-// their name on meshmap; the UI then shows "claimed" without a name.
+// their name on meshmap; the UI then shows "claimed" without a name. Discord is
+// a link to the person's Discord profile, only for a named person and only a
+// https://discord.com/users/ address; otherwise empty.
type meshmapPerson struct {
- Name string `json:"name"`
+ Name string `json:"name"`
+ Discord string `json:"discord"`
}
// meshmapNodeClaims is everyone who claimed one node: at most one owner, any
@@ -94,9 +97,19 @@ type meshmapClaim struct {
PublicKey string `json:"publicKey"`
Role string `json:"role"`
DisplayName *string `json:"displayName"`
+ DiscordURL *string `json:"discordUrl"`
}
var meshmapPubkeyRe = regexp.MustCompile(`^[0-9a-f]{64}$`)
+var meshmapDiscordRe = regexp.MustCompile(`^https://discord\.com/users/[0-9]{15,21}$`)
+
+// cleanMeshmapDiscord keeps only a Discord profile address.
+func cleanMeshmapDiscord(p *string) string {
+ if p == nil || !meshmapDiscordRe.MatchString(*p) {
+ return ""
+ }
+ return *p
+}
// cleanMeshmapName drops control characters, trims, and cuts at 64 runes.
func cleanMeshmapName(p *string) string {
@@ -137,6 +150,9 @@ func parseMeshmapClaims(raw []byte) ([]meshmapNodeClaims, error) {
byKey[pk] = n
}
person := meshmapPerson{Name: cleanMeshmapName(c.DisplayName)}
+ if person.Name != "" {
+ person.Discord = cleanMeshmapDiscord(c.DiscordURL)
+ }
if c.Role == "owner" {
if n.Owner == nil {
n.Owner = &person
diff --git a/cmd/server/meshmap_owners_test.go b/cmd/server/meshmap_owners_test.go
index b4e329a1a..98ed3f7ff 100644
--- a/cmd/server/meshmap_owners_test.go
+++ b/cmd/server/meshmap_owners_test.go
@@ -20,10 +20,10 @@ func TestParseMeshmapClaims(t *testing.T) {
long := strings.Repeat("é", 70)
upper := strings.ToUpper(strings.Repeat("ab", 32))
raw := `{"version":1,"generatedAt":"2026-11-17T10:00:00Z","claims":[
- {"publicKey":"` + mmPK + `","role":"owner","subject":"s1","displayName":"erwinfiten","since":null},
- {"publicKey":"` + mmPK + `","role":"manager","subject":"s2","displayName":"zed"},
- {"publicKey":"` + mmPK + `","role":"manager","subject":"s3","displayName":null},
- {"publicKey":"` + mmPK + `","role":"manager","subject":"s4","displayName":"amy"},
+ {"publicKey":"` + mmPK + `","role":"owner","subject":"s1","displayName":"erwinfiten","discordUrl":"https://discord.com/users/123456789012345678","since":null},
+ {"publicKey":"` + mmPK + `","role":"manager","subject":"s2","displayName":"zed","discordUrl":"https://evil.example/users/123456789012345678"},
+ {"publicKey":"` + mmPK + `","role":"manager","subject":"s3","displayName":null,"discordUrl":"https://discord.com/users/223456789012345678"},
+ {"publicKey":"` + mmPK + `","role":"manager","subject":"s4","displayName":"amy","discordUrl":"https://discord.com/users/323456789012345678\">"},"managers":[]},` +
- `{"pubkey":"` + strings.Repeat("66", 32) + `","owner":{"name":"` + strings.Repeat("é", 64) + `"},"managers":[]},` +
- `{"pubkey":"` + strings.Repeat("88", 32) + `","owner":null,"managers":[{"name":"onlymgr"}]},` +
- `{"pubkey":"` + strings.Repeat("ab", 32) + `","owner":{"name":"upper"},"managers":[]},` +
- `{"pubkey":"` + mmPK + `","owner":{"name":"erwinfiten"},"managers":[{"name":"amy"},{"name":"zed"},{"name":""}]}` +
+ `{"pubkey":"` + strings.Repeat("22", 32) + `","owner":{"name":"","discord":""},"managers":[]},` +
+ `{"pubkey":"` + strings.Repeat("33", 32) + `","owner":{"name":"","discord":""},"managers":[]},` +
+ `{"pubkey":"` + strings.Repeat("55", 32) + `","owner":{"name":"ab","discord":""},"managers":[]},` +
+ `{"pubkey":"` + strings.Repeat("66", 32) + `","owner":{"name":"` + strings.Repeat("é", 64) + `","discord":""},"managers":[]},` +
+ `{"pubkey":"` + strings.Repeat("88", 32) + `","owner":null,"managers":[{"name":"onlymgr","discord":""}]},` +
+ `{"pubkey":"` + strings.Repeat("ab", 32) + `","owner":{"name":"upper","discord":""},"managers":[]},` +
+ `{"pubkey":"` + mmPK + `","owner":{"name":"erwinfiten","discord":"https://discord.com/users/123456789012345678"},"managers":[{"name":"amy","discord":""},{"name":"zed","discord":""},{"name":"","discord":""}]}` +
`]`
if string(b) != want {
t.Fatalf("got %s\nwant %s", b, want)
diff --git a/cmd/server/openapi.go b/cmd/server/openapi.go
index 6d2e11dfd..e806f1d7f 100644
--- a/cmd/server/openapi.go
+++ b/cmd/server/openapi.go
@@ -276,7 +276,7 @@ func routeDescriptions() map[string]routeMeta {
"GET /api/planner/viewshed": {Summary: "Theoretical reach of one candidate repeater site", Description: "Opt-in (config planner.enabled). For site=lat,lon (near a known node) at h metres (default planner.newAntennaM) within range km (one of the planner's ranges, default planner.defaultRangeKm): a grid of cells over bbox [s,w,n,e], row 0 north, row-major, base64 in cells, one byte per cell: low nibble the Users class 1-5 (handheld reach curve planner.userReach, lowered in deep terrain shadow), high nibble the Repeaters class 1-3 (blocked below -20% first-Fresnel clearance, slightly blocked -20% to 0%, line of sight 0% or more, for a receiver at rx metres, default planner.existingAntennaM), 0 for no data. links lists the known repeaters within range (rooms, stale repeaters and repeaters within 100 m of the site excluded), nearest first, with the site-to-repeater link at h and rx (no elev_m profile). truncated is true only when the 300-node cap may have dropped a repeater within range. 202 while computing: re-poll the same URL.", Tag: "map"},
"GET /api/planner/coverage": {Summary: "Repeater backbone plan for an area", Description: "Opt-in (config planner.enabled). For bbox s,w,n,e (each side at most config planner.maxAreaKm, 100 km by default, settable from 20 to 250; must contain known repeaters) suggests up to sites=N new repeater sites, greedily minimising backbone components, then single points of failure, then maximising repeaters reached. 202 while computing: re-poll the same URL.", Tag: "map"},
"GET /api/elevation/profile": {Summary: "Terrain elevation along route legs", Description: "Opt-in (config los.enabled). Query pts is a flat comma list lat1,lon1,lat2,lon2,... of 2-16 points; legs[i] is pts[i] to pts[i+1] with distance_km (great-circle) and elev_m, terrain heights in metres evenly spaced along the great circle (about one per 90 m, 64-600, as /api/planner/profile samples a leg), or error too_long (leg over 300 km), unknown_point (endpoint is not a known node), too_many_tiles (the request would load more than 16 terrain tiles), upstream (a terrain tile could not be loaded; retry later) or no_terrain (no terrain data there). Terrain is the planner's SRTM tiles (config terrain block), held in memory; source names it for attribution. Every point must be a known node position. 202 with {state, progress, retry_after_s} while tiles download: re-poll the same URL. 404 when disabled, 400 on bad pts, 429 with Retry-After when the request would start more tile downloads than the client's per-IP allowance.", Tag: "map"},
- "GET /api/meshmap/owners": {Summary: "Repeater owners and managers from meshmap", Description: "Fork-local, opt-in (config meshmapOwners.enabled and meshmapOwners.secret). Who claimed which node on meshmap.radio-actief.be, from its partner claims feed, refreshed every meshmapOwners.refreshMinutes (default 60) and replaced as a whole on every fetch. Per node (lower-case pubkey): owner (null when none) and managers, each with a name that is empty when the person hides it. People who do not share with partner tools are absent. fetchedAt is null before the first successful fetch; source is the meshmap base URL. 404 when the feature is off.", Tag: "nodes"},
+ "GET /api/meshmap/owners": {Summary: "Repeater owners and managers from meshmap", Description: "Fork-local, opt-in (config meshmapOwners.enabled and meshmapOwners.secret). Who claimed which node on meshmap.radio-actief.be, from its partner claims feed, refreshed every meshmapOwners.refreshMinutes (default 60) and replaced as a whole on every fetch. Per node (lower-case pubkey): owner (null when none) and managers, each with a name that is empty when the person hides it and discord, a link to the person's Discord profile (https://discord.com/users/) or empty when meshmap does not share one. People who do not share with partner tools are absent. fetchedAt is null before the first successful fetch; source is the meshmap base URL. 404 when the feature is off.", Tag: "nodes"},
"GET /api/rf-params": {Summary: "LoRa RF parameters per node", Description: "Opt-in (config rfParams.nodesUrl, issue #1268). Frequency, SF, bandwidth and coding rate the MeshCore map holds for the nodes this instance knows, keyed by lower-case pubkey, limited to adverts within rfParams.maxAgeDays (default 7). Also returns the named presets and fetched_at, the time of the last successful map fetch (null before the first one), and deviations: the nodes whose frequency, SF or bandwidth differs from a setting that more than half of the nodes within rfParams.compareRadiusKm (default 50) on the same band share, the node itself counted, with that majority and the counts. Frequencies within a quarter of the bandwidth count as the same channel. enabled is false when the feature is off.", Tag: "nodes"},
"GET /api/iata-coords": {Summary: "Get IATA airport coordinates", Description: "Returns lat/lon for known airport codes (used for observer positioning).", Tag: "config"},
"GET /api/audio-lab/buckets": {Summary: "Audio lab frequency buckets", Description: "Returns frequency bucket data for audio analysis.", Tag: "analytics"},
diff --git a/public/meshmap-owner.js b/public/meshmap-owner.js
index 43d94711a..2ebacf446 100644
--- a/public/meshmap-owner.js
+++ b/public/meshmap-owner.js
@@ -3,8 +3,9 @@
* of /api/meshmap/owners per page load (the server caches the map's partner
* claims feed); a failed fetch is retried on the next mount. rowHtml returns
* '' when nobody claimed the repeater or the feature is off. A person who
- * hides their name shows as "claimed". Every dynamic value goes through
- * escapeHtml. */
+ * hides their name shows as "claimed". A named person whose Discord profile
+ * meshmap shares gets their name as a link to it, where people can message
+ * them. Every dynamic value goes through escapeHtml. */
(function () {
'use strict';
var byKey = {};
@@ -44,11 +45,21 @@
return '' + label + '' + value + '';
}
+ var DISCORD_RE = /^https:\/\/discord\.com\/users\/[0-9]{15,21}$/;
+
+ // "@name", a link to the person's Discord profile when there is one.
+ function personHtml(p) {
+ var text = '@' + escapeHtml(String(p.name));
+ var url = p.discord ? String(p.discord) : '';
+ if (!DISCORD_RE.test(url)) return text;
+ return '' + text + '';
+ }
+
function managersText(managers) {
var named = [], hidden = 0;
managers.forEach(function (m) {
- var name = m && m.name ? String(m.name) : '';
- if (name) named.push('@' + escapeHtml(name)); else hidden++;
+ if (m && m.name) named.push(personHtml(m)); else hidden++;
});
if (hidden) named.push(hidden + ' with a hidden name');
return named.join(', ');
@@ -63,7 +74,7 @@
'" target="_blank" rel="noopener noreferrer">View on #BEmesh map';
var html = '';
if (c.owner) {
- html += row('Owner', (c.owner.name ? '@' + escapeHtml(String(c.owner.name)) : 'claimed') + link);
+ html += row('Owner', (c.owner.name ? personHtml(c.owner) : 'claimed') + link);
}
if (managers.length) html += row('Managers', managersText(managers) + (c.owner ? '' : link));
return html;
diff --git a/tests/unit/test-meshmap-owner.js b/tests/unit/test-meshmap-owner.js
index 2dadd3153..6f5856c6e 100644
--- a/tests/unit/test-meshmap-owner.js
+++ b/tests/unit/test-meshmap-owner.js
@@ -90,6 +90,28 @@ test('names are escaped', async () => {
assert(!h.includes('') && h.includes('<b>'), h);
});
+const DISCORD = 'https://discord.com/users/123456789012345678';
+
+test('a named person with a Discord profile gets their name as a link to it', async () => {
+ const l = load(feed([{ pubkey: PK, owner: { name: 'erwinfiten', discord: DISCORD },
+ managers: [{ name: 'amy', discord: 'https://discord.com/users/223456789012345678' }, { name: 'zed', discord: '' }] }]));
+ await l.M.ready();
+ const h = l.M.rowHtml({ public_key: PK });
+ assert(h.includes('@erwinfiten'), h);
+ assert(h.includes('users/223456789012345678" target="_blank"') && h.includes('@amy, @zed'), h);
+});
+
+test('only a discord.com/users address becomes a link', async () => {
+ const bad = ['javascript:alert(1)', 'https://evil.example/users/123456789012345678',
+ DISCORD + '">
', 'http://discord.com/users/123456789012345678', 'https://discord.com/users/abc'];
+ for (const url of bad) {
+ const l = load(feed([{ pubkey: PK, owner: { name: 'erwinfiten', discord: url }, managers: [] }]));
+ await l.M.ready();
+ const h = l.M.rowHtml({ public_key: PK });
+ assert(h.includes('@erwinfiten') && !h.includes('Message on Discord') && !h.includes('
{
const l = load(feed([node('erwinfiten')]));
await l.M.ready();