123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- using System.Threading.Tasks;
- using Teknik.Areas.Help.ViewModels;
- using Teknik.Areas.Users.Models;
- using Teknik.Areas.Users.Utility;
- using Teknik.Attributes;
- using Teknik.Configuration;
- using Teknik.Controllers;
- using Teknik.Data;
- using Teknik.Filters;
- using Teknik.Logging;
- using Teknik.Utilities;
-
- namespace Teknik.Areas.Help.Controllers
- {
- [Authorize]
- [Area("Help")]
- [TrackPageView]
- public class HelpController : DefaultController
- {
- public HelpController(ILogger<Logger> logger, Config config, TeknikEntities dbContext) : base(logger, config, dbContext) { }
-
- [AllowAnonymous]
- public IActionResult Index()
- {
- ViewBag.Title = "Help";
- HelpViewModel model = new HelpViewModel();
- return View(model);
- }
-
- [AllowAnonymous]
- public IActionResult API(string version, string service)
- {
- HelpViewModel model = new HelpViewModel();
- if (string.IsNullOrEmpty(version) && string.IsNullOrEmpty(service))
- {
- ViewBag.Title = "API Help";
- return View("~/Areas/Help/Views/Help/API/API.cshtml", model);
- }
- else if(!string.IsNullOrEmpty(version) && !string.IsNullOrEmpty(service))
- {
- ViewBag.Title = service + " API " + version + " Help";
- return View("~/Areas/Help/Views/Help/API/" + version + "/" + service + ".cshtml", model);
- }
- return new StatusCodeResult(StatusCodes.Status404NotFound);
- }
-
- [AllowAnonymous]
- public IActionResult Blog()
- {
- ViewBag.Title = "Blogging Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/Blog.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult Git()
- {
- ViewBag.Title = "Git Service Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/Git.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult IRC()
- {
- ViewBag.Title = "IRC Server Help ";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/IRC.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult Mail()
- {
- ViewBag.Title = "Mail Server Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/Mail.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult Markdown()
- {
- ViewBag.Title = "Markdown Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/Markdown.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult Mumble()
- {
- ViewBag.Title = "Mumble Server Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/Mumble.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult RSS()
- {
- ViewBag.Title = "RSS Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/RSS.cshtml", model);
- }
-
- [AllowAnonymous]
- public IActionResult Tools()
- {
- ViewBag.Title = "Tool Help";
- HelpViewModel model = new HelpViewModel();
- return View("~/Areas/Help/Views/Help/Tools.cshtml", model);
- }
-
- [AllowAnonymous]
- public async Task<IActionResult> Upload()
- {
- ViewBag.Title = "Upload Service Help";
- UploadHelpViewModel model = new UploadHelpViewModel();
-
- model.MaxUploadSize = _config.UploadConfig.MaxUploadSize;
- if (User.Identity.IsAuthenticated)
- {
- User user = UserHelper.GetUser(_dbContext, User.Identity.Name);
- if (user != null)
- {
- model.MaxUploadSize = _config.UploadConfig.MaxUploadSizeBasic;
- IdentityUserInfo userInfo = await IdentityHelper.GetIdentityUserInfo(_config, User.Identity.Name);
- if (userInfo.AccountType == AccountType.Premium)
- {
- model.MaxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
- }
- }
- }
- return View("~/Areas/Help/Views/Help/Upload.cshtml", model);
- }
- }
- }
|