diff --git a/plugins/mastodon.js b/plugins/mastodon.js index cb0bab2..38f5060 100644 --- a/plugins/mastodon.js +++ b/plugins/mastodon.js @@ -3,22 +3,22 @@ var requestPromise = require('./helpers/requestPromise.js') var BasePlugin = require('./base.js') var htmlToText = require('html-to-text') class Mastodon extends BasePlugin { - constructor (config) { + constructor(config) { super(config) this.name = 'Mastodon' } - test (input) { - if (input.match(/http(s)?:\/\/(www\.)?((.*\..*\/users\/([a-zA-Z0-9_-]*)\/statuses\/([0-9_-]*)))/)) { + test(input) { + if (input.match(/http(s)?:\/\/(www\.)?((.*\..*\/users\/([a-zA-Z0-9_-]*)\/statuses\/([0-9_-]*)))$/)) { return true } - if (input.match(/http(s)?:\/\/(www\.)?(((.*\..*)\/@([a-zA-Z0-9_-]*)\/([0-9_-]*)))/)) { + if (input.match(/http(s)?:\/\/(www\.)?(((.*\..*)\/@([a-zA-Z0-9_-]*)\/([0-9_-]*)))$/)) { return true } return false } - getToot (host, statusId) { + getToot(host, statusId) { var promise = new Promise(function (resolve, reject) { var url = 'https://' + host + '/api/v1/statuses/' + statusId requestPromise(url, {}, { @@ -49,7 +49,7 @@ class Mastodon extends BasePlugin { return promise } - result (input) { + result(input) { var that = this var resultPromise = new Promise(function (resolve, reject) { var host = null