Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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"
}
Expand Down
29 changes: 26 additions & 3 deletions src/dashboard/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function generateHomepage (
store: IndexedFormula,
fetcher: Fetcher
): Promise<HTMLElement> {
const ownersProfile = await loadProfile(subject, fetcher)
const ownersProfile = await loadProfile(subject, store, fetcher)
const name = getName(store, ownersProfile)

const wrapper = document.createElement('div')
Expand Down Expand Up @@ -54,13 +54,36 @@ function createTitle (uri: string, name: string): HTMLElement {

async function loadProfile (
subject: NamedNode,
store: IndexedFormula,
fetcher: Fetcher
): Promise<NamedNode> {
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 {
Expand Down
Loading