diff --git a/index.js b/index.js index 0e4abd35..749dea2b 100644 --- a/index.js +++ b/index.js @@ -45,6 +45,7 @@ export async function start ({port, configDir, domain}) { app.get('/signup', staticFile('static/index.html')) app.get('/forgot-password', staticFile('static/index.html')) app.get('/notifications', staticFile('static/index.html')) + app.get('/follow-only', staticFile('static/index.html')) app.get('/communities', staticFile('static/index.html')) app.get('/account', staticFile('static/index.html')) app.get('/profile', staticFile('static/index.html')) diff --git a/static/js/app.js b/static/js/app.js index 30e564cb..3d644f7c 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -104,8 +104,9 @@ class CtznApp extends LitElement { case '/index': case '/index.html': case '/notifications': + case '/follow-only': case '/search': - gestures.setCurrentNav(['/', '/notifications', '/search']) + gestures.setCurrentNav(['/', '/notifications', '/search', '/follow-only']) return case '/communities': gestures.setCurrentNav([{back: true}, '/communities']) @@ -163,6 +164,7 @@ class CtznApp extends LitElement { case '/index': case '/index.html': case '/notifications': + case '/follow-only': case '/search': case '/activity': return html`` diff --git a/static/js/ctzn-tags/posts-feed.js b/static/js/ctzn-tags/posts-feed.js index 7373ca18..592a32e5 100644 --- a/static/js/ctzn-tags/posts-feed.js +++ b/static/js/ctzn-tags/posts-feed.js @@ -18,7 +18,8 @@ export class PostsFeed extends LitElement { limit: {type: Number}, results: {type: Array}, hasNewItems: {type: Boolean}, - isLoadingMore: {type: Boolean} + isLoadingMore: {type: Boolean}, + followOnly: {type: Boolean, attribute: 'follow-only'} } } @@ -35,6 +36,7 @@ export class PostsFeed extends LitElement { this.results = undefined this.hasNewItems = false this.isLoadingMore = false + this.followOnly = false // ui state this.loadMoreObserver = undefined @@ -150,9 +152,10 @@ export class PostsFeed extends LitElement { let results = more ? (this.results || []) : [] let lt = more ? results[results?.length - 1]?.key : undefined if (this.view === 'ctzn.network/feed-view') { - results = results.concat((await session.ctzn.view(this.view, {limit: 15, reverse: true, lt}))?.feed) + let res = (await session.ctzn.view(this.view, {limit: 15, reverse: true, lt, followOnly: this.followOnly})) + results = results.concat(res?.feed) } else { - results = results.concat((await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 15, reverse: true, lt}))?.posts) + results = results.concat((await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 15, reverse: true, lt, followOnly: this.followOnly}))?.posts) } if (this.limit > 0 && results.length > this.limit) { results = results.slice(0, this.limit) @@ -183,9 +186,9 @@ export class PostsFeed extends LitElement { } let results if (this.view === 'ctzn.network/feed-view') { - results = (await session.ctzn.view(this.view, {limit: 1, reverse: true}))?.feed + results = (await session.ctzn.view(this.view, {limit: 1, reverse: true, followOnly: this.followOnly}))?.feed } else { - results = (await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 1, reverse: true}))?.posts + results = (await session.ctzn.viewByHomeServer(this.userId, this.view, this.userId, {limit: 1, reverse: true, followOnly: this.followOnly}))?.posts } this.hasNewItems = (results[0] && results[0].key !== this.results[0].key) } diff --git a/static/js/views/main.js b/static/js/views/main.js index 9ffd0176..8d354902 100644 --- a/static/js/views/main.js +++ b/static/js/views/main.js @@ -183,6 +183,10 @@ class CtznMainView extends LitElement { path: '/search', mobileOnly: true, label: 'Search' + }, + { + path: '/follow-only', + label: 'Follows' } ] return html` @@ -221,6 +225,15 @@ class CtznMainView extends LitElement { + ` : this.currentView === 'follow-only' ? html` + ${this.isEmpty ? this.renderEmptyMessage() : ''} + ` : ''} ${this.renderRightSidebar()} diff --git a/static/vercel.json b/static/vercel.json index e4e268b8..e076f54b 100644 --- a/static/vercel.json +++ b/static/vercel.json @@ -35,6 +35,13 @@ "Content-Security-Policy": "script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self';" } }, + { + "src": "/follow-only", + "dest": "/index.html", + "headers": { + "Content-Security-Policy": "script-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self';" + } + }, { "src": "/notifications", "dest": "/index.html",