From 00e27a774abbd9a45e52528652247e3f137b4265 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 18 Jun 2017 14:56:06 +0100 Subject: [PATCH] Remove pastie_page token and add a submit_page one instead (bool). --- src/kamokan_impl/edit_response.hpp | 1 + src/kamokan_impl/general_pastie_response.cpp | 1 - src/kamokan_impl/index_response.hpp | 1 + src/kamokan_impl/response.cpp | 2 +- src/kamokan_impl/response.hpp | 1 + 5 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kamokan_impl/edit_response.hpp b/src/kamokan_impl/edit_response.hpp index 0ef32f5..515c4e0 100644 --- a/src/kamokan_impl/edit_response.hpp +++ b/src/kamokan_impl/edit_response.hpp @@ -36,5 +36,6 @@ namespace kamokan { private: virtual void on_general_mustache_prepare (std::string&& parPastie, mstch::map& parContext) override; virtual tawashi::HttpHeader on_general_pastie_process() override; + virtual bool is_submit_page() override { return true; } }; } //namespace kamokan diff --git a/src/kamokan_impl/general_pastie_response.cpp b/src/kamokan_impl/general_pastie_response.cpp index 2857527..4ca6206 100644 --- a/src/kamokan_impl/general_pastie_response.cpp +++ b/src/kamokan_impl/general_pastie_response.cpp @@ -67,7 +67,6 @@ namespace kamokan { parContext["self_destructed"] = m_pastie_info.self_destructed; parContext["pastie_token"] = get_search_token(cgi_env()); - parContext["pastie_page"] = true; this->on_general_mustache_prepare(std::move(*m_pastie_info.pastie), parContext); } diff --git a/src/kamokan_impl/index_response.hpp b/src/kamokan_impl/index_response.hpp index 9d15b69..dd1c073 100644 --- a/src/kamokan_impl/index_response.hpp +++ b/src/kamokan_impl/index_response.hpp @@ -31,6 +31,7 @@ namespace kamokan { protected: virtual boost::string_view page_basename() const override { return boost::string_view("index"); } + virtual bool is_submit_page() override { return true; } private: }; diff --git a/src/kamokan_impl/response.cpp b/src/kamokan_impl/response.cpp index 29e19de..140529a 100644 --- a/src/kamokan_impl/response.cpp +++ b/src/kamokan_impl/response.cpp @@ -174,7 +174,7 @@ namespace kamokan { statuslog->info("Sending response"); SPDLOG_TRACE(statuslog, "Preparing mustache dictionary"); mstch::map mustache_context { - {"pastie_page", false}, + {"submit_page", this->is_submit_page()}, {"version", boost::string_view{STRINGIZE(VERSION_MAJOR) "." STRINGIZE(VERSION_MINOR) "." STRINGIZE(VERSION_PATCH)}}, {"tawashi_version", tawashi::version()}, {"base_uri", base_uri()}, diff --git a/src/kamokan_impl/response.hpp b/src/kamokan_impl/response.hpp index 0adf5fc..3183d3b 100644 --- a/src/kamokan_impl/response.hpp +++ b/src/kamokan_impl/response.hpp @@ -69,6 +69,7 @@ namespace kamokan { virtual tawashi::HttpHeader on_process(); virtual void on_mustache_prepare (mstch::map& parContext); virtual std::string on_mustache_retrieve(); + virtual bool is_submit_page() { return false; } Storage m_storage; Kakoune::SafePtr m_cgi_env;