@@ -62,7 +62,8 @@ def __init__(self):
6262 self .no_blacklist = False
6363 self .auto_blacklist = False
6464 self .quiet = False
65- self .not_check_update = True
65+ self .not_check_update = False
66+ self .hide_banner = False
6667
6768
6869class IBlacklistManager (ABC ):
@@ -421,30 +422,9 @@ def get_stats_display(self) -> str:
421422
422423 col_width = 30
423424
424- conns_stat = f"\033 [97mTotal: \033 [93m{ self .total_connections } \033 [0m" .ljust (
425- col_width
426- ) + "\033 [97m| " + f"\033 [97mMiss: \033 [96m{ self .allowed_connections } \033 [0m" .ljust (
427- col_width
428- ) + "\033 [97m| " + f"\033 [97mUnblock: \033 [92m{ self .blocked_connections } \033 [0m" .ljust (
429- col_width
430- ) + "\033 [97m| " f"\033 [97mErrors: \033 [91m{ self .errors_connections } \033 [0m" .ljust (
431- col_width
432- )
425+ conns_stat = f"\033 [97mUnblock: \033 [92m{ self .blocked_connections } \033 [0m" .ljust (col_width ) + "\033 [97m| " + f"\033 [97mMiss: \033 [96m{ self .allowed_connections } \033 [0m" .ljust (col_width ) + "\033 [97m| " + f"\033 [97mTotal: \033 [93m{ self .total_connections } \033 [0m" .ljust (col_width ) + "\033 [97m| " + f"\033 [97mErrors: \033 [91m{ self .errors_connections } \033 [0m" .ljust (col_width )
433426
434- traffic_stat = (
435- f"\033 [97mTotal: \033 [96m{ self .format_size (self .traffic_out + self .traffic_in )} \033 [0m" .ljust (
436- col_width
437- )
438- + "\033 [97m| "
439- + f"\033 [97mDL: \033 [96m{ self .format_size (self .traffic_in )} \033 [0m" .ljust (
440- col_width
441- )
442- + "\033 [97m| "
443- + f"\033 [97mUL: \033 [96m{ self .format_size (self .traffic_out )} \033 [0m" .ljust (
444- col_width
445- )
446- + "\033 [97m| "
447- )
427+ traffic_stat = f"\033 [97mDL: \033 [96m{ self .format_size (self .traffic_in )} \033 [0m" .ljust (col_width ) + "\033 [97m| " + f"\033 [97mUL: \033 [96m{ self .format_size (self .traffic_out )} \033 [0m" .ljust (col_width ) + "\033 [97m| " + f"\033 [97mTotal: \033 [96m{ self .format_size (self .traffic_out + self .traffic_in )} \033 [0m" .ljust (col_width ) + "\033 [97m| "
448428
449429 avg_speed_in = (
450430 self .average_speed_in [0 ] / self .average_speed_in [1 ]
@@ -477,7 +457,7 @@ def get_stats_display(self) -> str:
477457
478458 title = " STATISTICS "
479459
480- top_border = f"\033 [92m{ title .center (console_width , '= ' )} \033 [0m"
460+ top_border = f"\033 [92m{ title .center (console_width , '═ ' )} \033 [0m"
481461 line_conns = f"\033 [92m{ 'Conns' .ljust (8 )} :\033 [0m { conns_stat } \033 [0m"
482462 line_traffic = f"\033 [92m{ 'Traffic' .ljust (8 )} :\033 [0m { traffic_stat } \033 [0m"
483463 line_speed = f"\033 [92m{ 'Speed' .ljust (8 )} :\033 [0m { speed_stat } \033 [0m"
@@ -943,7 +923,7 @@ def sync_check():
943923 async def print_banner (self ) -> None :
944924 """Print startup banner"""
945925
946- if not self .config .not_check_update :
926+ if not ( self .config .not_check_update or self . config . quiet ) :
947927 self .update_check_task = asyncio .create_task (self .check_for_updates ())
948928
949929 try :
@@ -961,52 +941,53 @@ async def print_banner(self) -> None:
961941 if sys .platform == "win32" :
962942 os .system ("mode con: lines=33" )
963943
964- if sys .stdout .isatty ():
965- console_width = os .get_terminal_size ().columns
966- else :
967- console_width = 80
968- # self.logger.debug("console_width=", console_width)
944+ if not self .config .hide_banner :
945+ if sys .stdout .isatty ():
946+ console_width = os .get_terminal_size ().columns
947+ else :
948+ console_width = 80
949+ # self.logger.debug("console_width=", console_width)
950+
951+ disclaimer = (
952+ "DISCLAIMER. The developer and/or supplier of this software "
953+ "shall not be liable for any loss or damage, including but "
954+ "not limited to direct, indirect, incidental, punitive or "
955+ "consequential damages arising out of the use of or inability "
956+ "to use this software, even if the developer or supplier has been "
957+ "advised of the possibility of such damages. The developer and/or "
958+ "supplier of this software shall not be liable for any legal "
959+ "consequences arising out of the use of this software. This includes, "
960+ "but is not limited to, violation of laws, rules or regulations, "
961+ "as well as any claims or suits arising out of the use of this software. "
962+ "The user is solely responsible for compliance with all applicable laws "
963+ "and regulations when using this software."
964+ )
965+ wrapped_text = textwrap .TextWrapper (width = 70 ).wrap (disclaimer )
969966
970- disclaimer = (
971- "DISCLAIMER. The developer and/or supplier of this software "
972- "shall not be liable for any loss or damage, including but "
973- "not limited to direct, indirect, incidental, punitive or "
974- "consequential damages arising out of the use of or inability "
975- "to use this software, even if the developer or supplier has been "
976- "advised of the possibility of such damages. The developer and/or "
977- "supplier of this software shall not be liable for any legal "
978- "consequences arising out of the use of this software. This includes, "
979- "but is not limited to, violation of laws, rules or regulations, "
980- "as well as any claims or suits arising out of the use of this software. "
981- "The user is solely responsible for compliance with all applicable laws "
982- "and regulations when using this software."
983- )
984- wrapped_text = textwrap .TextWrapper (width = 70 ).wrap (disclaimer )
967+ left_padding = (console_width - 76 ) // 2
985968
986- left_padding = (console_width - 76 ) // 2
969+ # self.logger.info("\n\n\n")
970+ self .logger .info (
971+ "\033 [91m" + " " * left_padding + "╔" + "═" * 72 + "╗" + "\033 [0m"
972+ )
987973
988- # self.logger.info("\n\n\n")
989- self .logger .info (
990- "\033 [91m" + " " * left_padding + "╔" + "═" * 72 + "╗" + "\033 [0m"
991- )
974+ for line in wrapped_text :
975+ padded_line = line .ljust (70 )
976+ self .logger .info (
977+ "\033 [91m" + " " * left_padding +
978+ "║ " + padded_line + " ║" + "\033 [0m"
979+ )
992980
993- for line in wrapped_text :
994- padded_line = line .ljust (70 )
995981 self .logger .info (
996- "\033 [91m" + " " * left_padding +
997- "║ " + padded_line + " ║" + "\033 [0m"
982+ "\033 [91m" + " " * left_padding + "╚" + "═" * 72 + "╝" + "\033 [0m"
998983 )
999984
1000- self .logger .info (
1001- "\033 [91m" + " " * left_padding + "╚" + "═" * 72 + "╝" + "\033 [0m"
1002- )
985+ time .sleep (1 )
1003986
1004- time . sleep ( 1 )
987+ # self.logger.info("\033[2J\033[H" )
1005988
1006- # self.logger.info("\033[2J\033[H")
1007-
1008- self .logger .info (
1009- """\033 [92m
989+ self .logger .info (
990+ """\033 [92m
1010991 ██████ █████ ██████████ ███████████ █████
1011992 ░░██████ ░░███ ░░███░░░░███ ░░███░░░░░███░░███
1012993 ░███░███ ░███ ██████ ░███ ░░███ ░███ ░███ ░███
@@ -1016,14 +997,14 @@ async def print_banner(self) -> None:
1016997 █████ ░░█████░░██████ ██████████ █████ █████
1017998 ░░░░░ ░░░░░ ░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░
1018999\033 [0m"""
1019- )
1020- self .logger .info (f"\033 [92mVersion: { __version__ } " .center (console_width ))
1021- self .logger .info (
1022- "\033 [97m" +
1023- "Enjoy watching! / Наслаждайтесь просмотром!" .center (console_width )
1024- )
1000+ )
1001+ self .logger .info (f"\033 [92mVersion: { __version__ } " .center (console_width ))
1002+ self .logger .info (
1003+ "\033 [97m" +
1004+ "Enjoy watching! / Наслаждайтесь просмотром!" .center (console_width )
1005+ )
10251006
1026- # self.logger.info("\n")
1007+ # self.logger.info("\n")
10271008
10281009 if not self .config .not_check_update :
10291010 update_message = None
@@ -1162,6 +1143,7 @@ def load_from_args(args) -> ProxyConfig:
11621143 config .auto_blacklist = args .autoblacklist
11631144 config .quiet = args .quiet
11641145 config .not_check_update = args .not_check_update
1146+ config .hide_banner = args .hide_banner
11651147 return config
11661148
11671149
@@ -1345,6 +1327,9 @@ def parse_args():
13451327 parser .add_argument (
13461328 "--not-check-update" , action = "store_true" , help = "Do not check for updates"
13471329 )
1330+ parser .add_argument (
1331+ "--hide-banner" , action = "store_true" , help = "Suppress printing banner"
1332+ )
13481333
13491334 autostart_group = parser .add_mutually_exclusive_group ()
13501335 autostart_group .add_argument (
0 commit comments