From a4762da6bd99606cd2af6de28437356c0a11d957 Mon Sep 17 00:00:00 2001 From: Alain Bourgeois Date: Sun, 15 Feb 2026 16:59:00 +0100 Subject: [PATCH] check for WebID --- package-lock.json | 24 ++++++++++++------------ package.json | 6 +++--- src/dashboard/homepage.ts | 29 ++++++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8aafc2a0..178c2678 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "meeting-pane": "^3.0.1", "mime-types": "^3.0.2", "pane-registry": "^3.0.1", - "profile-pane": "^3.1.0", + "profile-pane": "^3.1.1", "solid-namespace": "^0.5.4", "source-pane": "^3.0.1" }, @@ -53,13 +53,13 @@ "rdflib": "^2.3.5", "react": "^19.2.4", "react-dom": "^19.2.4", - "solid-logic": "^4.0.2", + "solid-logic": "^4.0.3", "solid-ui": "^3.0.4", "style-loader": "^4.0.0", "ts-jest": "^29.4.6", "ts-loader": "^9.5.4", "typescript": "^5.9.3", - "webpack": "^5.105.1", + "webpack": "^5.105.2", "webpack-cli": "^6.0.1", "webpack-dev-server": "^5.2.3" } @@ -13538,9 +13538,9 @@ "license": "MIT" }, "node_modules/profile-pane": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/profile-pane/-/profile-pane-3.1.0.tgz", - "integrity": "sha512-g2G80qwzTzxSlACKc5Z8S5IvqYAHNvv0tO6v6wIUzIWnD5+letycJtN0E3qw0yVg8G6OtcQol0l5QB9xsym10w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/profile-pane/-/profile-pane-3.1.1.tgz", + "integrity": "sha512-ufm58BbDFNQEPLJwcmc2CxcgTD8AHrHtPaEQ5znz/xTxpSLF8gCagAgo+TnIxq0iUlbtia9UvYYtwO2hpaGLoQ==", "license": "MIT", "dependencies": { "lit-html": "^3.3.2", @@ -15064,9 +15064,9 @@ } }, "node_modules/solid-logic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/solid-logic/-/solid-logic-4.0.2.tgz", - "integrity": "sha512-B87MiOkYEyIN0lVFbqzHh//qrjg+T4Tvo+McmsTXVSPLgctdQbxPOqjSlrRwVSsUgPdY+XlU61cJco4xdY/YZg==", + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/solid-logic/-/solid-logic-4.0.3.tgz", + "integrity": "sha512-mJuLiCBS+KiM2G5WeDt7w8jwU6sxaU0boIUVRA9zAZz/xh2G2FXOapQ4OwlRdR/EsloULeaNZDbyL44OoHQ9DQ==", "license": "MIT", "dependencies": { "@inrupt/solid-client-authn-browser": "^3.1.0", @@ -16755,9 +16755,9 @@ } }, "node_modules/webpack": { - "version": "5.105.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.1.tgz", - "integrity": "sha512-Gdj3X74CLJJ8zy4URmK42W7wTZUJrqL+z8nyGEr4dTN0kb3nVs+ZvjbTOqRYPD7qX4tUmwyHL9Q9K6T1seW6Yw==", + "version": "5.105.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.2.tgz", + "integrity": "sha512-dRXm0a2qcHPUBEzVk8uph0xWSjV/xZxenQQbLwnwP7caQCYpqG1qddwlyEkIDkYn0K8tvmcrZ+bOrzoQ3HxCDw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 682ce7a1..05368c76 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "meeting-pane": "^3.0.1", "mime-types": "^3.0.2", "pane-registry": "^3.0.1", - "profile-pane": "^3.1.0", + "profile-pane": "^3.1.1", "solid-namespace": "^0.5.4", "source-pane": "^3.0.1" }, @@ -107,13 +107,13 @@ "rdflib": "^2.3.5", "react": "^19.2.4", "react-dom": "^19.2.4", - "solid-logic": "^4.0.2", + "solid-logic": "^4.0.3", "solid-ui": "^3.0.4", "style-loader": "^4.0.0", "ts-jest": "^29.4.6", "ts-loader": "^9.5.4", "typescript": "^5.9.3", - "webpack": "^5.105.1", + "webpack": "^5.105.2", "webpack-cli": "^6.0.1", "webpack-dev-server": "^5.2.3" } diff --git a/src/dashboard/homepage.ts b/src/dashboard/homepage.ts index bc64e9dc..360477f0 100644 --- a/src/dashboard/homepage.ts +++ b/src/dashboard/homepage.ts @@ -6,7 +6,7 @@ export async function generateHomepage ( store: IndexedFormula, fetcher: Fetcher ): Promise { - const ownersProfile = await loadProfile(subject, fetcher) + const ownersProfile = await loadProfile(subject, store, fetcher) const name = getName(store, ownersProfile) const wrapper = document.createElement('div') @@ -54,13 +54,36 @@ function createTitle (uri: string, name: string): HTMLElement { async function loadProfile ( subject: NamedNode, + store: IndexedFormula, fetcher: Fetcher ): Promise { const pod = subject.site().uri // TODO: This is a hack - we cannot assume that the profile is at this document, but we will live with it for now const webId = sym(`${pod}profile/card#me`) - await fetcher.load(webId) - return webId + try { + await fetcher.load(webId) + return webId + } catch (err) { + // Fall back to pod root and any discovered profile links. + } + + try { + await fetcher.load(subject) + } catch (err) { + return subject + } + + const primaryTopic = store.any(subject, ns.foaf('primaryTopic'), null, subject.doc()) + if (primaryTopic && primaryTopic.termType === 'NamedNode') { + try { + await fetcher.load(primaryTopic as NamedNode) + return primaryTopic as NamedNode + } catch (err) { + return subject + } + } + + return subject } function getName (store: IndexedFormula, ownersProfile: NamedNode): string {