24 lines
699 B
JavaScript
24 lines
699 B
JavaScript
'use strict';
|
|
|
|
// First-party registration only; never load executable source code from a
|
|
// remote catalog or scan a writable directory for modules.
|
|
const adapters = Object.freeze([
|
|
require('../sources/weebcentral'),
|
|
require('../sources/mangadex'),
|
|
]);
|
|
const { adapterForPeer } = require('../../peering/adapter');
|
|
|
|
function adapterFor(url) {
|
|
const peer = adapterForPeer(url);
|
|
if (peer) return peer;
|
|
for (const adapter of adapters) {
|
|
const info = adapter.match(url);
|
|
if (info) return { adapter, info };
|
|
}
|
|
return null;
|
|
}
|
|
|
|
module.exports = { adapters, adapterFor,
|
|
weebCentralInfo: require('./weebcentral').weebCentralInfo,
|
|
mangaDexInfo: require('./mangadex').mangaDexInfo };
|