@@ -124,8 +124,44 @@ public void run() {
124124 //e.printStackTrace();
125125 //System.err.println("Error while trying to check for an update.");
126126 }
127+
128+ try {
129+ // Check for updates of the splash screen
130+ List <String > lines = readFileFromURL ("https://go.bug.st/latest_splash.txt" );
131+ if (lines .size () > 0 ) {
132+ // if the splash image has been changed download the new file
133+ String newSplashUrl = lines .get (0 );
134+ String oldSplashUrl = PreferencesData .get ("splash.imageurl" );
135+ if (!newSplashUrl .equals (oldSplashUrl )) {
136+ File tmpFile = BaseNoGui .getSettingsFile ("splash.png.tmp" );
137+ downloadFileFromURL (newSplashUrl , tmpFile );
138+ File destFile = BaseNoGui .getSettingsFile ("splash.png" );
139+ Files .move (tmpFile .toPath (), destFile .toPath (),
140+ StandardCopyOption .REPLACE_EXISTING );
141+ PreferencesData .set ("splash.imageurl" , newSplashUrl );
142+ }
143+
144+ // extend expiration by 24h
145+ PreferencesData .setLong ("splash.expire" , now + ONE_DAY );
146+ }
147+ } catch (Exception e ) {
148+ // e.printStackTrace();
149+ }
127150 }
128151
152+ public static File getUpdatedSplashImageFile () {
153+ if (PreferencesData .has ("splash.expire" )) {
154+ Long expire = PreferencesData .getLong ("splash.expire" );
155+ long now = System .currentTimeMillis ();
156+ if (expire != null && now < expire ) {
157+ File f = BaseNoGui .getSettingsFile ("splash.png" );
158+ if (f .isFile ()) {
159+ return f ;
160+ }
161+ }
162+ }
163+ return null ;
164+ }
129165
130166 protected int readIntFromURL (String _url ) throws Exception {
131167 List <String > lines = readFileFromURL (_url );
0 commit comments