feat(writeapi): token generation/delete routes, ACP updates

This commit is contained in:
Julian Lam
2020-10-07 14:28:58 -04:00
parent 2928b9b87a
commit 2ec838fc59
7 changed files with 74 additions and 51 deletions

View File

@@ -169,6 +169,23 @@ Plugins.reload = async function () {
return { plugin, settings, quiet };
},
});
Plugins.registerHook('core', {
hook: 'filter:settings.get',
method: async ({ plugin, values }) => {
if (plugin === 'core.api' && Array.isArray(values.tokens)) {
values.tokens = values.tokens.map((tokenObj) => {
tokenObj.uid = parseInt(tokenObj.uid, 10);
if (tokenObj.timestamp) {
tokenObj.timestampISO = new Date(parseInt(tokenObj.timestamp, 10)).toISOString();
}
return tokenObj;
});
}
return { plugin, values };
},
});
// Lower priority runs earlier
Object.keys(Plugins.loadedHooks).forEach(function (hook) {