Przeglądaj źródła

Fixed invalid CORs.

Fixed invalid HTML head elements.
Fixed invalid html elements.
tags/2.0.6
Teknikode 3 lat temu
rodzic
commit
d8044a9b8e

+ 0
- 5
Teknik/Areas/Home/HomeAreaRegistration.cs Wyświetl plik

@@ -65,11 +65,6 @@ namespace Teknik.Areas.Home
// Register Style Bundles
BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/home", config.CdnHost).Include(
"~/Areas/Home/Content/Home.css"));

// Register Script Bundles
BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/home", config.CdnHost).Include(
"~/Scripts/PageDown/Markdown.Converter.js",
"~/Scripts/PageDown/Markdown.Sanitizer.js"));
}
}
}

+ 75
- 105
Teknik/Areas/Home/Views/Home/Index.cshtml Wyświetl plik

@@ -18,13 +18,10 @@
}

@Styles.Render("~/Content/home")
@Scripts.Render("~/bundles/home")

<div class="container">
<div class="row">
<center>
<img src="@logoPath" class="img-responsive" alt="Teknik">
</center>
<img src="@logoPath" class="img-responsive center-block" alt="Teknik">
</div>
<br />
<div class="row text-center">
@@ -137,47 +134,38 @@
<h3 class="panel-title text-center">Recent News</h3>
</div>
<div class="panel-body">
<p>
<ul class="list-group">
@if (Model.SitePosts.Any())
{
foreach (BlogPost post in Model.SitePosts)
{
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_@post.BlogPostId").text();
var new_post = converter.makeHtml(old_post);
$("#title_@post.BlogPostId").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left">
<a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId })" id="title_@post.BlogPostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@post.DatePosted.ToString("o")">@post.DatePosted.ToString("MMMM dd, yyyy")</time>
</p>
</div>
</div>
</div>
</li>
}
}
else
<ul class="list-group">
@if (Model.SitePosts.Any())
{
foreach (BlogPost post in Model.SitePosts)
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No News Available</h4>
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left">
<a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId })" id="title_@post.BlogPostId">@Html.Markdown(post.Title)</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@post.DatePosted.ToString("o")">@post.DatePosted.ToString("MMMM dd, yyyy")</time>
</p>
</div>
</div>
</div>
</li>
}
</ul>
</p>
}
else
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No News Available</h4>
</div>
</div>
</li>
}
</ul>
</div>
</div>
</div>
@@ -188,47 +176,38 @@
<h3 class="panel-title text-center">Recent Podcasts</h3>
</div>
<div class="panel-body">
<p>
<ul class="list-group">
@if (Model.Podcasts.Any())
{
foreach (Podcast podcast in Model.Podcasts)
{
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_@podcast.PodcastId").text();
var new_post = converter.makeHtml(old_post);
$("#title_@podcast.PodcastId").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left">
<a href="@Url.SubRouteUrl("podcast", "Podcast.View", new { episode = podcast.Episode })" id="title_@podcast.PodcastId">@podcast.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@podcast.DatePosted.ToString("o")">@podcast.DatePosted.ToString("MMMM dd, yyyy")</time>
</p>
</div>
</div>
</div>
</li>
}
}
else
<ul class="list-group">
@if (Model.Podcasts.Any())
{
foreach (Podcast podcast in Model.Podcasts)
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No Podcasts Available</h4>
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left">
<a href="@Url.SubRouteUrl("podcast", "Podcast.View", new { episode = podcast.Episode })" id="title_@podcast.PodcastId">@Html.Markdown(podcast.Title)</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@podcast.DatePosted.ToString("o")">@podcast.DatePosted.ToString("MMMM dd, yyyy")</time>
</p>
</div>
</div>
</div>
</li>
}
</ul>
</p>
}
else
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No Podcasts Available</h4>
</div>
</div>
</li>
}
</ul>
</div>
</div>
</div>
@@ -239,46 +218,37 @@
<h3 class="panel-title text-center">Recent Blog Posts</h3>
</div>
<div class="panel-body">
<p>
<ul class="list-group">
@if (Model.BlogPosts.Any())
{
foreach (BlogPost post in Model.BlogPosts)
{
<script>
var converter = new Markdown.getSanitizingConverter();
// Title Conversion
var old_post = $("#title_@post.BlogPostId").text();
var new_post = converter.makeHtml(old_post);
$("#title_@post.BlogPostId").html(new_post);
</script>
<li class="list-group-item">
<div class="row">
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId })" id="title_@post.BlogPostId">@post.Title</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@post.DatePosted.ToString("o")">@post.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("user", "User.Index", new { username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>
</div>
</li>
}
}
else
<ul class="list-group">
@if (Model.BlogPosts.Any())
{
foreach (BlogPost post in Model.BlogPosts)
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No Posts Available</h4>
<div class="col-sm-12">
<div class="blog-post-sm">
<h2 class="blog-post-title-sm text-left"><a href="@Url.SubRouteUrl("blog", "Blog.Post", new { username = post.Blog.User.Username, id = post.BlogPostId })" id="title_@post.BlogPostId">@Html.Markdown(post.Title)</a>
</h2>
<p class="blog-post-meta-sm text-left text-muted">
Posted on <time datetime="@post.DatePosted.ToString("o")">@post.DatePosted.ToString("MMMM dd, yyyy")</time> by <a href="@Url.SubRouteUrl("user", "User.Index", new { username = post.Blog.User.Username })">@post.Blog.User.Username</a>
</p>
</div>
</div>
</div>
</li>
}
</ul>
</p>
}
else
{
<li class="list-group-item">
<div class="row">
<div class="col-sm-12 text-center">
<h4>No Posts Available</h4>
</div>
</div>
</li>
}
</ul>
</div>
</div>
</div>

+ 1
- 1
Teknik/Areas/Upload/Views/Upload/Index.cshtml Wyświetl plik

@@ -51,7 +51,7 @@
<div class="row">
<div class="col-sm-12">
<label for="serverSideEncrypt">Encrypt Server Side</label>
<input type="checkbox" name="serverSideEncrypt" id="serverSideEncrypt" @(Model.ServerSideEncrypt ? "checked" : string.Empty) ; />
<input type="checkbox" name="serverSideEncrypt" id="serverSideEncrypt" @(Model.ServerSideEncrypt ? "checked" : string.Empty) />
</div>
</div>
</div>

+ 1
- 1
Teknik/Areas/User/Views/User/Login.cshtml Wyświetl plik

@@ -12,7 +12,7 @@
</div>
</div>
</div>
<form role="form" id="loginForm" action="@Url.SubRouteUrl("user", "User.Login")" method="post" accept-charset="UTF-8">
<form id="loginForm" action="@Url.SubRouteUrl("user", "User.Login")" method="post" accept-charset="UTF-8">
<input name="Login.ReturnUrl" id="loginReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="loginUsername" value="" placeholder="Username" name="Login.Username" data-val-required="The Username field is required." data-val="true" />

+ 1
- 1
Teknik/Areas/User/Views/User/Register.cshtml Wyświetl plik

@@ -12,7 +12,7 @@
</div>
</div>
</div>
<form role="form" id="registrationForm" action="@Url.SubRouteUrl("user", "User.Register")" method="post" accept-charset="UTF-8">
<form id="registrationForm" action="@Url.SubRouteUrl("user", "User.Register")" method="post" accept-charset="UTF-8">
<input name="Register.ReturnUrl" id="registerReturnUrl" type="hidden" value="@Model.ReturnUrl" />
<div class="form-group">
<input type="text" class="form-control" id="registerUsername" value="" placeholder="Username" name="Register.Username" data-val-required="The Username field is required." data-val="true"/>

+ 1
- 0
Teknik/Controllers/DefaultController.cs Wyświetl plik

@@ -15,6 +15,7 @@ using Teknik.ViewModels;

namespace Teknik.Controllers
{
[CORSActionFilter]
public class DefaultController : Controller
{
private Config _config;

+ 24
- 0
Teknik/Filters/CORSActionFilter.cs Wyświetl plik

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Teknik.Filters
{
public class CORSActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext.HttpContext.Request.HttpMethod == "OPTIONS")
{
// do nothing let IIS deal with reply!
filterContext.Result = new EmptyResult();
}
else
{
base.OnActionExecuting(filterContext);
}
}
}
}

+ 0
- 2
Teknik/Global.asax.cs Wyświetl plik

@@ -43,8 +43,6 @@ namespace Teknik

protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
// Start the generation time stopwatcher
var stopwatch = new Stopwatch();
HttpContext.Current.Items["Stopwatch"] = stopwatch;

+ 1
- 0
Teknik/Teknik.csproj Wyświetl plik

@@ -236,6 +236,7 @@
<Compile Include="Areas\User\Models\TrustedDevice.cs" />
<Compile Include="Areas\User\ViewModels\TwoFactorViewModel.cs" />
<Compile Include="Attributes\TeknikAuthorizeAttribute.cs" />
<Compile Include="Filters\CORSActionFilter.cs" />
<Compile Include="Helpers\BundleExtensions.cs" />
<Compile Include="Models\TransferTypes.cs" />
<Compile Include="Areas\User\Models\UploadSettings.cs" />

+ 5
- 6
Teknik/Views/Shared/_Layout.cshtml Wyświetl plik

@@ -3,16 +3,15 @@
@using Teknik.Helpers

<!DOCTYPE html>
<html>
<html lang="en">
<head>
<!-- Required Meta -->
<meta charset="utf-8" />
<!-- Character Set -->
<meta charset="UTF-8">
<!-- Compatability -->
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- What is the page's content type -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- Website Info -->
<meta name="description" content="@ViewBag.Description" />
<meta name="author" content="@Model.Config.Author" />

+ 1
- 1
Teknik/Web.config Wyświetl plik

@@ -64,7 +64,7 @@
<customHeaders>
<add name="Access-Control-Allow-Credentials" value="true" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Accept, Content-Type, X-Requested-With" />
<add name="Access-Control-Allow-Headers" value="Accept, Origin, Content-Type, X-Requested-With" />
<add name="strict-transport-security" value="max-age=31536000; includeSubdomains" />
</customHeaders>
</httpProtocol>

Ładowanie…
Anuluj
Zapisz