From 3cdf4dac45da699df15459dbc68cf10035c430a7 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Wed, 8 Nov 2023 20:55:38 +0200 Subject: [PATCH] mastodon detection nonsense --- squeebot.repo.json | 2 +- url-fediverse/plugin.json | 2 +- url-fediverse/plugin.ts | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/squeebot.repo.json b/squeebot.repo.json index 292697c..3e0c8b9 100644 --- a/squeebot.repo.json +++ b/squeebot.repo.json @@ -27,7 +27,7 @@ }, { "name": "url-fediverse", - "version": "1.0.3" + "version": "1.0.4" }, { "name": "url-peertube", diff --git a/url-fediverse/plugin.json b/url-fediverse/plugin.json index c521606..e407e2a 100644 --- a/url-fediverse/plugin.json +++ b/url-fediverse/plugin.json @@ -2,7 +2,7 @@ "main": "plugin.js", "name": "url-fediverse", "description": "URLReply Fediverse", - "version": "1.0.3", + "version": "1.0.4", "tags": ["urlreply"], "dependencies": ["urlreply"], "npmDependencies": [] diff --git a/url-fediverse/plugin.ts b/url-fediverse/plugin.ts index edc368a..af2db15 100644 --- a/url-fediverse/plugin.ts +++ b/url-fediverse/plugin.ts @@ -114,12 +114,13 @@ class FediResponsePlugin extends Plugin { if (type === 'Pleroma') { pass = true; } else { - const tag = body('a[href="https://joinmastodon.org/"]'); + const tag = body('a[href="https://joinmastodon.org"]'); + const initTag = body('head > script[id="initial-state"][type="application/json"]'); if ( - tag && + initTag || (tag && tag.text() && ((tag.text() as string).includes('Mastodon') || - (tag.text() as string).includes('About')) + (tag.text() as string).includes('About'))) ) { pass = true; }