feature: don't create federation when there is only one target
This commit is contained in:
parent
8c860e07aa
commit
6d52e869d1
@ -113,15 +113,20 @@ for component of components
|
||||
for(const [attribute, path] of Object.entries(component.parameters)) {
|
||||
if(typeof path === 'string') {
|
||||
if(path.startsWith('federation://')) {
|
||||
federations[`store://local.${component.uniq}/${attribute}/`] = {
|
||||
"@cache": "false",
|
||||
"@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld",
|
||||
"@type": "ldp:Container",
|
||||
"@id": `store://local.${component.uniq}/${attribute}/`,
|
||||
"ldp:contains": generateUrl(federation, path),
|
||||
"permissions": [{"mode": {"@type": "view"}}]
|
||||
};
|
||||
component.parameters[attribute] = `store://local.${component.uniq}/${attribute}/`;
|
||||
let contains = generateUrl(federation, path);
|
||||
if(contains.length > 1) {
|
||||
federations[`store://local.${component.uniq}/${attribute}/`] = {
|
||||
"@cache": "false",
|
||||
"@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld",
|
||||
"@type": "ldp:Container",
|
||||
"@id": `store://local.${component.uniq}/${attribute}/`,
|
||||
"ldp:contains": contains,
|
||||
"permissions": [{"mode": {"@type": "view"}}]
|
||||
};
|
||||
component.parameters[attribute] = `store://local.${component.uniq}/${attribute}/`;
|
||||
} else {
|
||||
component.parameters[attribute] = federation.values().next().value + path.replace(/federation:\//, '');
|
||||
}
|
||||
}
|
||||
if(path.startsWith('server://')) {
|
||||
component.parameters[attribute] = client.server + path.replace(/server:\//, '');
|
||||
@ -163,15 +168,20 @@ for component of components
|
||||
for(const [attribute, path] of Object.entries(extension.parameters)) {
|
||||
if(typeof path === 'string') {
|
||||
if(path.startsWith('federation://')) {
|
||||
federations[`store://local.${extension.uniq}/${attribute}/`] = {
|
||||
"@cache": "false",
|
||||
"@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld",
|
||||
"@type": "ldp:Container",
|
||||
"@id": `store://local.${extension.uniq}/${attribute}/`,
|
||||
"ldp:contains": generateUrl(federation, path),
|
||||
"permissions": [{"mode": {"@type": "view"}}]
|
||||
};
|
||||
extension.parameters[attribute] = `store://local.${extension.uniq}/${attribute}/`;
|
||||
let contains = generateUrl(federation, path);
|
||||
if(contains.length > 1) {
|
||||
federations[`store://local.${extension.uniq}/${attribute}/`] = {
|
||||
"@cache": "false",
|
||||
"@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld",
|
||||
"@type": "ldp:Container",
|
||||
"@id": `store://local.${extension.uniq}/${attribute}/`,
|
||||
"ldp:contains": contains,
|
||||
"permissions": [{"mode": {"@type": "view"}}]
|
||||
};
|
||||
extension.parameters[attribute] = `store://local.${extension.uniq}/${attribute}/`;
|
||||
} else {
|
||||
component.parameters[attribute] = federation.values().next().value + path.replace(/federation:\//, '');
|
||||
}
|
||||
}
|
||||
if(path.startsWith('server://')) {
|
||||
extension.parameters[attribute] = client.server + path.replace(/server:\//, '');
|
||||
|
Loading…
Reference in New Issue
Block a user