aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-17 10:35:08 +0200
committerChocobozzz <me@florianbigard.com>2018-04-17 10:35:08 +0200
commitcc1561f9f7b33d739d66b23bacae23ea49f2fa12 (patch)
tree4ba9e905eaff4c80e9412b1ccf344c81c8c41ea8 /client/src/app/shared/video/video.service.ts
parente6f627975bebd00d396d11442e582d80856bc6bd (diff)
downloadPeerTube-cc1561f9f7b33d739d66b23bacae23ea49f2fa12.tar.gz
PeerTube-cc1561f9f7b33d739d66b23bacae23ea49f2fa12.tar.zst
PeerTube-cc1561f9f7b33d739d66b23bacae23ea49f2fa12.zip
Simplify client syndications
Diffstat (limited to 'client/src/app/shared/video/video.service.ts')
-rw-r--r--client/src/app/shared/video/video.service.ts64
1 files changed, 36 insertions, 28 deletions
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index 009155410..4c19c3765 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -117,45 +117,53 @@ export class VideoService {
117 .catch((res) => this.restExtractor.handleError(res)) 117 .catch((res) => this.restExtractor.handleError(res))
118 } 118 }
119 119
120 baseFeed () { 120 buildBaseFeedUrls () {
121 const feed = {} 121 const feeds = [
122 122 {
123 for (let item in FeedFormat) { 123 label: 'rss 2.0',
124 feed[FeedFormat[item]] = VideoService.BASE_FEEDS_URL + item.toLowerCase() 124 url: VideoService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase()
125 } 125 },
126 126 {
127 return feed 127 label: 'atom 1.0',
128 } 128 url: VideoService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase()
129 129 },
130 getFeed ( 130 {
131 filter?: VideoFilter 131 label: 'json 1.0',
132 ) { 132 url: VideoService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase()
133 }
134 ]
135
136 return feeds
137 }
138
139 getVideoFeedUrls (filter?: VideoFilter) {
133 let params = this.restService.addRestGetParams(new HttpParams()) 140 let params = this.restService.addRestGetParams(new HttpParams())
134 const feed = this.baseFeed() 141 const feeds = this.buildBaseFeedUrls()
135 142
136 if (filter) { 143 if (filter) params = params.set('filter', filter)
137 params = params.set('filter', filter) 144
138 } 145 if (params.keys().length !== 0) {
139 for (let item in feed) { 146 for (let item of feeds) {
140 feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() 147 item.url += `?${params.toString()}`
148 }
141 } 149 }
142 150
143 return feed 151 return feeds
144 } 152 }
145 153
146 getAccountFeed ( 154 getAccountFeedUrls (accountId: number) {
147 accountId: number,
148 host?: string
149 ) {
150 let params = this.restService.addRestGetParams(new HttpParams()) 155 let params = this.restService.addRestGetParams(new HttpParams())
151 const feed = this.baseFeed() 156 const feeds = this.buildBaseFeedUrls()
152 157
153 params = params.set('accountId', accountId.toString()) 158 params = params.set('accountId', accountId.toString())
154 for (let item in feed) { 159
155 feed[item] = feed[item] + ((params.toString().length === 0) ? '' : '?') + params.toString() 160 if (params.keys().length !== 0) {
161 for (let item of feeds) {
162 item.url += `?${params.toString()}`
163 }
156 } 164 }
157 165
158 return feed 166 return feeds
159 } 167 }
160 168
161 searchVideos ( 169 searchVideos (