From 2f34e2a7d9791a1d1f45c94dd4828b11a7ec68dc Mon Sep 17 00:00:00 2001 From: Sam Therapy Date: Sun, 6 Feb 2022 12:28:08 -0600 Subject: [PATCH] Change API link to the usual v2 link Signed-off-by: Sam Therapy --- README.md | 2 +- index.js | 8 ++++---- lib/convertv2.js | 2 +- static/index.html | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c39da2e..2d04c06 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The homepage has a tool for generating iframe code for you, with a sensible `san ### V2 -#### GET `/apiv2/feed` +#### GET `/api/v2/feed` > example: `/api/feed?userurl=https%3A%2F%2Foctodon.social%2Fusers%2Ffenwick67&scale=90&theme=light` diff --git a/index.js b/index.js index fe22c01..bb27641 100644 --- a/index.js +++ b/index.js @@ -40,7 +40,7 @@ app.get('/api/feed',cors(),logger,function(req,res){ var userUrl = feedUrl.replace(/\.atom.*/i,''); - var redirectUrl = '/apiv2/feed?'; + var redirectUrl = '/api/v2/feed?'; var qs = ['userurl='+encodeURIComponent(userUrl),"api=v1"]; (['size','theme','boosts','replies']).forEach(key=>{ @@ -53,9 +53,9 @@ app.get('/api/feed',cors(),logger,function(req,res){ }); -app.options('/apiv2/feed',cors()); -// http://localhost:8000/apiv2/feed?userurl=https%3A%2F%2Foctodon.social%2Fusers%2Ffenwick67 -app.get('/apiv2/feed',cors(),logger,function(req,res){ +app.options('/api/v2/feed',cors()); +// http://localhost:8000/api/v2/feed?userurl=https%3A%2F%2Foctodon.social%2Fusers%2Ffenwick67 +app.get('/api/v2/feed',cors(),logger,function(req,res){ // get feed url var userUrl = req.query.userurl; diff --git a/lib/convertv2.js b/lib/convertv2.js index e97a1a6..f39410c 100644 --- a/lib/convertv2.js +++ b/lib/convertv2.js @@ -208,7 +208,7 @@ function getNextPage(opts,user,feed){ // take feed.next, uriencode it, then take user url, then take options.mastofeedUrl var base = opts.mastofeedUrl.slice(0,opts.mastofeedUrl.indexOf('?')); - var ret = '/apiv2/feed?userurl=' + encodeURIComponent(opts.userUrl) + '&feedurl=' +encodeURIComponent(feed.next); + var ret = '/api/v2/feed?userurl=' + encodeURIComponent(opts.userUrl) + '&feedurl=' +encodeURIComponent(feed.next); // add other params to the end (['theme','header','size','boosts','replies']).forEach((k)=>{ diff --git a/static/index.html b/static/index.html index f55a4c2..95a6cca 100644 --- a/static/index.html +++ b/static/index.html @@ -61,7 +61,7 @@

Live Preview:

+ src="/api/v2/feed?userurl=https%3A%2F%2Fmastodon.social%2Fusers%2Fgargron&replies=false&boosts=true">
@@ -79,7 +79,7 @@ var portStr = (window.location.port && window.location.port != 80) ? (':' + window.location.port) : '' var iframeUrl = window.location.protocol + '//' + window.location.hostname + portStr - + "/apiv2/feed?userurl=" + encodeURIComponent(inUrl) + "&theme=" + val('theme') + '&size=' + val('size') + + "/api/v2/feed?userurl=" + encodeURIComponent(inUrl) + "&theme=" + val('theme') + '&size=' + val('size') + "&header=" + showHeader + '&replies=' + showReplies + '&boosts=' + showBoosts; document.getElementById('result').value = '';