66// config
77import com .benjamin538 .config .ConfigGet ;
88
9+ // mods
10+ import com .benjamin538 .index .mods .GetMods ;
11+
12+ // developer
13+ import com .benjamin538 .index .mods .Developer ;
14+
915// logging
1016import com .benjamin538 .util .Logging ;
1117
@@ -60,14 +66,17 @@ public void run() {
6066 profile = new JSONObject (Files .readString (tempPath ));
6167 }
6268 String username = profile .getString ("username" );
69+ int id = profile .getInt ("id" );
6370 String displayName = profile .getString ("display_name" );
6471 boolean isVerified = profile .getBoolean ("verified" );
6572 boolean isAdmin = profile .getBoolean ("admin" );
73+ Developer dev = new Developer (username , displayName , id , isVerified , isAdmin );
6674 anim .stop ();
6775 while (true ) {
68- Files .write (tempPath , profile .toString ().getBytes ());
76+ Files .write (tempPath , dev . exportJSON () .toString ().getBytes ());
6977 logger .clearTerminal ();
7078 System .out .println ("Your profile:" );
79+ System .out .println ("---------------" );
7180 System .out .println ("Username: " + username );
7281 System .out .println ("Display name: " + displayName );
7382 if (!isVerified ) {
@@ -79,7 +88,8 @@ public void run() {
7988 }
8089 System .out .println ("Admin" );
8190 System .out .println ("---------------" );
82- System .out .println ("Actions:\n 1.Change display name" );
91+ System .out .println ("Actions:\n 1.Change display name\n 2.View your pending mods\n 3.View your published mods" );
92+ System .out .println ("---------------" );
8393 String action = logger .askValue ("Type action (q to exit)" , "" , true );
8494 if (action .toLowerCase ().equals ("q" )) break ;
8595 try {
@@ -90,8 +100,15 @@ public void run() {
90100 HttpRequest nameRequest = HttpRequest .newBuilder ().uri (URI .create (ConfigGet .getIndexUrl () + "/v1/me" )).PUT (HttpRequest .BodyPublishers .ofString ("{\" display_name\" : \" " + newName + "\" }" )).header ("User-Agent" , "GeodeCLI" ).header ("Authorization" , "Bearer " + ConfigGet .getIndexToken ()).header ("Content-Type" , "application/json" ).build ();
91101 HttpResponse <String > nameResponse = client .send (nameRequest , HttpResponse .BodyHandlers .ofString ());
92102 if (nameResponse .statusCode () != 200 ) logger .fatal ("Unable to change name: status code " + nameResponse .statusCode ());
93- profile . put ( "display_name" , newName );
103+ dev . setDisplayName ( newName );
94104 logger .done ("Changed display name to " + newName );
105+ Thread .sleep (1500 );
106+ break ;
107+ case 2 :
108+ GetMods .getMods (client , logger , false );
109+ break ;
110+ case 3 :
111+ GetMods .getMods (client , logger , true );
95112 break ;
96113 default :
97114 logger .warn ("Wrong action" );
0 commit comments