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