Skip to content

Commit

Permalink
Show automated and no action boosts in the Boosts tab
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpp committed Oct 25, 2023
1 parent 91e61b7 commit aa8dbd3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion dbif/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ pub fn get_boosts_from_db(filepath: &String, index: u64, max: u64, direction: bo
ltgt = "<=";
}

//Query for anything that's not a stream
let sqltxt = format!("SELECT idx, \
time, \
value_msat, \
Expand All @@ -250,7 +251,7 @@ pub fn get_boosts_from_db(filepath: &String, index: u64, max: u64, direction: bo
remote_podcast, \
remote_episode \
FROM boosts \
WHERE action = 2 \
WHERE action != 1 \
AND idx {} :index \
ORDER BY idx DESC \
LIMIT :max", ltgt);
Expand Down
7 changes: 4 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub struct PodcastEpisodeGuid {
//Traits------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------
fn d_action() -> Option<String> {
Some("stream".to_string())
Some("".to_string()) // default to empty if not set
}

fn d_blank() -> Option<String> {
Expand Down Expand Up @@ -635,8 +635,9 @@ async fn lnd_poller(server_config: Config, database_file_path: String) {
if rawboost.action.is_some() {
boost.action = match rawboost.action.unwrap().as_str() {
"stream" => 1, //This indicates a per-minute podcast payment
"boost" => 2, //This is a manual boost or boost-a-gram
_ => 3,
"boost" => 2, //This is a manual boost or boost-a-gram
"auto" => 4, //This is an automated boost
_ => 3, //Invalid or no action (set to 3 for legacy reasons)
}
}
//Was a sender name given in the tlv?
Expand Down
14 changes: 13 additions & 1 deletion webroot/script/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ $(document).ready(function () {
boostDisplayAmount = '<span class="more_info" title="' + numberFormat(boostActualSats) + ' sats received after splits/fees.">' + boostDisplayAmount + '</span>';
}

//Show clock icon for automated boosts
if (boostTlv && boostTlv.action == "auto") {
boostDisplayAmount = `
<span title="Automated boost">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-clock" viewBox="0 0 16 16" style="vertical-align: bottom;">
<path d="M8.515 1.019A7 7 0 0 0 8 1V0a8 8 0 0 1 .589.022l-.074.997zm2.004.45a7.003 7.003 0 0 0-.985-.299l.219-.976c.383.086.76.2 1.126.342l-.36.933zm1.37.71a7.01 7.01 0 0 0-.439-.27l.493-.87a8.025 8.025 0 0 1 .979.654l-.615.789a6.996 6.996 0 0 0-.418-.302zm1.834 1.79a6.99 6.99 0 0 0-.653-.796l.724-.69c.27.285.52.59.747.91l-.818.576zm.744 1.352a7.08 7.08 0 0 0-.214-.468l.893-.45a7.976 7.976 0 0 1 .45 1.088l-.95.313a7.023 7.023 0 0 0-.179-.483zm.53 2.507a6.991 6.991 0 0 0-.1-1.025l.985-.17c.067.386.106.778.116 1.17l-1 .025zm-.131 1.538c.033-.17.06-.339.081-.51l.993.123a7.957 7.957 0 0 1-.23 1.155l-.964-.267c.046-.165.086-.332.12-.501zm-.952 2.379c.184-.29.346-.594.486-.908l.914.405c-.16.36-.345.706-.555 1.038l-.845-.535zm-.964 1.205c.122-.122.239-.248.35-.378l.758.653a8.073 8.073 0 0 1-.401.432l-.707-.707z"/>
<path d="M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0v1z"/>
<path d="M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5z"/>
</svg>
</span>` + boostDisplayAmount;
}

//Determine the numerology behind the sat amount
boostNumerology = gatherNumerology(boostSats);

Expand All @@ -138,7 +150,7 @@ $(document).ready(function () {
}
}

if (!messageIds.includes(boostIndex) && element.action == 2) {
if (!messageIds.includes(boostIndex) && element.action != 1) {
let dateTime = new Date(element.time * 1000).toISOString();
$('div.nodata').remove();

Expand Down

0 comments on commit aa8dbd3

Please sign in to comment.