@@ -7,13 +7,13 @@ import RealTimeConnection from './RealTimeConnection.js';
7
7
class Akun {
8
8
constructor ( settings ) {
9
9
this . _settings = settings ;
10
- this . core = new Core ( { protocol : settings . protocol , hostname : settings . hostname } ) ;
10
+ this . core = new Core ( { protocol : settings . protocol , hostname : settings . hostname } ) ;
11
11
if ( this . _settings . connection ) {
12
12
this . connection = new RealTimeConnection ( this , this . _settings . connection ) ;
13
13
}
14
14
// Special choice node in unpublished story devoted to divining the ephemeralUserId
15
15
this . _ephemeralUserId = null ;
16
- this . _ephemeralUserIdPromise = this . vote ( 'DAjqaif2XdtjF9mPD' , 0 ) . then ( ( { user } ) => {
16
+ this . _ephemeralUserIdPromise = this . vote ( 'DAjqaif2XdtjF9mPD' , 0 ) . then ( ( { user} ) => {
17
17
this . _ephemeralUserId = user ;
18
18
return user ;
19
19
} ) ;
@@ -162,23 +162,23 @@ class Akun {
162
162
'trash' : true ,
163
163
'init' : true
164
164
} ;
165
- return this . core . post ( `/api/anonkun/board/item` , { data } ) ;
165
+ return this . core . post ( `/api/anonkun/board/item` , { data} ) ;
166
166
}
167
167
168
168
vote ( choiceNodeId , choiceId ) {
169
169
const data = {
170
170
'_id' : choiceNodeId ,
171
171
'vote' : choiceId
172
172
} ;
173
- return this . core . post ( `/api/anonkun/voteChapter` , { data } ) ;
173
+ return this . core . post ( `/api/anonkun/voteChapter` , { data} ) ;
174
174
}
175
175
176
176
removeVote ( choiceNodeId , choiceId ) {
177
177
const data = {
178
178
'_id' : choiceNodeId ,
179
179
'vote' : choiceId
180
180
} ;
181
- return this . core . delete ( `/api/anonkun/voteChapter` , { data } ) ;
181
+ return this . core . delete ( `/api/anonkun/voteChapter` , { data} ) ;
182
182
}
183
183
184
184
writeInChoice ( choiceNodeId , value , storyId ) {
@@ -190,7 +190,7 @@ class Akun {
190
190
// Site does this but omitting it seems to work anyway
191
191
data [ 'r' ] = [ storyId ] ;
192
192
}
193
- return this . core . post ( `/api/anonkun/customChoice` , { data } ) ;
193
+ return this . core . post ( `/api/anonkun/customChoice` , { data} ) ;
194
194
}
195
195
196
196
openChoice ( choiceNodeId ) {
@@ -210,7 +210,7 @@ class Akun {
210
210
// Site does this but omitting it seems to work anyway
211
211
data [ 'r' ] = [ storyId ] ;
212
212
}
213
- return this . core . post ( `/api/anonkun/readerPost` , { data } ) ;
213
+ return this . core . post ( `/api/anonkun/readerPost` , { data} ) ;
214
214
}
215
215
216
216
openReaderPost ( readerPostNodeId ) {
@@ -226,15 +226,15 @@ class Akun {
226
226
blockFor : chatNodeId ,
227
227
blockFrom : storyId
228
228
} ;
229
- return this . core . post ( `/api/anonkun/ban` , { data, json : false } ) ;
229
+ return this . core . post ( `/api/anonkun/ban` , { data, json : false } ) ;
230
230
}
231
231
232
232
unban ( storyId , chatNodeId ) {
233
233
const data = {
234
234
blockFor : chatNodeId ,
235
235
blockFrom : storyId
236
236
} ;
237
- return this . core . delete ( `/api/anonkun/ban` , { data, json : false } ) ;
237
+ return this . core . delete ( `/api/anonkun/ban` , { data, json : false } ) ;
238
238
}
239
239
240
240
getBans ( storyId ) {
@@ -247,7 +247,7 @@ class Akun {
247
247
deleteFrom : storyId ,
248
248
nid : chatNodeId
249
249
} ;
250
- return this . core . delete ( `/api/anonkun/node` , { data, json : false } ) ;
250
+ return this . core . delete ( `/api/anonkun/node` , { data, json : false } ) ;
251
251
}
252
252
253
253
/**
@@ -265,8 +265,10 @@ class Akun {
265
265
* @param {boolean } [options.storyStatus.finished=true] - Finished stories
266
266
* @param {boolean } [options.storyStatus.hiatus=true] - Stories that met an untimely pause
267
267
* @param {string } [options.sort] - How the results are sorted. Values can be:
268
- * - 'Latest': "Sort by the latest activity in the story, including chat posts"
269
- * - 'UpdatedChapter': "Sort by the latest posted chapter"
268
+ * - 'active': "Sort by the latest activity in the story, including chat posts"
269
+ * - 'chapter': "Sort by the latest posted chapter"
270
+ * - 'replies': "Sort by the most commented stories"
271
+ * - 'like': "Sort by the most liked stories"
270
272
* - 'top': "Sort by the most commented stories"
271
273
* - 'new': "Show the newest stories"
272
274
* @param {string } [options.length] - Filter stories by length. Values can be:
@@ -280,6 +282,7 @@ class Akun {
280
282
getStories ( board = 'stories' , page = 1 , options ) {
281
283
const query = _ . merge (
282
284
{
285
+ page,
283
286
contentRating : {
284
287
teen : true ,
285
288
mature : true ,
@@ -290,16 +293,12 @@ class Akun {
290
293
finished : true ,
291
294
hiatus : true
292
295
} ,
293
- sort : 'Latest ' ,
296
+ sort : 'active ' ,
294
297
length : 'Any'
295
298
} ,
296
299
options
297
300
) ;
298
- if ( _ . isNumber ( page ) ) {
299
- return this . core . get ( `/api/anonkun/board/${ board } /${ page } ` , { query } ) ;
300
- } else {
301
- return this . core . get ( `/api/anonkun/board/${ board } ` , { query } ) ;
302
- }
301
+ return this . core . get ( `/api/anonkun/board/${ board } ` , { query} ) ;
303
302
}
304
303
305
304
_openNode ( nodeId ) {
@@ -311,7 +310,7 @@ class Akun {
311
310
}
312
311
}
313
312
} ;
314
- return this . core . post ( `/api/anonkun/editChapter` , { data, json : false } ) ;
313
+ return this . core . post ( `/api/anonkun/editChapter` , { data, json : false } ) ;
315
314
}
316
315
317
316
_closeNode ( nodeId ) {
@@ -323,7 +322,7 @@ class Akun {
323
322
}
324
323
}
325
324
} ;
326
- return this . core . post ( `/api/anonkun/editChapter` , { data, json : false } ) ;
325
+ return this . core . post ( `/api/anonkun/editChapter` , { data, json : false } ) ;
327
326
}
328
327
}
329
328
0 commit comments