Skip to content

Commit

Permalink
rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Oct 16, 2024
1 parent 90f5764 commit bf22f52
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 179 deletions.
336 changes: 178 additions & 158 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions static/js/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Vue.component(VueQrcode.name, VueQrcode)

const mapCards = obj => {
obj.date = Quasar.utils.date.formatDate(
new Date(obj.time * 1000),
Expand All @@ -9,7 +7,7 @@ const mapCards = obj => {
return obj
}

new Vue({
window.app = Vue.createApp({
el: '#vue',
mixins: [windowMixin],
data: function () {
Expand Down
4 changes: 2 additions & 2 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio

from lnbits.core.crud import update_payment_extra
from lnbits.core.crud import update_payment
from lnbits.core.models import Payment
from lnbits.tasks import register_invoice_listener

Expand Down Expand Up @@ -30,4 +30,4 @@ async def on_invoice_paid(payment: Payment) -> None:
if hit:
await create_refund(hit_id=hit.id, refund_amount=(payment.amount / 1000))
payment.extra["wh_status"] = 1
await update_payment_extra(payment.payment_hash, payment.extra)
await update_payment(payment)
3 changes: 1 addition & 2 deletions templates/boltcards/display.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@

return obj
}
Vue.component(VueQrcode.name, VueQrcode)

new Vue({
window.app = Vue.createApp({
el: '#vue',
delimiters: ['${', '}'],
mixins: [windowMixin],
Expand Down
12 changes: 6 additions & 6 deletions templates/boltcards/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ <h5 class="text-subtitle1 q-my-none">Cards</h5>
<q-table
dense
flat
:data="cards"
:rows="cards"
row-key="id"
:columns="cardsTable.columns"
:pagination.sync="cardsTable.pagination"
v-model:pagination="cardsTable.pagination"
>
{% raw %}
<template v-slot:header="props">
Expand Down Expand Up @@ -144,10 +144,10 @@ <h5 class="text-subtitle1 q-my-none">Hits</h5>
<q-table
dense
flat
:data="hits"
:rows="hits"
row-key="id"
:columns="hitsTable.columns"
:pagination.sync="hitsTable.pagination"
v-model:pagination="hitsTable.pagination"
>
{% raw %}
<template v-slot:header="props">
Expand Down Expand Up @@ -183,10 +183,10 @@ <h5 class="text-subtitle1 q-my-none">Refunds</h5>
<q-table
dense
flat
:data="refunds"
:rows="refunds"
row-key="id"
:columns="refundsTable.columns"
:pagination.sync="refundsTable.pagination"
v-model:pagination="refundsTable.pagination"
>
{% raw %}
<template v-slot:header="props">
Expand Down
6 changes: 3 additions & 3 deletions views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from http import HTTPStatus

from fastapi import APIRouter, Depends, Request
from fastapi import APIRouter, Depends, Request, HTTPException
from fastapi.responses import HTMLResponse

from lnbits.core.models import User
from lnbits.decorators import check_user_exists
from lnbits.helpers import template_renderer
from starlette.exceptions import HTTPException
from starlette.responses import HTMLResponse

from .crud import get_card_by_external_id, get_hits, get_refunds

Expand Down
9 changes: 5 additions & 4 deletions views_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from http import HTTPStatus

from fastapi import APIRouter, Depends, HTTPException, Query
from lnbits.core.crud import get_user

from lnbits.core.crud import get_user_by_id
from lnbits.core.models import WalletTypeInfo
from lnbits.decorators import require_admin_key, require_invoice_key

Expand All @@ -28,7 +29,7 @@ async def api_cards(
wallet_ids = [key_info.wallet.id]

if all_wallets:
user = await get_user(key_info.wallet.user)
user = await get_user_by_id(key_info.wallet.user)
wallet_ids = user.wallet_ids if user else []

return await get_cards(wallet_ids)
Expand Down Expand Up @@ -152,7 +153,7 @@ async def api_hits(
wallet_ids = [key_info.wallet.id]

if all_wallets:
user = await get_user(key_info.wallet.user)
user = await get_user_by_id(key_info.wallet.user)
wallet_ids = user.wallet_ids if user else []

cards = await get_cards(wallet_ids)
Expand All @@ -171,7 +172,7 @@ async def api_refunds(
wallet_ids = [key_info.wallet.id]

if all_wallets:
user = await get_user(key_info.wallet.user)
user = await get_user_by_id(key_info.wallet.user)
wallet_ids = user.wallet_ids if user else []

cards = await get_cards(wallet_ids)
Expand Down
3 changes: 2 additions & 1 deletion views_lnurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

import bolt11
from fastapi import APIRouter, HTTPException, Query, Request
from lnbits.core.services import create_invoice, pay_invoice
from lnurl import encode as lnurl_encode
from lnurl.types import LnurlPayMetadata
from loguru import logger
from starlette.responses import HTMLResponse

from lnbits.core.services import create_invoice, pay_invoice

from .crud import (
create_hit,
get_card,
Expand Down

0 comments on commit bf22f52

Please sign in to comment.