1
1
/*
2
2
Copied from mashlib/src/global/metadata.ts
3
3
*/
4
- import { IndexedFormula , LiveStore , NamedNode , sym } from 'rdflib'
4
+ import { IndexedFormula , LiveStore , NamedNode , parse , sym } from 'rdflib'
5
5
import { ns } from '..'
6
6
import { styleMap as headerStyleMap } from '../header/styleMap'
7
7
import { styleMap as footerStyleMap } from '../footer/styleMap'
@@ -48,8 +48,12 @@ export async function getPodOwner (pod: NamedNode, store: LiveStore): Promise<Na
48
48
// const podOwner = sym(`${pod.uri}profile/card#me`)
49
49
/* eslint-disable no-console */
50
50
try {
51
- // @ts -ignore LiveStore always has fetcher
52
- store . fetcher . load ( pod )
51
+ // load turtle Container representation
52
+ if ( ! store . any ( pod , null , ns . ldp ( 'Container' ) , pod ) ) {
53
+ const response = await store . fetcher . webOperation ( 'GET' , pod . uri , store . fetcher . initFetchOptions ( pod . uri , { headers : { accept : 'text/turtle' } } ) )
54
+ const containerTurtle = response . responseText
55
+ parse ( containerTurtle as string , store , pod . uri , 'text/turtle' )
56
+ }
53
57
} catch ( err ) {
54
58
console . error ( 'Error loading pod ' + pod + ': ' + err )
55
59
return null
@@ -62,8 +66,7 @@ export async function getPodOwner (pod: NamedNode, store: LiveStore): Promise<Na
62
66
store . any ( null , ns . space ( 'storage' ) , pod , pod )
63
67
if ( podOwner ) {
64
68
try {
65
- // @ts -ignore LiveStore always has fetcher
66
- store . fetcher . load ( podOwner . doc ( ) )
69
+ store . fetcher . load ( ( podOwner as NamedNode ) . doc ( ) )
67
70
} catch ( err ) {
68
71
console . warn ( 'Unable to load profile of pod owner ' + podOwner )
69
72
return null
0 commit comments