Deploying to gh-pages from @ 3d9056e968 🚀

This commit is contained in:
realaravinth
2022-08-05 09:28:47 +00:00
parent e5d3b937e7
commit 7fb06637a0
174 changed files with 298 additions and 298 deletions

View File

@@ -293,7 +293,7 @@
<span class="kw">pub</span> <span class="ident">password</span>: <span class="ident">String</span>,
}
<span class="doccomment">/// returns Ok(()) when everything checks out and the user is authenticated. Erros otherwise</span>
<span class="doccomment">/// returns Ok(()) when everything checks out and the user is authenticated. Errors otherwise</span>
<span class="kw">pub</span> <span class="kw">async</span> <span class="kw">fn</span> <span class="ident">login_runner</span>(<span class="ident">payload</span>: <span class="ident">Login</span>, <span class="ident">data</span>: <span class="kw-2">&amp;</span><span class="ident">AppData</span>) -&gt; <span class="ident">ServiceResult</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">use</span> <span class="ident">argon2_creds::Config</span>;

View File

@@ -459,7 +459,7 @@
<span class="kw">pub</span> <span class="ident">avg_traffic</span>: <span class="ident">u32</span>,
<span class="doccomment">/// the peak traffic that the user&#39;s website can handle</span>
<span class="kw">pub</span> <span class="ident">peak_sustainable_traffic</span>: <span class="ident">u32</span>,
<span class="doccomment">/// trafic that bought the user&#39;s website down; optional</span>
<span class="doccomment">/// traffic that bought the user&#39;s website down; optional</span>
<span class="kw">pub</span> <span class="ident">broke_my_site_traffic</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">u32</span><span class="op">&gt;</span>,
<span class="doccomment">/// Captcha description</span>
<span class="kw">pub</span> <span class="ident">description</span>: <span class="ident">String</span>,

View File

@@ -413,7 +413,7 @@
<span class="kw">let</span> <span class="ident">updated_token</span>: <span class="ident">MCaptchaDetails</span> <span class="op">=</span>
<span class="ident">test::read_body_json</span>(<span class="ident">update_token_resp</span>).<span class="kw">await</span>;
<span class="comment">// get levels with udpated key</span>
<span class="comment">// get levels with updated key</span>
<span class="kw">let</span> <span class="ident">get_token_resp</span> <span class="op">=</span> <span class="ident">test::call_service</span>(
<span class="kw-2">&amp;</span><span class="ident">app</span>,
<span class="macro">post_request!</span>(<span class="kw-2">&amp;</span><span class="ident">updated_token</span>, <span class="ident">ROUTES</span>.<span class="ident">captcha</span>.<span class="ident">get</span>)
@@ -421,7 +421,7 @@
.<span class="ident">to_request</span>(),
)
.<span class="kw">await</span>;
<span class="comment">// if updated key doesn&#39;t exist in databse, a non 200 result will bereturned</span>
<span class="comment">// if updated key doesn&#39;t exist in database, a non 200 result will bereturned</span>
<span class="macro">assert_eq!</span>(<span class="ident">get_token_resp</span>.<span class="ident">status</span>(), <span class="ident">StatusCode::OK</span>);
<span class="comment">// get stats</span>
@@ -433,7 +433,7 @@
.<span class="ident">to_request</span>(),
)
.<span class="kw">await</span>;
<span class="comment">// if updated key doesn&#39;t exist in databse, a non 200 result will bereturned</span>
<span class="comment">// if updated key doesn&#39;t exist in database, a non 200 result will bereturned</span>
<span class="macro">assert_eq!</span>(<span class="ident">get_statis_resp</span>.<span class="ident">status</span>(), <span class="ident">StatusCode::OK</span>);
}
}

View File

@@ -204,7 +204,7 @@
}
}
<span class="doccomment">/// emmits build details of the bninary</span>
<span class="doccomment">/// emits build details of the bninary</span>
<span class="attribute">#[<span class="ident">my_codegen::get</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;crate::V1_API_ROUTES.meta.build_details&quot;</span>)]</span>
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">build_details</span>() -&gt; <span class="kw">impl</span> <span class="ident">Responder</span> {
<span class="kw">let</span> <span class="ident">build</span> <span class="op">=</span> <span class="ident">BuildDetails</span> {

View File

@@ -160,7 +160,7 @@
<span class="ident">id</span>: <span class="ident">Identity</span>,
) -&gt; <span class="ident">ServiceResult</span><span class="op">&lt;</span><span class="kw">impl</span> <span class="ident">Responder</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">sender</span> <span class="op">=</span> <span class="ident">id</span>.<span class="ident">identity</span>().<span class="ident">unwrap</span>();
<span class="comment">// TODO handle error where payload.to doesnt exist</span>
<span class="comment">// TODO handle error where payload.to doesn&#39;t exist</span>
<span class="kw">let</span> <span class="ident">p</span> <span class="op">=</span> <span class="ident">AddNotification</span> {
<span class="ident">from</span>: <span class="kw-2">&amp;</span><span class="ident">sender</span>,
@@ -216,7 +216,7 @@
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="ident">AddNotificationRequest</span> {
<span class="ident">to</span>: <span class="ident">NAME2</span>.<span class="ident">into</span>(),
<span class="ident">heading</span>: <span class="string">&quot;Test notification&quot;</span>.<span class="ident">into</span>(),
<span class="ident">message</span>: <span class="string">&quot;Testeing notifications with a dummy message&quot;</span>.<span class="ident">into</span>(),
<span class="ident">message</span>: <span class="string">&quot;Testing notifications with a dummy message&quot;</span>.<span class="ident">into</span>(),
};
<span class="kw">let</span> <span class="ident">send_notification_resp</span> <span class="op">=</span> <span class="ident">test::call_service</span>(

View File

@@ -227,7 +227,7 @@
<span class="ident">id</span>: <span class="ident">Identity</span>,
) -&gt; <span class="ident">ServiceResult</span><span class="op">&lt;</span><span class="kw">impl</span> <span class="ident">Responder</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">receiver</span> <span class="op">=</span> <span class="ident">id</span>.<span class="ident">identity</span>().<span class="ident">unwrap</span>();
<span class="comment">// TODO handle error where payload.to doesnt exist</span>
<span class="comment">// TODO handle error where payload.to doesn&#39;t exist</span>
<span class="kw">let</span> <span class="ident">notifications</span> <span class="op">=</span> <span class="ident">data</span>.<span class="ident">db</span>.<span class="ident">get_all_unread_notifications</span>(<span class="kw-2">&amp;</span><span class="ident">receiver</span>).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="kw">let</span> <span class="ident">notifications</span> <span class="op">=</span> <span class="ident">NotificationResp::from_notifications</span>(<span class="ident">notifications</span>);

View File

@@ -195,7 +195,7 @@
<span class="ident">id</span>: <span class="ident">Identity</span>,
) -&gt; <span class="ident">ServiceResult</span><span class="op">&lt;</span><span class="kw">impl</span> <span class="ident">Responder</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">receiver</span> <span class="op">=</span> <span class="ident">id</span>.<span class="ident">identity</span>().<span class="ident">unwrap</span>();
<span class="comment">// TODO handle error where payload.to doesnt exist</span>
<span class="comment">// TODO handle error where payload.to doesn&#39;t exist</span>
<span class="comment">// TODO get payload from path /api/v1/notifications/{id}/read&quot;</span>
<span class="ident">data</span>.<span class="ident">db</span>

View File

@@ -283,7 +283,7 @@
<span class="comment">// .await;</span>
<span class="comment">// assert_eq!(pow_config_resp.status(), StatusCode::OK);</span>
<span class="comment">// I&#39;m not checking for errors because changing work.result triggered</span>
<span class="comment">// InssuficientDifficulty, which is possible becuase libmcaptcha calculates</span>
<span class="comment">// InssuficientDifficulty, which is possible because libmcaptcha calculates</span>
<span class="comment">// difficulty with the submitted result. Besides, this endpoint is merely</span>
<span class="comment">// propagating errors from libmcaptcha and libmcaptcha has tests covering the</span>
<span class="comment">// pow aspects ¯\_(ツ)_/¯</span>

View File

@@ -260,7 +260,7 @@
<span class="comment">// API keys are mcaptcha actor names</span>
<span class="doccomment">/// route hander that validates a PoW solution token</span>
<span class="doccomment">/// route handler that validates a PoW solution token</span>
<span class="attribute">#[<span class="ident">my_codegen::post</span>(<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;V1_API_ROUTES.pow.validate_captcha_token()&quot;</span>)]</span>
<span class="kw">pub</span> <span class="kw">async</span> <span class="kw">fn</span> <span class="ident">validate_captcha_token</span>(
<span class="ident">payload</span>: <span class="ident">web::Json</span><span class="op">&lt;</span><span class="ident">VerifyCaptchaResultPayload</span><span class="op">&gt;</span>,

View File

@@ -312,7 +312,7 @@
<span class="doccomment">/// Represents mCaptcha cache and master system.</span>
<span class="doccomment">/// When Redis is configured, [SystemGroup::Redis] is used and</span>
<span class="doccomment">/// in its absense, [SystemGroup::Embedded] is used</span>
<span class="doccomment">/// in its absence, [SystemGroup::Embedded] is used</span>
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">SystemGroup</span> {
<span class="ident">Embedded</span>(<span class="ident">System</span><span class="op">&lt;</span><span class="ident">HashCache</span>, <span class="ident">EmbeddedMaster</span><span class="op">&gt;</span>),
<span class="ident">Redis</span>(<span class="ident">System</span><span class="op">&lt;</span><span class="ident">RedisCache</span>, <span class="ident">RedisMaster</span><span class="op">&gt;</span>),

View File

@@ -206,7 +206,7 @@
)]</span>
<span class="kw">pub</span> <span class="kw">async</span> <span class="kw">fn</span> <span class="ident">notifications</span>(<span class="ident">data</span>: <span class="ident">AppData</span>, <span class="ident">id</span>: <span class="ident">Identity</span>) -&gt; <span class="ident">PageResult</span><span class="op">&lt;</span><span class="kw">impl</span> <span class="ident">Responder</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">receiver</span> <span class="op">=</span> <span class="ident">id</span>.<span class="ident">identity</span>().<span class="ident">unwrap</span>();
<span class="comment">// TODO handle error where payload.to doesnt exist</span>
<span class="comment">// TODO handle error where payload.to doesn&#39;t exist</span>
<span class="comment">// let mut notifications = runner::get_notification(&amp;data, &amp;receiver).await?;</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">notifications</span> <span class="op">=</span> <span class="ident">data</span>.<span class="ident">db</span>.<span class="ident">get_all_unread_notifications</span>(<span class="kw-2">&amp;</span><span class="ident">receiver</span>).<span class="kw">await</span><span class="question-mark">?</span>;

View File

@@ -334,7 +334,7 @@
<span class="comment">//impl DatabaseBuilder {</span>
<span class="comment">// #[cfg(not(tarpaulin_include))]</span>
<span class="comment">// fn extract_database_url(url: &amp;Url) -&gt; Self {</span>
<span class="comment">// debug!(&quot;Databse name: {}&quot;, url.path());</span>
<span class="comment">// debug!(&quot;Database name: {}&quot;, url.path());</span>
<span class="comment">// let mut path = url.path().split(&#39;/&#39;);</span>
<span class="comment">// path.next();</span>
<span class="comment">// let name = path.next().expect(&quot;no database name&quot;).to_string();</span>
@@ -479,7 +479,7 @@
.<span class="ident">expect</span>(<span class="string">&quot;Couldn&#39;t access database name&quot;</span>)
),
)
.<span class="ident">expect</span>(<span class="string">&quot;Couldn&#39;t set databse url&quot;</span>);
.<span class="ident">expect</span>(<span class="string">&quot;Couldn&#39;t set database url&quot;</span>);
}
<span class="comment">//#[cfg(test)]</span>