Deploying to gh-pages from @ fb12de289d960880fb412f507313979d1b07aa94 🚀

This commit is contained in:
realaravinth 2023-10-29 12:56:35 +00:00
parent 0ac2f3c185
commit 3de38ff7ad
28 changed files with 180 additions and 38 deletions

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_maria/lib.rs.html#92-1187">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_maria/lib.rs.html#92-1222">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_maria/lib.rs.html#92-1187">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_maria/lib.rs.html#92-1222">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_maria/lib.rs.html#92-1187">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../../dev/trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_maria/lib.rs.html#92-1222">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../../dev/trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_maria/lib.rs.html#92-1187">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../dev/trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_maria/lib.rs.html#92-1222">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../dev/trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../src/db_sqlx_maria/lib.rs.html#92-1187">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="dev/trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../src/db_sqlx_maria/lib.rs.html#92-1222">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="dev/trait.MCDatabase.html" title="trait db_sqlx_maria::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../struct.Database.html" title="struct db_sqlx_maria::Database">Database</a></h3></section></div><script src="../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_postgres/lib.rs.html#92-1194">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_postgres/lib.rs.html#92-1230">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_postgres/lib.rs.html#92-1194">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_postgres/lib.rs.html#92-1230">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_postgres/lib.rs.html#92-1194">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../../dev/trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../../src/db_sqlx_postgres/lib.rs.html#92-1230">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../../dev/trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_postgres/lib.rs.html#92-1194">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../dev/trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../../src/db_sqlx_postgres/lib.rs.html#92-1230">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="../dev/trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

View File

@ -738,4 +738,4 @@ trait.</p>
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,</span></h4></section></summary><div class="docblock"><p>Get publishing status of pow analytics for captcha ID/ campaign ID</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../src/db_sqlx_postgres/lib.rs.html#92-1194">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="dev/trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-MCDatabase-for-Database" class="impl"><a class="src rightside" href="../../src/db_sqlx_postgres/lib.rs.html#92-1230">source</a><a href="#impl-MCDatabase-for-Database" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="dev/trait.MCDatabase.html" title="trait db_sqlx_postgres::dev::dev::MCDatabase">MCDatabase</a> for <a class="struct" href="../struct.Database.html" title="struct db_sqlx_postgres::Database">Database</a></h3></section></div><script src="../../implementors/db_core/trait.MCDatabase.js" async></script></section></div></main></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1253,6 +1253,41 @@
<a href="#1253" id="1253">1253</a>
<a href="#1254" id="1254">1254</a>
<a href="#1255" id="1255">1255</a>
<a href="#1256" id="1256">1256</a>
<a href="#1257" id="1257">1257</a>
<a href="#1258" id="1258">1258</a>
<a href="#1259" id="1259">1259</a>
<a href="#1260" id="1260">1260</a>
<a href="#1261" id="1261">1261</a>
<a href="#1262" id="1262">1262</a>
<a href="#1263" id="1263">1263</a>
<a href="#1264" id="1264">1264</a>
<a href="#1265" id="1265">1265</a>
<a href="#1266" id="1266">1266</a>
<a href="#1267" id="1267">1267</a>
<a href="#1268" id="1268">1268</a>
<a href="#1269" id="1269">1269</a>
<a href="#1270" id="1270">1270</a>
<a href="#1271" id="1271">1271</a>
<a href="#1272" id="1272">1272</a>
<a href="#1273" id="1273">1273</a>
<a href="#1274" id="1274">1274</a>
<a href="#1275" id="1275">1275</a>
<a href="#1276" id="1276">1276</a>
<a href="#1277" id="1277">1277</a>
<a href="#1278" id="1278">1278</a>
<a href="#1279" id="1279">1279</a>
<a href="#1280" id="1280">1280</a>
<a href="#1281" id="1281">1281</a>
<a href="#1282" id="1282">1282</a>
<a href="#1283" id="1283">1283</a>
<a href="#1284" id="1284">1284</a>
<a href="#1285" id="1285">1285</a>
<a href="#1286" id="1286">1286</a>
<a href="#1287" id="1287">1287</a>
<a href="#1288" id="1288">1288</a>
<a href="#1289" id="1289">1289</a>
<a href="#1290" id="1290">1290</a>
</pre></div><pre class="rust"><code><span class="comment">// Copyright (C) 2022 Aravinth Manivannan &lt;realaravinth@batsense.net&gt;
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan &lt;realaravinth@batsense.net&gt;
//
@ -2418,7 +2453,12 @@
nonce: i32,
}
<span class="kw">let </span>res = <span class="macro">sqlx::query_as!</span>(
<span class="kw">async fn </span>inner_get_max_nonce(
pool: <span class="kw-2">&amp;</span>MySqlPool,
captcha_key: <span class="kw-2">&amp;</span>str,
difficulty_factor: u32,
) -&gt; DBResult&lt;X&gt; {
<span class="macro">sqlx::query_as!</span>(
X,
<span class="string">&quot;SELECT nonce FROM mcaptcha_track_nonce
WHERE level_id = (
@ -2434,10 +2474,40 @@
<span class="kw-2">&amp;</span>captcha_key,
difficulty_factor <span class="kw">as </span>i32,
)
.fetch_one(<span class="kw-2">&amp;</span><span class="self">self</span>.pool).<span class="kw">await
.fetch_one(pool).<span class="kw">await
</span>.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))
}
<span class="kw">let </span>res = inner_get_max_nonce(<span class="kw-2">&amp;</span><span class="self">self</span>.pool, captcha_key, difficulty_factor).<span class="kw">await</span>;
<span class="kw">if let </span><span class="prelude-val">Err</span>(DBError::CaptchaNotFound) = res {
<span class="macro">sqlx::query!</span>(
<span class="string">&quot;INSERT INTO
mcaptcha_track_nonce (level_id, nonce)
VALUES ((
SELECT
level_id
FROM
mcaptcha_levels
WHERE
config_id = (SELECT config_id FROM mcaptcha_config WHERE captcha_key =?)
AND
difficulty_factor = ?
), ?);&quot;</span>,
<span class="kw-2">&amp;</span>captcha_key,
difficulty_factor <span class="kw">as </span>i32,
<span class="number">0</span>,
)
.execute(<span class="kw-2">&amp;</span><span class="self">self</span>.pool)
.<span class="kw">await
</span>.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(res.nonce <span class="kw">as </span>u32)
<span class="kw">let </span>res =
inner_get_max_nonce(<span class="kw-2">&amp;</span><span class="self">self</span>.pool, captcha_key, difficulty_factor).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(res.nonce <span class="kw">as </span>u32)
} <span class="kw">else </span>{
<span class="kw">let </span>res = res<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(res.nonce <span class="kw">as </span>u32)
}
}
}

View File

@ -1260,6 +1260,42 @@
<a href="#1260" id="1260">1260</a>
<a href="#1261" id="1261">1261</a>
<a href="#1262" id="1262">1262</a>
<a href="#1263" id="1263">1263</a>
<a href="#1264" id="1264">1264</a>
<a href="#1265" id="1265">1265</a>
<a href="#1266" id="1266">1266</a>
<a href="#1267" id="1267">1267</a>
<a href="#1268" id="1268">1268</a>
<a href="#1269" id="1269">1269</a>
<a href="#1270" id="1270">1270</a>
<a href="#1271" id="1271">1271</a>
<a href="#1272" id="1272">1272</a>
<a href="#1273" id="1273">1273</a>
<a href="#1274" id="1274">1274</a>
<a href="#1275" id="1275">1275</a>
<a href="#1276" id="1276">1276</a>
<a href="#1277" id="1277">1277</a>
<a href="#1278" id="1278">1278</a>
<a href="#1279" id="1279">1279</a>
<a href="#1280" id="1280">1280</a>
<a href="#1281" id="1281">1281</a>
<a href="#1282" id="1282">1282</a>
<a href="#1283" id="1283">1283</a>
<a href="#1284" id="1284">1284</a>
<a href="#1285" id="1285">1285</a>
<a href="#1286" id="1286">1286</a>
<a href="#1287" id="1287">1287</a>
<a href="#1288" id="1288">1288</a>
<a href="#1289" id="1289">1289</a>
<a href="#1290" id="1290">1290</a>
<a href="#1291" id="1291">1291</a>
<a href="#1292" id="1292">1292</a>
<a href="#1293" id="1293">1293</a>
<a href="#1294" id="1294">1294</a>
<a href="#1295" id="1295">1295</a>
<a href="#1296" id="1296">1296</a>
<a href="#1297" id="1297">1297</a>
<a href="#1298" id="1298">1298</a>
</pre></div><pre class="rust"><code><span class="comment">// Copyright (C) 2022 Aravinth Manivannan &lt;realaravinth@batsense.net&gt;
// SPDX-FileCopyrightText: 2023 Aravinth Manivannan &lt;realaravinth@batsense.net&gt;
//
@ -2432,7 +2468,12 @@
nonce: i32,
}
<span class="kw">let </span>res = <span class="macro">sqlx::query_as!</span>(
<span class="kw">async fn </span>inner_get_max_nonce(
pool: <span class="kw-2">&amp;</span>PgPool,
captcha_key: <span class="kw-2">&amp;</span>str,
difficulty_factor: u32,
) -&gt; DBResult&lt;X&gt; {
<span class="macro">sqlx::query_as!</span>(
X,
<span class="string">&quot;SELECT nonce FROM mcaptcha_track_nonce
WHERE level_id = (
@ -2448,10 +2489,41 @@
<span class="kw-2">&amp;</span>captcha_key,
difficulty_factor <span class="kw">as </span>i32,
)
.fetch_one(<span class="kw-2">&amp;</span><span class="self">self</span>.pool).<span class="kw">await
.fetch_one(pool)
.<span class="kw">await
</span>.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))
}
<span class="kw">let </span>res = inner_get_max_nonce(<span class="kw-2">&amp;</span><span class="self">self</span>.pool, captcha_key, difficulty_factor).<span class="kw">await</span>;
<span class="kw">if let </span><span class="prelude-val">Err</span>(DBError::CaptchaNotFound) = res {
<span class="macro">sqlx::query!</span>(
<span class="string">&quot;INSERT INTO
mcaptcha_track_nonce (level_id, nonce)
VALUES ((
SELECT
level_id
FROM
mcaptcha_levels
WHERE
config_id = (SELECT config_id FROM mcaptcha_config WHERE key = ($1))
AND
difficulty_factor = $2
), $3);&quot;</span>,
<span class="kw-2">&amp;</span>captcha_key,
difficulty_factor <span class="kw">as </span>i32,
<span class="number">0</span>,
)
.execute(<span class="kw-2">&amp;</span><span class="self">self</span>.pool)
.<span class="kw">await
</span>.map_err(|e| map_row_not_found_err(e, DBError::CaptchaNotFound))<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(res.nonce <span class="kw">as </span>u32)
<span class="kw">let </span>res =
inner_get_max_nonce(<span class="kw-2">&amp;</span><span class="self">self</span>.pool, captcha_key, difficulty_factor).<span class="kw">await</span><span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(res.nonce <span class="kw">as </span>u32)
} <span class="kw">else </span>{
<span class="kw">let </span>res = res<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(res.nonce <span class="kw">as </span>u32)
}
}
}