36c3
35c3
diff --git a/Pages/Info.cshtml b/Pages/Info.cshtml
new file mode 100644
index 0000000..d1f90c5
--- /dev/null
+++ b/Pages/Info.cshtml
@@ -0,0 +1,122 @@
+@page
+@using Microsoft.AspNetCore.Http
+@model InfoModel
+@{
+ ViewData["Title"] = "Info";
+}
+@{
+ if (string.IsNullOrWhiteSpace(Request.Query["guid"])) {
+ Response.Redirect("/");
+ return;
+ }
+
+ if (Request.Query.ContainsKey("bookmark") && HttpContext.Session.GetString("bookmark") != Request.Query["bookmark"]) {
+ HttpContext.Session.SetString("bookmark", Request.Query["bookmark"]);
+ }
+ if (!HttpContext.Session.Keys.Contains("bookmark") || !Guid.TryParseExact(HttpContext.Session.GetString("bookmark"), "D", out _)) {
+ HttpContext.Session.SetString("bookmark", Guid.NewGuid().ToString());
+ }
+ if (!Request.Query.ContainsKey("bookmark") || HttpContext.Session.GetString("bookmark") != Request.Query["bookmark"]) {
+ Response.Redirect("/Info?guid=" + Request.Query["guid"] + "&bookmark=" + HttpContext.Session.GetString("bookmark"));
+ }
+
+ ConferenceModel.ReadEventMetadata();
+ var talk = ConferenceModel.EventMetadata.FirstOrDefault(p => p.Guid == Request.Query["guid"]);
+ if (talk == null) {
+ Response.Redirect("/");
+ return;
+ }
+
+ var title = talk.Talk.Title;
+ var speakers = talk.Talk.Persons.Aggregate((s, s1) => $"{s}, {s1}");
+ var description = talk.Talk.Description;
+ if (string.IsNullOrEmpty(description)) {
+ description = "<missing description>";
+ }
+
+ var isWatched = talk.State.FirstOrDefault(q => q.Guid == HttpContext.Session.GetString("bookmark"))?.State == "watched";
+ var isMarked = talk.State.FirstOrDefault(q => q.Guid == HttpContext.Session.GetString("bookmark"))?.State == "marked";
+ var file = talk.Talk.Recordings.FirstOrDefault(p => System.IO.File.Exists(System.IO.Path.Combine(c3stream.CachePath, talk.Talk.ConferenceUrl.AbsoluteUri.Split("/").Last(), p.Filename)));
+ var eventName = talk.Talk.Tags[0].Replace("-", "-
");
+
+ int tagFormat;
+ switch (talk.Talk.ConferenceUrl.AbsoluteUri.Split("/").Last()) {
+ case "36c3":
+ tagFormat = 2;
+ break;
+ case "35c3":
+ case "34c3":
+ tagFormat = 1;
+ break;
+ case "33c3":
+ tagFormat = 0;
+ break;
+ default:
+ Response.Redirect("/");
+ return;
+ }
+
+ var category = tagFormat switch {
+ 0 => talk.Talk.Tags[0],
+ 1 => talk.Talk.Tags[2],
+ 2 => talk.Talk.Tags[3],
+ _ => ""
+ };
+}
+
+@if (isWatched) {
+
@title - @speakers
+}
+else if (isMarked) {
+
@title - @speakers
+}
+else {
+
@title - @speakers
+}
+
+
+
+
+
+ @if (file != null) {
+
+
+
+ }
+ else {
+
+
+
+ }
+ @if (isWatched) {
+
+
+ }
+ else if (isMarked) {
+
+
+ }
+ else {
+
+
+ }
+
+
+
+ @Html.Raw(description.Replace("\n", "
").Replace("
", "").Replace("
", ""))
+
+
+Share this talk:
+
https://@Request.Host.Value/Info?guid=@Request.Query["guid"]
\ No newline at end of file
diff --git a/Pages/Info.cshtml.cs b/Pages/Info.cshtml.cs
new file mode 100644
index 0000000..3b8a73f
--- /dev/null
+++ b/Pages/Info.cshtml.cs
@@ -0,0 +1,12 @@
+using Microsoft.AspNetCore.Mvc.RazorPages;
+using Microsoft.Extensions.Logging;
+
+namespace c3stream.Pages {
+ public class InfoModel : PageModel {
+ private readonly ILogger
_logger;
+
+ public InfoModel(ILogger logger) => _logger = logger;
+
+ public void OnGet() { }
+ }
+}
\ No newline at end of file
diff --git a/wwwroot/js/site.js b/wwwroot/js/site.js
index 708b846..99873cf 100644
--- a/wwwroot/js/site.js
+++ b/wwwroot/js/site.js
@@ -3,12 +3,24 @@
// Write your Javascript code.
-function SetState(guid, state){
- $.get("/Conference?state="+state+"&guid="+guid, function(data, status){
+function SetState(guid, state) {
+ $.get("/Conference?state=" + state + "&guid=" + guid, function (data, status) {
location.reload();
});
}
+function copyToClipboard(field) {
+ let textarea = document.createElement('textarea');
+ textarea.id = 't';
+ textarea.style.height = "0";
+ document.body.appendChild(textarea);
+ textarea.value = field.innerText;
+ let selector = document.querySelector('#t');
+ selector.select();
+ document.execCommand('copy');
+ document.body.removeChild(textarea);
+}
+
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
\ No newline at end of file