@@ -58,11 +58,11 @@ export default class Value4Value extends React.PureComponent<IProps> {
58
58
const { initialDisplay} = this . state
59
59
this . _isMounted = true
60
60
61
- let results = ( await this . getValue4ValuePodcasts ( ) ) . feeds as Array < any >
61
+ let popular = ( await this . getValue4ValuePodcasts ( 200 ) ) . feeds as Array < any >
62
62
63
63
let pages = new Map < string , PageData > (
64
64
[
65
- [ SpecialPages . POPULAR , { groupPages : results , displayCount : initialDisplay } ] ,
65
+ [ SpecialPages . POPULAR , { groupPages : popular , displayCount : initialDisplay } ] ,
66
66
[ SpecialPages . SYMBOL , { groupPages : [ ] , displayCount : initialDisplay } ] ,
67
67
[ SpecialPages . NUMERIC , { groupPages : [ ] , displayCount : initialDisplay } ] ,
68
68
]
@@ -73,25 +73,40 @@ export default class Value4Value extends React.PureComponent<IProps> {
73
73
pages . set ( SpecialPages . OTHER , { groupPages : [ ] , displayCount : initialDisplay } )
74
74
75
75
const allPages = [ ]
76
- results . forEach ( ( value ) => {
77
- allPages . push ( value )
78
- const title = value . title
79
- let startChar = SpecialPages . OTHER
80
- if ( title ) {
81
- startChar = title [ 0 ] . toUpperCase ( )
82
- // handle
83
- if ( ! pages . has ( startChar ) ) {
84
- if ( SYMBOLS . includes ( startChar ) ) {
85
- startChar = SpecialPages . SYMBOL
86
- } else if ( NUMBERS . includes ( startChar ) ) {
87
- startChar = SpecialPages . NUMERIC
88
- } else {
89
- startChar = SpecialPages . OTHER
76
+
77
+ let grandTotal = 0
78
+ let startAt = 1
79
+ while ( true ) {
80
+ let v4vData = ( await this . getValue4ValuePodcastsPaginated ( startAt , 1000 ) )
81
+ const { status, feeds, total, nextStartAt} = v4vData
82
+ startAt = nextStartAt
83
+ grandTotal += total
84
+
85
+ if ( status !== "true" || startAt === undefined ) {
86
+ break
87
+ }
88
+
89
+ feeds . forEach ( ( value ) => {
90
+ allPages . push ( value )
91
+ const title = value . title
92
+ let startChar = SpecialPages . OTHER
93
+ if ( title ) {
94
+ startChar = title [ 0 ] . toUpperCase ( )
95
+ // handle
96
+ if ( ! pages . has ( startChar ) ) {
97
+ if ( SYMBOLS . includes ( startChar ) ) {
98
+ startChar = SpecialPages . SYMBOL
99
+ } else if ( NUMBERS . includes ( startChar ) ) {
100
+ startChar = SpecialPages . NUMERIC
101
+ } else {
102
+ startChar = SpecialPages . OTHER
103
+ }
90
104
}
91
105
}
92
- }
93
- pages . get ( startChar ) . groupPages . push ( value )
94
- } )
106
+ pages . get ( startChar ) . groupPages . push ( value )
107
+ } )
108
+ }
109
+
95
110
pages . set ( SpecialPages . ALL , { groupPages : allPages , displayCount : initialDisplay } )
96
111
97
112
const hash = this . getHash ( )
@@ -101,7 +116,7 @@ export default class Value4Value extends React.PureComponent<IProps> {
101
116
{
102
117
loading : false ,
103
118
pages : pages ,
104
- total : results . length ,
119
+ total : grandTotal ,
105
120
} ,
106
121
( ) => {
107
122
this . updateSelectedPage ( hash )
@@ -201,9 +216,18 @@ export default class Value4Value extends React.PureComponent<IProps> {
201
216
} )
202
217
}
203
218
204
- async getValue4ValuePodcasts ( ) {
219
+ async getValue4ValuePodcasts ( max : number ) {
220
+ // noinspection SpellCheckingInspection
221
+ let response = await fetch ( `/api/podcasts/bytag?podcast-value&max=${ max } ` , {
222
+ // credentials: 'same-origin',
223
+ method : 'GET' ,
224
+ } )
225
+ return await response . json ( )
226
+ }
227
+
228
+ async getValue4ValuePodcastsPaginated ( startAt : number , max : number ) {
205
229
// noinspection SpellCheckingInspection
206
- let response = await fetch ( `/api/podcasts/bytag?podcast-value` , {
230
+ let response = await fetch ( `/api/podcasts/bytag?podcast-value&max= ${ max } &start_at= ${ startAt } ` , {
207
231
// credentials: 'same-origin',
208
232
method : 'GET' ,
209
233
} )
@@ -406,11 +430,13 @@ export default class Value4Value extends React.PureComponent<IProps> {
406
430
< p > These podcasts are set up to receive Bitcoin payments in real-time over the Lightning network using
407
431
compatible < b > < Link to = "/apps" > Podcasting 2.0 apps</ Link > </ b > .</ p >
408
432
409
- < p > There are < b > { total } </ b > Value 4 Value podcasts! Add yours by including the value block on your feed using < b > < Link to = "https://podcasterwallet.com/" > podcasterwallet.com</ Link > </ b > </ p >
433
+ < p > There are < b > { total } </ b > Value 4 Value podcasts! Add yours by including the value block on your feed
434
+ using < b > < Link to = "https://podcasterwallet.com/" > podcasterwallet.com</ Link > </ b > </ p >
410
435
411
436
< br />
412
437
413
- < p > Podcasts are grouped by the first character of the title and then displayed in sort order for that page.</ p >
438
+ < p > Podcasts are grouped by the first character of the title and then displayed in sort order for that
439
+ page.</ p >
414
440
< p > The "Popular" page shows all podcasts in the "popularity" order returned from the API.</ p >
415
441
< p > The "All" page shows all podcasts in sort order.</ p >
416
442
0 commit comments