Deploying to gh-pages from @ 595e79a014 🚀

This commit is contained in:
realaravinth
2021-08-12 11:58:19 +00:00
parent f76498721d
commit 38349faa10
65 changed files with 974 additions and 256 deletions

View File

@@ -133,21 +133,21 @@
<span id="131">131</span>
</pre><pre class="rust">
<span class="comment">/*
* Copyright (C) 2021 Aravinth Manivannan &lt;realaravinth@batsense.net&gt;
*
* 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 &lt;https://www.gnu.org/licenses/&gt;.
*/</span>
* Copyright (C) 2021 Aravinth Manivannan &lt;realaravinth@batsense.net&gt;
*
* 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 &lt;https://www.gnu.org/licenses/&gt;.
*/</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>;
@@ -178,10 +178,7 @@
}
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">services</span>(<span class="ident">cfg</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">web::ServiceConfig</span>) {
<span class="kw">use</span> <span class="kw">crate</span><span class="ident">::define_resource</span>;
<span class="macro">define_resource!</span>(<span class="ident">cfg</span>, <span class="kw-2">&amp;</span><span class="ident">DOCS</span>.<span class="ident">home</span>[<span class="number">0</span>..<span class="ident">DOCS</span>.<span class="ident">home</span>.<span class="ident">len</span>() <span class="op">-</span> <span class="number">1</span>], <span class="ident">Methods::Get</span>, <span class="ident">index</span>);
<span class="macro">define_resource!</span>(<span class="ident">cfg</span>, <span class="ident">DOCS</span>.<span class="ident">spec</span>, <span class="ident">Methods::Get</span>, <span class="ident">spec</span>);
<span class="macro">define_resource!</span>(<span class="ident">cfg</span>, <span class="ident">DOCS</span>.<span class="ident">assets</span>, <span class="ident">Methods::Get</span>, <span class="ident">dist</span>);
<span class="ident">cfg</span>.<span class="ident">service</span>(<span class="ident">index</span>).<span class="ident">service</span>(<span class="ident">spec</span>).<span class="ident">service</span>(<span class="ident">dist</span>);
}
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">RustEmbed</span>)]</span>
@@ -206,16 +203,19 @@
}
}
<span class="attribute">#[<span class="ident">my_codegen::get</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;DOCS.assets&quot;</span>)]</span>
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">dist</span>(<span class="ident">path</span>: <span class="ident">web::Path</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="kw">impl</span> <span class="ident">Responder</span> {
<span class="ident">handle_embedded_file</span>(<span class="kw-2">&amp;</span><span class="ident">path</span>)
}
<span class="attribute">#[<span class="ident">my_codegen::get</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;DOCS.spec&quot;</span>)]</span>
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">spec</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">HttpResponse</span> {
<span class="ident">HttpResponse::Ok</span>()
.<span class="ident">content_type</span>(<span class="string">&quot;appilcation/json&quot;</span>)
.<span class="ident">body</span>(<span class="kw-2">&amp;</span><span class="kw-2">*</span><span class="kw">crate</span><span class="ident">::OPEN_API_DOC</span>)
}
<span class="attribute">#[<span class="ident">my_codegen::get</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;&amp;DOCS.home[0..DOCS.home.len() -1]&quot;</span>)]</span>
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>() <span class="op">-</span><span class="op">&gt;</span> <span class="ident">HttpResponse</span> {
<span class="ident">handle_embedded_file</span>(<span class="string">&quot;index.html&quot;</span>)
}