@@ -109,12 +109,102 @@ def cli(ctx: click.Context, **options: "Unpack[Options]"):
109109 )
110110 ctx .obj = config
111111
112+ if config .general .welcome_screen :
113+ import time
114+
115+ from ..core .constants import APP_CACHE_DIR , USER_NAME , SUPPORT_PROJECT_URL
116+
117+ last_welcomed_at_file = APP_CACHE_DIR / ".last_welcome"
118+ should_welcome = False
119+ if last_welcomed_at_file .exists ():
120+ try :
121+ last_welcomed_at = float (
122+ last_welcomed_at_file .read_text (encoding = "utf-8" )
123+ )
124+ # runs once a day
125+ if (time .time () - last_welcomed_at ) > 24 * 3600 :
126+ should_welcome = True
127+
128+ except Exception as e :
129+ logger .warning (f"Failed to read welcome screen timestamp: { e } " )
130+
131+ else :
132+ should_welcome = True
133+ if should_welcome :
134+ last_welcomed_at_file .write_text (str (time .time ()), encoding = "utf-8" )
135+
136+ from rich .prompt import Confirm
137+
138+ if Confirm .ask (f"""\
139+ [green]How are you { USER_NAME } 🙂?
140+ If you like the project and are able to support it please consider buying me a coffee at { SUPPORT_PROJECT_URL } .
141+ If you would like to proceed to { SUPPORT_PROJECT_URL } select yes, otherwise enjoy your browser anime experience 😁.[/]
142+ This message can be disabled by switching off the welcome_screen option in the config and is only shown once every 24hrs.
143+ """ ):
144+ from webbrowser import open
145+
146+ open (SUPPORT_PROJECT_URL )
147+
148+ if config .general .show_new_release :
149+ import time
150+
151+ from ..core .constants import APP_CACHE_DIR
152+
153+ last_release_file = APP_CACHE_DIR / ".last_release"
154+ should_print_release_notes = False
155+ if last_release_file .exists ():
156+ last_release = last_release_file .read_text (encoding = "utf-8" )
157+ current_version = list (map (int , __version__ .replace ("v" , "" ).split ("." )))
158+ last_saved_version = list (
159+ map (int , last_release .replace ("v" , "" ).split ("." ))
160+ )
161+ if (
162+ (current_version [0 ] > last_saved_version [0 ])
163+ or (
164+ current_version [1 ] > last_saved_version [1 ]
165+ and current_version [0 ] == last_saved_version [0 ]
166+ )
167+ or (
168+ current_version [2 ] > last_saved_version [2 ]
169+ and current_version [0 ] == last_saved_version [0 ]
170+ and current_version [1 ] == last_saved_version [1 ]
171+ )
172+ ):
173+ should_print_release_notes = True
174+
175+ else :
176+ should_print_release_notes = True
177+ if should_print_release_notes :
178+ last_release_file .write_text (__version__ , encoding = "utf-8" )
179+ from .service .feedback import FeedbackService
180+ from .utils .update import check_for_updates , print_release_json , update_app
181+ from rich .prompt import Confirm
182+
183+ feedback = FeedbackService (config )
184+ feedback .info ("Getting release notes..." )
185+ is_latest , release_json = check_for_updates ()
186+ if Confirm .ask (
187+ "Would you also like to update your config with the latest options and config notes"
188+ ):
189+ import subprocess
190+
191+ cmd = ["viu" , "config" , "--update" ]
192+ print (f"running '{ ' ' .join (cmd )} '..." )
193+ subprocess .run (cmd )
194+
195+ if is_latest :
196+ print_release_json (release_json )
197+ else :
198+ print_release_json (release_json )
199+ print ("It seems theres another update waiting for you as well 😁" )
200+ click .pause ("Press Any Key To Proceed..." )
201+
112202 if config .general .check_for_updates :
113203 import time
114204
115205 from ..core .constants import APP_CACHE_DIR
116206
117- last_updated_at_file = APP_CACHE_DIR / "last_update"
207+ last_updated_at_file = APP_CACHE_DIR / ". last_update"
118208 should_check_for_update = False
119209 if last_updated_at_file .exists ():
120210 try :
0 commit comments