This repository was archived by the owner on Sep 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ let headers = require ( '../utils/headers.js' ) ;
2+ let variables = require ( '../utils/variables.js' ) ;
3+
4+ async function _getCookies ( user , pass ) {
5+ if ( user == 'RayhanADev' ) {
6+ let info = await variables
7+ . fetch ( 'https://repl.it/login' , {
8+ method : 'POST' ,
9+ headers,
10+ body : JSON . stringify ( {
11+ user,
12+ pass
13+ } )
14+ } )
15+ . then ( res => {
16+ return res . headers . raw ( ) [ 'set-cookie' ] [ 1 ] ;
17+ } ) ;
18+
19+ if ( ! info ) {
20+ throw new Error ( `Couldn't fetch cookie data.` ) ;
21+ } else {
22+ return info ;
23+ }
24+ } else {
25+ throw new Error (
26+ `${ user } is not whitelisted. Please contact @RayhanADev in Repl.it to talk about getting added to the whitelist.`
27+ ) ;
28+ }
29+ }
30+
31+ class Login {
32+ constructor ( username , password ) {
33+ this . username = username ;
34+ this . password = password ;
35+ }
36+
37+ async account ( ) {
38+ let user = this . username ;
39+ let pass = this . password ;
40+ if ( user == 'RayhanADev' ) {
41+ global . cookies = await _getCookies ( user , pass ) ;
42+ } else {
43+ throw new Error (
44+ `${ user } is not whitelisted. Please contact @RayhanADev in Repl.it to talk about getting added to the whitelist.`
45+ ) ;
46+ }
47+ }
48+ }
49+
50+ module . exports = {
51+ Login : Login
52+ } ;
You can’t perform that action at this time.
0 commit comments