diff --git a/.gitattributes b/.gitattributes index 49a9cc0..f2da781 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,3 +5,4 @@ Dockerfile text eol=lf *.png binary *.ico binary +*.ttf binary diff --git a/docs/API-NOTES.md b/docs/API-NOTES.md index 7a5a863..a7ebd94 100644 --- a/docs/API-NOTES.md +++ b/docs/API-NOTES.md @@ -213,3 +213,11 @@ Quando la fase indicata aggiunge il pacchetto, il nome entra nell'elenco del tes - `mcr.microsoft.com/dotnet/sdk:10.0` (SDK 10.0.403) e `mcr.microsoft.com/dotnet/aspnet:10.0` (runtime 10.0.14) esistono. Dal .NET 10 il tag `10.0` usa **Ubuntu 24.04 "noble"**, non Debian. Non esiste un tag Debian stabile. - `libgomp1` non è nelle immagini, ma si installa da Ubuntu "main" con `apt-get install -y --no-install-recommends libgomp1`. Si aggiunge nella Fase 8, insieme a LightGBM. - Fonti: https://mcr.microsoft.com/v2/dotnet/aspnet/tags/list · https://github.com/dotnet/dotnet-docker/blob/main/manifest.json · https://packages.ubuntu.com/noble/libgomp1 + +## Carattere + +- **Instrument Sans**, di Rodrigo Fuenzalida e Jordan Egstad, licenza SIL OFL 1.1 (ammesso dall'ADR 0004). Scaricato il 10/11/2026 con il permesso dell'utente, dalla raccolta ufficiale di Google Fonts. +- File: `InstrumentSans[wdth,wght].ttf`, 194.336 byte, SHA-256 `b24f1812584816958afcf22e22d08e44318c5e51651e25d2438efdde389b33b1`. È un solo file variabile con pesi da 400 a 700. Nel repository si chiama `src/Anubis.Server/Assets/InstrumentSans.ttf`. +- La licenza è accanto al file, in `InstrumentSans-OFL.txt`, e l'applicazione la serve su `/assets/InstrumentSans-OFL.txt`. +- La versione corsiva non è inclusa: l'interfaccia quasi non la usa, e il browser la ricava dal carattere normale. +- Fonte: https://github.com/google/fonts/tree/main/ofl/instrumentsans diff --git a/docs/STATE.md b/docs/STATE.md index adf296b..c8aeed4 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -44,6 +44,7 @@ Aggiornato: 2026-11-10 - Modalità dimostrativa (`tasks seed-demo`) con i dati dell'appendice F, in un database a parte. - Immagine Docker definitiva: `PUID`/`PGID`, controllo di salute, l'applicazione non gira come root. Provata con SQLite, PostgreSQL, configurazione sbagliata e database staccato. - `tasks screenshots` per confrontare le schermate con i mockup. + - Dopo la chiusura, con il permesso dell'utente: carattere Instrument Sans incluso nell'applicazione (ADR 0007, punto 5). ## In corso @@ -68,7 +69,6 @@ Fase 2, dati di mercato: storico e dati dal vivo, controlli di qualità, cambi d | Cosa | Da quando serve | Senza | |---|---|---| | Via libera per la Fase 2 | Subito | Non si parte | -| Permesso di scaricare il carattere Instrument Sans (licenza SIL OFL, già ammesso dall'ADR 0004) | Quando vuoi | L'interfaccia usa i caratteri di sistema | | Chiavi del conto paper di Alpaca | Fase 2 (dati azionari) | La parte azionaria si prova su dati sintetici; criteri in attesa | | Chiavi demo di OKX Europe | Fase 3 (ordini sui conti di prova) | Batteria di conformità su risposte d'esempio; criteri in attesa | | Un token Gitea con permesso `write:package` come segreto `REGISTRY_TOKEN` | Fase 9 (pubblicazione dell'immagine) | Pubblicazione a mano | diff --git a/docs/adr/0004-componenti-esterni.md b/docs/adr/0004-componenti-esterni.md index 1667079..516a8f7 100644 --- a/docs/adr/0004-componenti-esterni.md +++ b/docs/adr/0004-componenti-esterni.md @@ -1,6 +1,6 @@ # 0004 — Nessun SDK o componente esterno senza il permesso dell'utente -Data: 2026-11-09 · Stato: accettata · Precisata dagli ADR 0006 (MSTest tramite i suoi pacchetti di base; `libgomp1` nella Fase 8) e 0007 (`ProtectedData` dalla Fase 1; carattere di sistema finché Instrument Sans non è scaricato) +Data: 2026-11-09 · Stato: accettata · Precisata dagli ADR 0006 (MSTest tramite i suoi pacchetti di base; `libgomp1` nella Fase 8) e 0007 (`ProtectedData` dalla Fase 1; Instrument Sans scaricato il 10/11/2026) ## Contesto diff --git a/docs/adr/0007-scelte-fase-1.md b/docs/adr/0007-scelte-fase-1.md index 0157106..f4aace8 100644 --- a/docs/adr/0007-scelte-fase-1.md +++ b/docs/adr/0007-scelte-fase-1.md @@ -40,7 +40,11 @@ La Fase 1 costruisce le fondamenta: piattaforma, database su due motori, accesso - Fogli di stile, script e logo sono risorse incluse nella DLL. Il logo arriva solo da `docs/design/logo` (ADR 0005). - Le chiavi dei gettoni dei moduli stanno in `web-keys/`, nella cartella dei dati, così un riavvio non rompe le pagine aperte. Sono salvate senza cifratura, ma la cartella dei dati è leggibile solo dall'utente dell'applicazione. -**5. Carattere di sistema, per ora.** L'ADR 0004 ammette Instrument Sans incluso nell'applicazione. Scaricarlo richiede il permesso dell'utente. Finché non arriva, il foglio di stile lo nomina per primo e ripiega sui caratteri di sistema (Segoe UI su Windows, il sans-serif di sistema altrove). +**5. Instrument Sans incluso nell'applicazione.** +- L'ADR 0004 ammette Instrument Sans. L'utente ha dato il permesso di scaricarlo il 10/11/2026, dopo la chiusura della fase. Fino ad allora l'interfaccia usava i caratteri di sistema. +- Il file sta in `src/Anubis.Server/Assets/`, con accanto la sua licenza. L'applicazione lo serve da sé e non lo carica mai da internet. Provenienza e impronta sono in `docs/API-NOTES.md`. +- C'è un solo file variabile, solo in versione normale. Se il file non arriva, il foglio di stile ripiega sui caratteri di sistema. +- Instrument Sans è un po' più largo del carattere di sistema. Nella barra superiore etichette e pulsanti passano a 13 px, come nel mockup, così la riga con la data resta intera a 1440 px. **6. Modalità dimostrativa.** - `--demo` crea una cartella dei dati nuova in quella temporanea, con un database SQLite proprio, e non legge mai la configurazione vera. @@ -100,6 +104,5 @@ La Fase 1 costruisce le fondamenta: piattaforma, database su due motori, accesso ## Conseguenze - Ogni fase che aggiunge tabelle scrive una nuova migrazione con gli stessi segni, e la prova su entrambi i motori. -- Quando l'utente dà il permesso di scaricare Instrument Sans, i file vanno in `src/Anubis.Server/Assets/` e nel foglio di stile. - Chi apre la modalità dimostrativa vede solo le parti costruite fino a quella fase. - Il WebSocket dello stato non si chiude quando si esce: manda solo lo stato del bot e la freschezza dei dati, e si chiude alla prima riconnessione. Da rivedere quando porterà dati più ricchi. diff --git a/src/Anubis.Server/Assets/InstrumentSans-OFL.txt b/src/Anubis.Server/Assets/InstrumentSans-OFL.txt new file mode 100644 index 0000000..26bd2f9 --- /dev/null +++ b/src/Anubis.Server/Assets/InstrumentSans-OFL.txt @@ -0,0 +1,93 @@ +Copyright 2022 The Instrument Sans Project Authors (https://github.com/Instrument/instrument-sans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/src/Anubis.Server/Assets/InstrumentSans.ttf b/src/Anubis.Server/Assets/InstrumentSans.ttf new file mode 100644 index 0000000..3589b81 Binary files /dev/null and b/src/Anubis.Server/Assets/InstrumentSans.ttf differ diff --git a/src/Anubis.Server/Assets/app.css b/src/Anubis.Server/Assets/app.css index 8fa9166..f72ad25 100644 --- a/src/Anubis.Server/Assets/app.css +++ b/src/Anubis.Server/Assets/app.css @@ -79,7 +79,16 @@ } } -/* Instrument Sans when installed; the file served by the app arrives once its licence and download are approved (ADR 0007). */ +/* Instrument Sans served by the app itself, never from the internet (ADR 0004, SIL OFL: assets/InstrumentSans-OFL.txt). + One variable file covers weights 400 to 700; italics are drawn by the browser from it. */ +@font-face { + font-family: "Instrument Sans"; + src: url("/assets/InstrumentSans.ttf") format("truetype"); + font-weight: 400 700; + font-style: normal; + font-display: swap; +} + :root { --font: "Instrument Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif; color-scheme: light dark; @@ -162,6 +171,8 @@ code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-siz .topbar-actions { flex-wrap: wrap; } } .topbar-actions form { margin: 0; } +/* As in the mockup: one point smaller up here, so the date line keeps its full length at 1440 px. */ +.topbar-actions .pill, .topbar-actions .btn, .topbar-actions .currency select { font-size: 13px; } .phone-brand, .phone-bot, .mode-band, .bottombar { display: none; } .pill { diff --git a/src/Anubis.Server/Endpoints.cs b/src/Anubis.Server/Endpoints.cs index 0c9ce1f..4d3c8cc 100644 --- a/src/Anubis.Server/Endpoints.cs +++ b/src/Anubis.Server/Endpoints.cs @@ -87,6 +87,8 @@ internal static partial class Endpoints ".ico" => "image/x-icon", ".css" => "text/css; charset=utf-8", ".js" => "text/javascript; charset=utf-8", + ".ttf" => "font/ttf", + ".txt" => "text/plain; charset=utf-8", _ => "application/octet-stream", }; return Results.Stream(stream, type); diff --git a/tests/Anubis.Tests/ServerTests.cs b/tests/Anubis.Tests/ServerTests.cs index 103d021..1d08971 100644 --- a/tests/Anubis.Tests/ServerTests.cs +++ b/tests/Anubis.Tests/ServerTests.cs @@ -422,6 +422,15 @@ public sealed class ServerTests CollectionAssert.AreEqual(await File.ReadAllBytesAsync(Path.Combine(Repo.Root.FullName, "docs", "design", "logo", "anubis.svg")), served); Assert.Contains("frame-ancestors 'none'", logo.Headers.GetValues("Content-Security-Policy").Single()); Assert.AreEqual("nosniff", logo.Headers.GetValues("X-Content-Type-Options").Single()); + + // The typeface travels with the app, with its licence beside it (ADR 0004). + using var font = await server.GetAsync("/assets/InstrumentSans.ttf"); + Assert.AreEqual(HttpStatusCode.OK, font.StatusCode); + Assert.AreEqual("font/ttf", font.Content.Headers.ContentType!.MediaType); + var fontPath = Path.Combine(Repo.Root.FullName, "src", "Anubis.Server", "Assets", "InstrumentSans.ttf"); + CollectionAssert.AreEqual(await File.ReadAllBytesAsync(fontPath), await font.Content.ReadAsByteArrayAsync()); + StringAssert.Contains(await server.TextAsync("/assets/InstrumentSans-OFL.txt"), "SIL Open Font License, Version 1.1"); + StringAssert.Contains(await server.TextAsync("/assets/app.css"), "url(\"/assets/InstrumentSans.ttf\")"); } [TestMethod]