Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(icon_packs): use note title isntead of manifest
Elian Doran13fff33aa407
diff --git a/apps/server/src/services/icon_packs.spec.ts b/apps/server/src/services/icon_packs.spec.tsindex 915dc1c997..03f6bd9c5f 100644--- a/apps/server/src/services/icon_packs.spec.ts+++ b/apps/server/src/services/icon_packs.spec.ts@@ -2,7 +2,6 @@ import { buildNote } from "../test/becca_easy_mocking";import { determineBestFontAttachment, generateCss, generateIconRegistry, IconPackManifest, processIconPack } from "./icon_packs";const manifest: IconPackManifest = {- name: "Boxicons v2",prefix: "bx",icons: {"bx-ball": {@@ -33,6 +32,7 @@ describe("Processing icon packs", () => {it("processes manifest", () => {const iconPack = processIconPack(buildNote({+ title: "Boxicons v2",type: "text",content: JSON.stringify(manifest),attachments: [ defaultAttachment ]@@ -111,7 +111,6 @@ describe("Mapping attachments", () => {describe("CSS generation", () => {it("generates the CSS", () => {const manifest: IconPackManifest = {- name: "Boxicons v2",prefix: "bx",icons: {"bx-ball": {@@ -126,6 +125,7 @@ describe("CSS generation", () => {};const processedResult = processIconPack(buildNote({type: "text",+ title: "Boxicons v2",content: JSON.stringify(manifest),attachments: [{@@ -153,6 +153,7 @@ describe("CSS generation", () => {describe("Icon registery", () => {it("generates the registry", () => {const iconPack = processIconPack(buildNote({+ title: "Boxicons v2",type: "text",content: JSON.stringify(manifest),attachments: [ defaultAttachment ]diff --git a/apps/server/src/services/icon_packs.ts b/apps/server/src/services/icon_packs.tsindex 09280f132f..851ca92a7f 100644--- a/apps/server/src/services/icon_packs.ts+++ b/apps/server/src/services/icon_packs.ts@@ -19,7 +19,6 @@ const MIME_TO_CSS_FORMAT_MAPPINGS: Record<typeof PREFERRED_MIME_TYPE[number], st};export interface IconPackManifest {- name: string;prefix: string;icons: Record<string, {glyph: string,@@ -31,6 +30,7 @@ interface ProcessResult {manifest: IconPackManifest;fontMime: string;fontAttachmentId: string;+ manifestNote: BNote;}export function getIconPacks() {@@ -42,7 +42,7 @@ export function getIconPacks() {export function generateIconRegistry(iconPacks: ProcessResult[]): IconRegistry {const sources: IconRegistry["sources"] = [];- for (const { manifest } of iconPacks) {+ for (const { manifest, manifestNote } of iconPacks) {const icons: IconRegistry["sources"][number]["icons"] = Object.entries(manifest.icons).map(( [id, { terms }] ) => {if (!id || !terms) return null;@@ -53,7 +53,7 @@ export function generateIconRegistry(iconPacks: ProcessResult[]): IconRegistry {sources.push({prefix: manifest.prefix,- name: manifest.name,+ name: manifestNote.title,icons});}@@ -77,7 +77,8 @@ export function processIconPack(iconPackNote: BNote): ProcessResult | undefinedreturn {manifest,fontMime: attachment.mime,- fontAttachmentId: attachment.attachmentId+ fontAttachmentId: attachment.attachmentId,+ manifestNote: iconPackNote};}