mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-12 02:25:41 +00:00
Deploying to gh-pages from @ 6ef941f73d 🚀
This commit is contained in:
@@ -188,7 +188,7 @@
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">handle_embedded_file</span>(<span class="ident">path</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">match</span> <span class="ident">Asset::get</span>(<span class="ident">path</span>) {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">content</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">body</span>: <span class="ident">Body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">content</span> {
|
||||
<span class="kw">let</span> <span class="ident">body</span>: <span class="ident">Body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">content</span>.<span class="ident">data</span> {
|
||||
<span class="ident">Cow::Borrowed</span>(<span class="ident">bytes</span>) <span class="op">=</span><span class="op">></span> <span class="ident">bytes</span>.<span class="ident">into</span>(),
|
||||
<span class="ident">Cow::Owned</span>(<span class="ident">bytes</span>) <span class="op">=</span><span class="op">></span> <span class="ident">bytes</span>.<span class="ident">into</span>(),
|
||||
};
|
||||
|
||||
@@ -106,6 +106,18 @@
|
||||
<span id="104">104</span>
|
||||
<span id="105">105</span>
|
||||
<span id="106">106</span>
|
||||
<span id="107">107</span>
|
||||
<span id="108">108</span>
|
||||
<span id="109">109</span>
|
||||
<span id="110">110</span>
|
||||
<span id="111">111</span>
|
||||
<span id="112">112</span>
|
||||
<span id="113">113</span>
|
||||
<span id="114">114</span>
|
||||
<span id="115">115</span>
|
||||
<span id="116">116</span>
|
||||
<span id="117">117</span>
|
||||
<span id="118">118</span>
|
||||
</pre><pre class="rust">
|
||||
<span class="comment">/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
@@ -165,24 +177,36 @@
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">TemplateOnce</span>, <span class="ident">Clone</span>)]</span>
|
||||
<span class="attribute">#[<span class="ident">template</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">"panel/settings/index.html"</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">IndexPage</span> {
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">IndexPage</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> {
|
||||
<span class="ident">email</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
||||
<span class="ident">secret</span>: <span class="ident">String</span>,
|
||||
<span class="ident">username</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span>,
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">my_codegen::get</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">"crate::PAGES.panel.settings.home"</span>, <span class="ident">wrap</span> <span class="op">=</span> <span class="string">"crate::CheckLogin"</span>)]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">settings</span>(<span class="ident">data</span>: <span class="ident">AppData</span>, <span class="ident">id</span>: <span class="ident">Identity</span>) <span class="op">-</span><span class="op">></span> <span class="ident">PageResult</span><span class="op"><</span><span class="kw">impl</span> <span class="ident">Responder</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">username</span> <span class="op">=</span> <span class="ident">id</span>.<span class="ident">identity</span>().<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="kw">struct</span> <span class="ident">DBResult</span> {
|
||||
<span class="ident">email</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
||||
<span class="ident">secret</span>: <span class="ident">String</span>,
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="ident">details</span> <span class="op">=</span> <span class="macro">sqlx::query_as!</span>(
|
||||
<span class="ident">IndexPage</span>,
|
||||
<span class="ident">DBResult</span>,
|
||||
<span class="string">r#"SELECT email, secret FROM mcaptcha_users WHERE name = ($1)"#</span>,
|
||||
<span class="kw-2">&</span><span class="ident">username</span>,
|
||||
)
|
||||
.<span class="ident">fetch_one</span>(<span class="kw-2">&</span><span class="ident">data</span>.<span class="ident">db</span>)
|
||||
.<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="ident">body</span> <span class="op">=</span> <span class="ident">details</span>.<span class="ident">render_once</span>().<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="ident">data</span> <span class="op">=</span> <span class="ident">IndexPage</span> {
|
||||
<span class="ident">email</span>: <span class="ident">details</span>.<span class="ident">email</span>,
|
||||
<span class="ident">secret</span>: <span class="ident">details</span>.<span class="ident">secret</span>,
|
||||
<span class="ident">username</span>: <span class="kw-2">&</span><span class="ident">username</span>,
|
||||
};
|
||||
|
||||
<span class="kw">let</span> <span class="ident">body</span> <span class="op">=</span> <span class="ident">data</span>.<span class="ident">render_once</span>().<span class="ident">unwrap</span>();
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">HttpResponse::Ok</span>()
|
||||
.<span class="ident">content_type</span>(<span class="string">"text/html; charset=utf-8"</span>)
|
||||
.<span class="ident">body</span>(<span class="ident">body</span>))
|
||||
|
||||
@@ -48,21 +48,21 @@
|
||||
<span id="46">46</span>
|
||||
</pre><pre class="rust">
|
||||
<span class="comment">/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/</span>
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/</span>
|
||||
<span class="kw">use</span> <span class="ident">cache_buster::Files</span>;
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">FileMap</span> {
|
||||
|
||||
@@ -25,25 +25,23 @@
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
</pre><pre class="rust">
|
||||
<span class="comment">/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/</span>
|
||||
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/</span>
|
||||
<span class="kw">pub</span> <span class="kw">mod</span> <span class="ident">filemap</span>;
|
||||
<span class="kw">pub</span> <span class="kw">mod</span> <span class="ident">static_files</span>;
|
||||
|
||||
|
||||
@@ -206,21 +206,21 @@
|
||||
<span id="204">204</span>
|
||||
</pre><pre class="rust">
|
||||
<span class="comment">/*
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/</span>
|
||||
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/</span>
|
||||
<span class="kw">use</span> <span class="ident">std::borrow::Cow</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">actix_web::body::Body</span>;
|
||||
@@ -289,7 +289,7 @@
|
||||
<span class="kw">fn</span> <span class="ident">handle_assets</span>(<span class="ident">path</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">match</span> <span class="ident">Asset::get</span>(<span class="ident">path</span>) {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">content</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">body</span>: <span class="ident">Body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">content</span> {
|
||||
<span class="kw">let</span> <span class="ident">body</span>: <span class="ident">Body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">content</span>.<span class="ident">data</span> {
|
||||
<span class="ident">Cow::Borrowed</span>(<span class="ident">bytes</span>) <span class="op">=</span><span class="op">></span> <span class="ident">bytes</span>.<span class="ident">into</span>(),
|
||||
<span class="ident">Cow::Owned</span>(<span class="ident">bytes</span>) <span class="op">=</span><span class="op">></span> <span class="ident">bytes</span>.<span class="ident">into</span>(),
|
||||
};
|
||||
@@ -319,7 +319,7 @@
|
||||
<span class="kw">fn</span> <span class="ident">handle_favicons</span>(<span class="ident">path</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">match</span> <span class="ident">Favicons::get</span>(<span class="ident">path</span>) {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">content</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">body</span>: <span class="ident">Body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">content</span> {
|
||||
<span class="kw">let</span> <span class="ident">body</span>: <span class="ident">Body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">content</span>.<span class="ident">data</span> {
|
||||
<span class="ident">Cow::Borrowed</span>(<span class="ident">bytes</span>) <span class="op">=</span><span class="op">></span> <span class="ident">bytes</span>.<span class="ident">into</span>(),
|
||||
<span class="ident">Cow::Owned</span>(<span class="ident">bytes</span>) <span class="op">=</span><span class="op">></span> <span class="ident">bytes</span>.<span class="ident">into</span>(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user