Skip to content

Commit 8820b3c

Browse files
author
Chris Maunder
committed
Updated server version checks (frequency and endpoint location)
1 parent 495cfee commit 8820b3c

File tree

5 files changed

+56
-10
lines changed

5 files changed

+56
-10
lines changed

src/SDK/NET/Common/VersionInfo.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
namespace CodeProject.AI.SDK.Common
44
{
5+
/// <summary>
6+
/// Maps to the server's version.json file
7+
/// </summary>
8+
public class VersionFileContents
9+
{
10+
public class VersionSectionWrap
11+
{
12+
/// <summary>
13+
/// The Version info
14+
/// </summary>
15+
public VersionInfo? VersionInfo { get; set; } = null;
16+
}
17+
18+
public VersionSectionWrap? VersionSection { get; set; } = null;
19+
}
20+
521
/// <summary>
622
/// The current version of the server.
723
/// </summary>

src/server/Modules/ModuleInstaller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public async Task<List<ModuleDescription>> GetInstallableModulesAsync()
269269
#if DEBUG
270270
TimeSpan checkInterval = TimeSpan.FromSeconds(15);
271271
#else
272-
TimeSpan checkInterval = TimeSpan.FromMinutes(5);
272+
TimeSpan checkInterval = TimeSpan.FromHours(24);
273273
#endif
274274
List<ModuleDescription>? downloadableModuleList = null;
275275

src/server/Version/ServerVersionService.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,20 @@ public ServerVersionService(IOptions<VersionConfig> versionOptions,
105105
{
106106
PropertyNameCaseInsensitive = true
107107
};
108+
109+
// We have two formats we need to deal with: first was the JSON returned by the
110+
// previous CodeProject webservice. This was purely a VersionInfo JSON object.
111+
// The second is the JSON from the server's version.json file itself, which
112+
// contains a VersionInfo object inside a VersionSection object
113+
//
108114
version = JsonSerializer.Deserialize<VersionInfo>(data, options);
115+
if (version is null || version.Major == 0)
116+
{
117+
var versionFileContents = JsonSerializer.Deserialize<VersionFileContents>(data, options);
118+
if (versionFileContents?.VersionSection?.VersionInfo is not null)
119+
version = versionFileContents?.VersionSection?.VersionInfo;
120+
}
121+
109122
if (version is not null)
110123
{
111124
// A small adjustment. The version info contains the file *name* not a file

src/server/appsettings.development.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66
},
77

88
"ServerOptions": {
9-
"ServerVersionCheckUrl": "https://www.codeproject.com/ai/version.aspx",
10-
"ServerDownloadUrl": "https://www.codeproject.com/ai/latest.aspx"
9+
// URLs and Endpoints on CodeProject.com
10+
// "ServerVersionCheckUrl": "https://www.codeproject.com/ai/version.aspx", // Check for latest version
11+
// "ServerDownloadUrl": "https://www.codeproject.com/ai/latest.aspx", // Link to download latest server
12+
13+
// URLs and Endpoints on GitHub.io
14+
"ServerVersionCheckUrl": "https://codeproject.github.io/codeproject.ai/config/version.json",
15+
"ServerDownloadUrl": "https://codeproject.github.io/codeproject.ai/latest.html", // Link to download latest server
1116
},
1217

1318
"MeshOptions": {

src/server/appsettings.json

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@
5959
"DisableIPv6": false,
6060

6161
// URLs and Endpoints on CodeProject.com
62-
"ServerVersionCheckUrl": "https://www.codeproject.com/ai/version.aspx", // Check for latest version
63-
"ServerDownloadUrl": "https://www.codeproject.com/ai/latest.aspx", // Link to download latest server
62+
// "ServerVersionCheckUrl": "https://www.codeproject.com/ai/version.aspx", // Check for latest version
63+
// "ServerDownloadUrl": "https://www.codeproject.com/ai/latest.aspx", // Link to download latest server
64+
65+
// URLs and Endpoints on GitHub.io
66+
"ServerVersionCheckUrl": "https://codeproject.github.io/codeproject.ai/config/version.json",
67+
"ServerDownloadUrl": "https://codeproject.github.io/codeproject.ai/latest.html", // Link to download latest server
6468

6569
// These key/values are added to the set of environment variables when the backend analysis
6670
// modules are launched.
@@ -92,11 +96,19 @@
9296
"ModuleInstallTimeout": "00:20:00",
9397

9498
// URLs and Endpoints on CodeProject.com
95-
"ModuleListUrl": "https://www.codeproject.com/ai/modules/list", // Location of the JSON list of modules that can be downloaded
96-
"ModelListUrl": "https://www.codeproject.com/ai/models/list", // Location of the JSON list of models that can be downloaded
97-
// "AssetStorageUrl": "https://codeproject-ai.s3.ca-central-1.amazonaws.com/server/assets/",
98-
// "AssetStorageUrl": "https://codeproject-ai-bunny.b-cdn.net/server/assets/",
99-
"AssetStorageUrl": "https://www.codeproject.com/ai/download/server/assets/", // Location of downloadable models
99+
// "ModuleListUrl": "https://www.codeproject.com/ai/modules/list", // Location of the JSON list of modules that can be downloaded
100+
// "ModelListUrl": "https://www.codeproject.com/ai/models/list", // Location of the JSON list of models that can be downloaded
101+
// "AssetStorageUrl": "https://www.codeproject.com/ai/download/server/assets/", // Location of downloadable models
102+
103+
// URLs on Bunny.net
104+
"AssetStorageUrl": "https://codeproject-ai-bunny.b-cdn.net/server/assets/",
105+
// "ModuleListUrl": "https://codeproject-ai-bunny.b-cdn.net/modules/modules.json",
106+
// "ModelListUrl": "https://codeproject-ai-bunny.b-cdn.net/models/models.json",
107+
108+
// URLs on github.io
109+
// "AssetStorageUrl": "https://codeproject.github.io/codeproject.ai/assets/",
110+
"ModuleListUrl": "https://codeproject.github.io/codeproject.ai/config/modules.json",
111+
"ModelListUrl": "https://codeproject.github.io/codeproject.ai/config/modules.json",
100112

101113
// The location of the AI modules (pre-installed and downloaded/side-loaded)
102114
"ModuleInstallerScriptsDirPath": "%ROOT_PATH%", // Where the installer scripts (setup.bat/.sh) live

0 commit comments

Comments
 (0)