@@ -35,6 +35,20 @@ exports.fetchMessages = async function() {
3535 return data
3636}
3737
38+ exports . markAllRead = async function ( ) {
39+ var response = await fetch ( "https://postlit.dev/markasread/" , {
40+ method : 'POST' ,
41+ headers : {
42+ 'Accept' : "application/json" ,
43+ 'Content-Type' : "application/json" ,
44+ cookie : 'token=' + token
45+ } ,
46+ body : JSON . stringify ( { all : true } ) ,
47+ } ) ;
48+ var data = await response . json ( ) ;
49+ return data
50+ }
51+
3852exports . post = async function ( content ) {
3953 var response = await fetch ( "https://postlit.dev/post/" , {
4054 method : 'POST' ,
@@ -162,6 +176,22 @@ exports.unlike = async function(post) {
162176 }
163177}
164178
179+ exports . pin = async function ( post ) {
180+ var response = await fetch ( "https://postlit.dev/pin/" , {
181+ method : 'POST' ,
182+ headers : {
183+ 'Accept' : 'application/json' ,
184+ 'Content-Type' : 'application/json' ,
185+ cookie : 'token=' + token
186+ } ,
187+ body : JSON . stringify ( {
188+ post : post
189+ } )
190+ } )
191+ var data = await response . json ( )
192+ return data
193+ }
194+
165195exports . comment = async function ( post , content ) {
166196 var response = await fetch ( "https://postlit.dev/comment/" , {
167197 method : 'POST' ,
@@ -184,3 +214,40 @@ exports.comment = async function(post, content) {
184214 } )
185215 }
186216}
217+
218+ exports . setTheme = async function ( theme ) {
219+ var response = await fetch ( "https://postlit.dev/theme/" , {
220+ method : 'POST' ,
221+ headers : {
222+ 'Accept' : "application/json" ,
223+ 'Content-Type' : "application/json" ,
224+ cookie : 'token=' + token
225+ } ,
226+ body : JSON . stringify ( { theme : theme } ) ,
227+ } ) ;
228+ var data = await response . json ( ) ;
229+ return data
230+ }
231+
232+ exports . getTopUsers = async function ( ) {
233+ var response = await fetch ( "https://postlit.dev/top-users/" ) ;
234+ var data = await response . json ( ) ;
235+ return data
236+ }
237+
238+ exports . inviteAmount = async function ( ) {
239+ var response = await fetch ( "https://postlit.dev/my-invites/" , {
240+ headers : {
241+ 'Accept' : 'application/json' ,
242+ 'Content-Type' : 'application/json' ,
243+ cookie : 'token=' + token
244+ } ,
245+ body : JSON . stringify ( { } )
246+ } )
247+ var data = await response . json ( )
248+ if ( data . error ) {
249+ console . error ( data . error )
250+ } else if ( data . success ) {
251+ return data . uses
252+ }
253+ }
0 commit comments