#238 maintenance page
This commit is contained in:
parent
c7cef6f66d
commit
b368df8f00
@ -30,7 +30,7 @@ namespace GanjooRazor.Pages
|
||||
/// <summary>
|
||||
/// configration file reader (appsettings.json)
|
||||
/// </summary>
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IConfiguration Configuration;
|
||||
|
||||
/// <summary>
|
||||
/// HttpClient instance
|
||||
@ -53,7 +53,7 @@ namespace GanjooRazor.Pages
|
||||
IMemoryCache memoryCache
|
||||
)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Configuration = configuration;
|
||||
_httpClient = httpClient;
|
||||
_memoryCache = memoryCache;
|
||||
}
|
||||
@ -511,6 +511,10 @@ namespace GanjooRazor.Pages
|
||||
/// <returns></returns>
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
if(bool.Parse(Configuration["MaintenanceMode"]))
|
||||
{
|
||||
return StatusCode(503);
|
||||
}
|
||||
LastError = "";
|
||||
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]);
|
||||
CanEdit = Request.Cookies["CanEdit"] == "True";
|
||||
@ -519,7 +523,7 @@ namespace GanjooRazor.Pages
|
||||
IsPoemPage = false;
|
||||
IsHomePage = Request.Path == "/";
|
||||
PinterestUrl = Request.Query["pinterest_url"];
|
||||
ViewData["GoogleAnalyticsCode"] = _configuration["GoogleAnalyticsCode"];
|
||||
ViewData["GoogleAnalyticsCode"] = Configuration["GoogleAnalyticsCode"];
|
||||
GoogleBreadCrumbList breadCrumbList = new GoogleBreadCrumbList();
|
||||
Banner = null;
|
||||
|
||||
|
||||
38
GanjooRazor/Pages/errors/503.cshtml
Normal file
38
GanjooRazor/Pages/errors/503.cshtml
Normal file
@ -0,0 +1,38 @@
|
||||
@page
|
||||
|
||||
@{
|
||||
Layout = null;
|
||||
ViewData["Title"] = "در حال بهروز رسانی ...";
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fa-IR" dir="rtl">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta http-equiv="refresh" content="5">
|
||||
<title>
|
||||
@ViewData["Title"]
|
||||
</title>
|
||||
|
||||
<link href="/css/p8.css?version=12" rel="stylesheet" type="text/css" />
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="hdr">
|
||||
<h1><a href="/" title="گنجور"><img src="/image/gm.gif" alt="گنجور" style="width:auto;margin:auto;" /></a></h1>
|
||||
</div>
|
||||
|
||||
<h1 class="text-danger">گنجور در حال به روزرسانی است</h1>
|
||||
|
||||
|
||||
<p class="text-danger">
|
||||
گنجور در حال بهروزرسانی است. لطفاً لحظاتی دیگر مجدداً تلاش کنید.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -11,5 +11,6 @@
|
||||
"APIRoot": "http://localhost:3439",
|
||||
"GlobalAPIRoot": "http://localhost:3439",
|
||||
"SiteUrl": "http://localhost:33081",
|
||||
"ReadOnlyMode": "False"
|
||||
"ReadOnlyMode": "False",
|
||||
"MaintenanceMode": "False"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user