66import UI .panel .im .IMPanel ;
77import UI .panel .monitor .ConsolePanel ;
88import UI .panel .setting .SettingPanel ;
9+ import com .nbs .ipfs .IPFSHelper ;
910import com .nbs .tools .ConfigHelper ;
1011import io .ipfs .api .IPFS ;
1112import org .slf4j .Logger ;
@@ -58,17 +59,15 @@ public class AppMainWindow {
5859
5960 public static boolean SERVER_STAT = false ;
6061
61- public static String PROFILE_NICKNAME = "lanbery" ;
62-
62+ protected static IPFSHelper ipfsHelper = IPFSHelper .getInstance ();
6363 /**
6464 *
6565 */
66- public static IPFS ipfs = null ;
66+ public static IPFS ipfs = IPFSHelper .getInstance ().getIpfs ();
67+
68+
69+ public static String PROFILE_NICKNAME = "" ;
6770
68- /**
69- * 运行监控
70- */
71- public static ConsolePanel monitorPanel ;
7271 /**
7372 *
7473 */
@@ -175,7 +174,6 @@ private void initialize(){
175174 */
176175 private void loadEnv (){
177176 Properties props = ConfigHelper .getEnv ();
178-
179177 logger .info ("ENV ============================>>" );
180178 for (String k : props .stringPropertyNames ()){
181179 String v = props .getProperty (k );
@@ -189,12 +187,14 @@ private void loadEnv(){
189187 }
190188
191189 try {
192- ipfs = new IPFS (ConfigHelper .getIpfsAddress ());
190+ if ( ipfs == null ) ipfs = new IPFS (ConfigHelper .getIpfsAddress ());
193191 SERVER_STAT = true ;
194192 Map map = ipfs .id ();
193+ PROFILE_NICKNAME = ipfsHelper .getNickName ();
195194 logger .info (">>>>>>>>>>>>>." +map .get ("ID" ));
196195 }catch (Exception e ){
197196 logger .error ("ipfs Server is dead." );
197+ ipfs = new IPFS (ConfigHelper .getIpfsAddress ());
198198 }
199199
200200 }
0 commit comments