#445 tajik ganjoor

This commit is contained in:
Hamid Reza Mohammadi 2024-07-19 14:19:43 +03:30
parent ce45515236
commit 68aa795e1a
6 changed files with 77 additions and 17 deletions

View File

@ -7,7 +7,6 @@ using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RMuseum.Migrations;
using RMuseum.Models.Ganjoor;
using RMuseum.Models.Ganjoor.ViewModels;
using RMuseum.Models.GanjoorAudio;

46
TajikGanjoor/APIRoot.cs Normal file
View File

@ -0,0 +1,46 @@
namespace TajikGanjoor
{
/// <summary>
/// API Root
/// </summary>
public static class APIRoot
{
/// <summary>
/// url
/// </summary>
public static string Url
{
get
{
if (!string.IsNullOrEmpty(_url))
return _url;
IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json")
.Build();
_url = configuration["APIRoot"] ?? "https://api.ganjoor.net";
return _url;
}
}
private static string _url = "";
private static string _InternetUrl = "";
/// <summary>
/// internet accessible end point
/// </summary>
public static string InternetUrl
{
get
{
if (!string.IsNullOrEmpty(_InternetUrl))
return _InternetUrl;
IConfigurationRoot configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json")
.Build();
_InternetUrl = configuration["GlobalAPIRoot"] ?? "https://api.ganjoor.net";
return _InternetUrl;
}
}
}
}

View File

@ -16,10 +16,13 @@ namespace TajikGanjoor.Pages
return Page();
}
private readonly IConfiguration Configuration;
public IndexModel(IConfiguration configuration)
protected readonly IConfiguration Configuration;
protected readonly HttpClient _httpClient;
public IndexModel(IConfiguration configuration, HttpClient httpClient)
{
Configuration = configuration;
_httpClient = httpClient;
}
}
}

View File

@ -1,22 +1,13 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:37226",
"sslPort": 0
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5001",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:33082"
},
"IIS Express": {
"commandName": "IISExpress",
@ -25,5 +16,14 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:37226",
"sslPort": 0
}
}
}
}

View File

@ -6,4 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GoogleTranslateFreeApi" Version="1.1.1" />
</ItemGroup>
</Project>

View File

@ -5,5 +5,13 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"GoogleAnalyticsCode": "",
"APIRoot": "https://api.ganjoor.net",
"GlobalAPIRoot": "https://api.ganjoor.net",
"SiteUrl": "http://localhost:33082",
"AggressiveCacheEnabled": "False",
"BannersEnabled": "False",
"ReadOnlyMode": "False",
"MaintenanceMode": "False"
}