2020-10-24 07:11:14 -06:00
|
|
|
/*
|
|
|
|
Copyright 2020 Yarmo Mackenbach
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
2020-10-24 11:10:28 -06:00
|
|
|
exports.list = [
|
2020-10-23 17:25:01 -06:00
|
|
|
'dns',
|
|
|
|
'xmpp',
|
2020-10-24 07:33:51 -06:00
|
|
|
'twitter',
|
2020-10-24 07:50:14 -06:00
|
|
|
'hackernews',
|
2020-10-23 17:25:01 -06:00
|
|
|
]
|
|
|
|
|
2020-10-24 11:10:28 -06:00
|
|
|
exports.data = {
|
2020-10-23 17:25:01 -06:00
|
|
|
dns: require('./serviceproviders/dns'),
|
2020-10-24 07:33:51 -06:00
|
|
|
xmpp: require('./serviceproviders/xmpp'),
|
|
|
|
twitter: require('./serviceproviders/twitter'),
|
2020-10-24 07:50:14 -06:00
|
|
|
hackernews: require('./serviceproviders/hackernews'),
|
2020-10-23 17:25:01 -06:00
|
|
|
}
|
2020-10-24 11:10:28 -06:00
|
|
|
|
|
|
|
exports.match = (uri) => {
|
|
|
|
let matches = [], sp
|
|
|
|
|
|
|
|
serviceprovidersList.forEach((spName, i) => {
|
|
|
|
sp = serviceproviders[spName]
|
|
|
|
if (sp.reURI.test(uri)) {
|
|
|
|
matches.push(sp.processURI(uri))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
return matches
|
|
|
|
}
|