Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit dca6286

Browse files
committed
Move version over to use searchcodeserver.com and update background images
1 parent f97a8d4 commit dca6286

13 files changed

Lines changed: 23 additions & 6 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.searchcode.app.dto;
2+
3+
public class Version {
4+
public final String version;
5+
6+
public Version(String version) {
7+
this.version = version;
8+
}
9+
10+
public String getVersion() {
11+
return version;
12+
}
13+
}

src/main/java/com/searchcode/app/service/route/AdminRouteService.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
package com.searchcode.app.service.route;
1212

1313

14+
import com.google.gson.Gson;
1415
import com.searchcode.app.App;
1516
import com.searchcode.app.config.Values;
1617
import com.searchcode.app.dao.Api;
1718
import com.searchcode.app.dao.Data;
1819
import com.searchcode.app.dao.Repo;
1920
import com.searchcode.app.dto.Source;
21+
import com.searchcode.app.dto.Version;
2022
import com.searchcode.app.model.RepoResult;
2123
import com.searchcode.app.model.ValidatorResult;
2224
import com.searchcode.app.service.*;
@@ -480,19 +482,21 @@ public void reindexRepo(Request request, Response response) {
480482
}
481483

482484
public String checkVersion() {
483-
String version;
485+
Version version;
484486
try {
485-
version = IOUtils.toString(new URL("https://searchcode.com/product/version/")).replace("\"", Values.EMPTYSTRING);
487+
Gson gson = new Gson();
488+
String downloaded = IOUtils.toString(new URL("https://searchcodeserver.com/version.json"));
489+
version = gson.fromJson(downloaded, Version.class);
486490
}
487-
catch(IOException ex) {
491+
catch(Exception ex) {
488492
return "Unable to determine if running the latest version. Check https://searchcodeserver.com/pricing.html for the latest release.";
489493
}
490494

491-
if (App.VERSION.equals(version)) {
492-
return "Your searchcode server version " + version + " is the latest.";
495+
if (App.VERSION.equals(version.getVersion())) {
496+
return "Your searchcode server version " + App.VERSION + " is the latest.";
493497
}
494498
else {
495-
return "Your searchcode server version " + App.VERSION + " instance is out of date. The latest version is " + version + ".";
499+
return "Your searchcode server version " + App.VERSION + " instance is out of date. The latest version is " + version.getVersion() + ".";
496500
}
497501
}
498502

59.4 KB
Loading
76.4 KB
Loading
214 KB
Loading
-13.5 KB
Loading
208 KB
Loading
34.8 KB
Loading
178 KB
Loading
19.2 KB
Loading

0 commit comments

Comments
 (0)