diff --git a/views/layout.php b/views/layout.php
index 2c7b87d..3bbd478 100644
--- a/views/layout.php
+++ b/views/layout.php
@@ -6,6 +6,9 @@
Poll Verlaine
/static/css/main.css" />
+
+= $head ?>
+
= $body_content ?>
diff --git a/views/opengraph.php b/views/opengraph.php
new file mode 100644
index 0000000..469c4f6
--- /dev/null
+++ b/views/opengraph.php
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/webroot/index.php b/webroot/index.php
index 8a3d22d..55d1ebe 100644
--- a/webroot/index.php
+++ b/webroot/index.php
@@ -37,6 +37,7 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) {
else
{
Flight::render("poll", ["app_url" => $VERLAINE["app_url"], "poll" => $poll], "body_content");
+ Flight::render("opengraph", ["poll" => $poll, "app_url" => $VERLAINE["app_url"]], "head");
Flight::render("layout");
}
}
@@ -105,6 +106,7 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+/results", function ($id) {
{
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]], "results_chart");
Flight::render("results", ["poll" => $poll, "chart_colors" => $VERLAINE["chart_colors"]], "body_content");
+ Flight::render("opengraph", ["poll" => $poll, "app_url" => $VERLAINE["app_url"]], "head");
Flight::render("layout");
}
}
@@ -136,6 +138,17 @@ Flight::route("GET|DELETE /polls/@id:[a-fA-F0-9]+/@token:[a-fA-F0-9]+", function
Flight::notFound();
});
+Flight::route("GET /polls/@id:[a-fA-F0-9]+/results/svg", function ($id) {
+ global $VERLAINE;
+ $poll = Poll::load_poll($id);
+ if ($poll)
+ {
+ Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]]);
+ }
+ else
+ Flight::notFound();
+});
+
Flight::route("/", function () {
global $VERLAINE;
Flight::render("home", ["app_url" => $VERLAINE["app_url"]], "body_content");