feat(manager): the venue's identity (Settings -> Identity): name, slogan, named colours, logos, guest Wi-Fi, contact details
Set once (GET/PUT /api/identity, venue.name + venue.identity); every colour field offers the venue's colours first (VenueColoursProvider in @xenia/ui); signage screens get the identity and the venue's time zone with their venue and are told on a change; logos are protected in the media library; wifiQr() for the join-the-network code. Plan 6R.14, F-111. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -508,3 +508,14 @@ export function shapeName(w, h) {
|
||||
const d = g(Math.round(w), Math.round(h)) || 1
|
||||
return `${Math.round(w) / d}:${Math.round(h) / d}`
|
||||
}
|
||||
|
||||
// ── the venue's identity (6R.14) ──────────────────────────────────────────────
|
||||
|
||||
/** The text of a QR code that joins a Wi-Fi network ("WIFI:T:WPA;S:…;P:…;;"), or '' without a network name. */
|
||||
export function wifiQr(wifi) {
|
||||
if (!wifi?.ssid) return ''
|
||||
const esc = v => String(v).replace(/([\;,:"])/g, '\$1')
|
||||
const sec = wifi.security === 'nopass' ? 'nopass' : wifi.security === 'WEP' ? 'WEP' : 'WPA'
|
||||
const pw = sec !== 'nopass' && wifi.password ? `P:${esc(wifi.password)};` : ''
|
||||
return `WIFI:T:${sec};S:${esc(wifi.ssid)};${pw}${wifi.hidden ? 'H:true;' : ''};`
|
||||
}
|
||||
|
||||
@@ -270,3 +270,10 @@ test('slide shapes: custom ratios, the canvas, the box a slide keeps on any scre
|
||||
assert.equal(shapeName(1920, 1200), '16:10')
|
||||
assert.equal(shapeName(1000, 300), '10:3')
|
||||
})
|
||||
|
||||
test('a Wi-Fi QR code: escaped, open networks without a password, hidden ones (6R.14)', async () => {
|
||||
const { wifiQr } = await import('../src/logic.js')
|
||||
assert.equal(wifiQr({ ssid: 'Xenia Guests', password: 'a;b:c', security: 'WPA' }), 'WIFI:T:WPA;S:Xenia Guests;P:a\;b\:c;;')
|
||||
assert.equal(wifiQr({ ssid: 'Open', password: 'x', security: 'nopass', hidden: true }), 'WIFI:T:nopass;S:Open;H:true;;')
|
||||
assert.equal(wifiQr({ password: 'x' }), '')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user