Add support for world/dependencies to external scriplets

To let community better experiment with potential candidate scriptlets
for inclusion in uBO itself.
This commit is contained in:
Raymond Hill 2023-05-28 12:42:47 -04:00
parent 82eee10c3a
commit 695b93f970
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 16 additions and 2 deletions

View File

@ -297,9 +297,23 @@ class RedirectEngine {
);
this.resources.set(name, RedirectEntry.fromDetails({ mime, data }));
if ( Array.isArray(details) ) {
const resource = this.resources.get(name);
for ( const { prop, value } of details ) {
if ( prop !== 'alias' ) { continue; }
this.aliases.set(value, name);
switch ( prop ) {
case 'alias':
this.aliases.set(value, name);
break;
case 'world':
if ( /^isolated$/i.test(value) === false ) { break; }
resource.world = 'ISOLATED';
break;
case 'dependency':
if ( this.resources.has(value) === false ) { break; }
resource.dependencies.push(value);
break;
default:
break;
}
}
}