From 5495549464658646b9c1603b59bba0f661eb08ec Mon Sep 17 00:00:00 2001 From: lanxu Date: Sun, 3 Aug 2025 21:22:20 +0300 Subject: [PATCH] Fix matching bug with mastodon --- plugins/mastodon.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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