Keep the origin from the project meta tag around. For sb2s, make it always empty.

This commit is contained in:
picklesrus 2021-02-10 16:14:36 -05:00
parent adb9c56f53
commit 26ff6d7265
5 changed files with 21 additions and 2 deletions

View file

@ -238,6 +238,9 @@ module.exports = function (project, callback) {
// Extensions
meta.extensions = extensions(project);
// Metadata is only in sb3s so just fill in an empty object.
meta.meta = {};
// Return all metadata
return callback(null, meta);
};

View file

@ -125,6 +125,12 @@ const extensions = function (list) {
};
};
const metadata = function (meta) {
return {
origin: meta.origin ? meta.origin : ''
};
};
module.exports = function (project, callback) {
const meta = {
scripts: scripts(project.targets),
@ -136,7 +142,8 @@ module.exports = function (project, callback) {
costumes: extract(project.targets, 'costumes', 'name', 'md5ext'),
sprites: sprites(project.targets),
blocks: blocks(project.targets),
extensions: extensions(project.extensions)
extensions: extensions(project.extensions),
meta: metadata(project.meta)
};
callback(null, meta);

View file

@ -98,6 +98,7 @@
"meta": {
"semver": "3.0.0",
"vm": "0.2.0-prerelease.20181217191056",
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
"agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36",
"origin": "test.scratch.mit.edu"
}
}

View file

@ -69,6 +69,9 @@ test('defalt (object)', t => {
t.equal(result.extensions.count, 0);
t.deepEqual(result.extensions.id, []);
t.type(result.meta, 'object');
t.deepEqual(result.meta, {});
t.end();
});
});

View file

@ -75,6 +75,8 @@ test('defalt (object)', t => {
t.equal(result.extensions.count, 0);
t.deepEqual(result.extensions.id, []);
t.type(result.meta, 'object');
t.equal(result.meta.origin, 'test.scratch.mit.edu');
t.end();
});
});
@ -137,6 +139,9 @@ test('defalt (binary)', t => {
t.equal(result.extensions.count, 0);
t.deepEqual(result.extensions.id, []);
t.type(result.meta, 'object');
t.equal(result.meta.origin, '');
t.end();
});
});