temp fix for pleroma urls

This commit is contained in:
Evert Prants 2021-04-23 13:39:12 +03:00
parent 344cf309d6
commit 1ee60d9dd3
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@
}, },
{ {
"name": "url-fediverse", "name": "url-fediverse",
"version": "1.0.0" "version": "1.0.1"
}, },
{ {
"name": "url-peertube", "name": "url-peertube",

View File

@ -2,7 +2,7 @@
"main": "plugin.js", "main": "plugin.js",
"name": "url-fediverse", "name": "url-fediverse",
"description": "URLReply Fediverse", "description": "URLReply Fediverse",
"version": "1.0.0", "version": "1.0.1",
"tags": ["urlreply"], "tags": ["urlreply"],
"dependencies": ["urlreply"], "dependencies": ["urlreply"],
"npmDependencies": [] "npmDependencies": []

View File

@ -24,7 +24,7 @@ async function mastodonResponse(msg: IMessage, url: string, type = 'Mastodon'):
try { try {
data = await httpGET(url2go); data = await httpGET(url2go);
if (!data) { if (!data) {
throw new Error('No API response, probably not ' + type + ' after all.') throw new Error('No API response, probably not ' + type + ' after all.');
} }
data = JSON.parse(data); data = JSON.parse(data);
} catch (e) { } catch (e) {
@ -72,7 +72,7 @@ class FediResponsePlugin extends Plugin {
addUrlReply(urlreply: any): void { addUrlReply(urlreply: any): void {
urlreply.registerHandler(this.name, 'html/mastodon', urlreply.registerHandler(this.name, 'html/mastodon',
async (url: string, msg: IMessage, title: string, body: any): Promise<boolean> => { async (url: string, msg: IMessage, title: string, body: any): Promise<boolean> => {
const type = title === 'Pleroma' ? 'Pleroma' : 'Mastodon'; const type = url.match('/notice/') ? 'Pleroma' : 'Mastodon';
let pass = false; let pass = false;
if (type === 'Pleroma') { if (type === 'Pleroma') {