Example #1
0
        public async Task <IActionResult> Index()
        {
            if (!_cache.TryGetValue("Version.Cache", out string version))
            {
                version = await _version.CheckKahla();

                var cacheEntryOptions = new MemoryCacheEntryOptions()
                                        .SetSlidingExpiration(TimeSpan.FromMinutes(20));

                _cache.Set("Version.Cache", version, cacheEntryOptions);
            }
            var model = new IndexViewModel
            {
                LatestVersion = version
            };

            return(View(model));
        }
Example #2
0
        public async Task <IActionResult> Version()
        {
            if (!_cache.TryGetValue(nameof(Version), out (string appVersion, string cliVersion)version))
            {
                version = await _version.CheckKahla();

                var cacheEntryOptions = new MemoryCacheEntryOptions()
                                        .SetSlidingExpiration(TimeSpan.FromMinutes(20));

                _cache.Set(nameof(Version), version, cacheEntryOptions);
            }
            return(Json(new VersionViewModel
            {
                LatestVersion = version.appVersion,
                LatestCLIVersion = version.cliVersion,
                Message = "Successfully get the latest version number for Kahla App and Kahla.CLI.",
                DownloadAddress = "https://www.kahla.app"
            }));
        }
Example #3
0
        public async Task <IActionResult> Version()
        {
            var(appVersion, cliVersion) = await _cache.GetAndCache(nameof(Version), () => _version.CheckKahla());

            Response.Headers.Add("Access-Control-Allow-Origin", "*");
            return(Json(new VersionViewModel
            {
                LatestVersion = appVersion,
                LatestCLIVersion = cliVersion,
                Message = "Successfully get the latest version number for Kahla App and Kahla.CLI.",
                DownloadAddress = $"{Request.Scheme}://{Request.Host}"
            }));
        }
Example #4
0
        public async Task <IActionResult> Index()
        {
            var(appVersion, cliVersion) = await _cache.GetAndCache("Version.Cache", () => _version.CheckKahla());

            var downloadSite = "https://download.kahla.app";
            var model        = new IndexViewModel
            {
                AppLatestVersion = appVersion,
                CLILatestVersion = cliVersion,
                SDKLatestVersion = _versionService.GetSDKVersion(),
                DownloadRoot     = $"{downloadSite}/production",
                CliDownloadRoot  = $"{downloadSite}/productioncli",
                ArchiveRoot      = "https://github.com/AiursoftWeb/Kahla.App/archive",
                KahlaWebPath     = "//web.kahla.app",
                IsProduction     = true,
            };

            return(View(model));
        }
Example #5
0
        public async Task <IActionResult> Version()
        {
            var(appVersion, cliVersion) = await _cache.GetAndCache(nameof(Version), () => _version.CheckKahla());

            return(Json(new VersionViewModel
            {
                LatestVersion = appVersion,
                LatestCLIVersion = cliVersion,
                Message = "Successfully get the latest version number for Kahla App and Kahla.CLI.",
                DownloadAddress = "https://www.kahla.app"
            }));
        }
Example #6
0
        public async Task <IActionResult> Index()
        {
            var(appVersion, cliVersion) = await _cache.GetAndCache("Version.Cache", () => _version.CheckKahla());

            var downloadSite = await _serviceLocation.TryGetCDNDomain("https://download.kahla.app");

            var mode = Request.Host.ToString().ToLower().Contains("staging") ?
                       "staging" : "production";
            var isProduction = mode == "production";
            var model        = new IndexViewModel
            {
                AppLatestVersion = appVersion,
                CLILatestVersion = cliVersion,
                SDKLatestVersion = _versionService.GetSDKVersion(),
                DownloadRoot     = $"{downloadSite}/{mode}",
                CliDownloadRoot  = $"{downloadSite}/{mode}",
                ArchiveRoot      = "https://github.com/AiursoftWeb/Kahla.App/archive",
                KahlaWebPath     = isProduction ? "//web.kahla.app" : "//staging.web.kahla.app",
                IsProduction     = isProduction,
            };

            return(View(model));
        }