Change API link to the usual v2 link
Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
10720ac118
commit
2f34e2a7d9
4 changed files with 8 additions and 8 deletions
|
@ -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`
|
||||
|
||||
|
|
8
index.js
8
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;
|
||||
|
|
|
@ -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)=>{
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<h3>Live Preview:</h3>
|
||||
<span class="iframe-contain">
|
||||
<iframe id="frame" allowfullscreen sandbox="allow-top-navigation allow-scripts" width="400" height="800"
|
||||
src="/apiv2/feed?userurl=https%3A%2F%2Fmastodon.social%2Fusers%2Fgargron&replies=false&boosts=true"></iframe>
|
||||
src="/api/v2/feed?userurl=https%3A%2F%2Fmastodon.social%2Fusers%2Fgargron&replies=false&boosts=true"></iframe>
|
||||
</span>
|
||||
<br>
|
||||
</div>
|
||||
|
@ -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 = '<iframe allowfullscreen sandbox="allow-top-navigation allow-scripts" width="' + val('width') + '" height="' + val('height') + '" src="' + iframeUrl + '"></iframe>';
|
||||
|
|
Reference in a new issue