Skip to content

Commit

Permalink
fix: use paymenthash instead of id for print
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Jan 2, 2025
1 parent 8c88be1 commit 3231d8f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ async def update_print(_print: Print, conn: Optional[Connection] = None) -> Prin
return _print


async def get_print(print_id: str) -> Optional[Print]:
async def get_print(payment_hash: str) -> Optional[Print]:
return await db.fetchone(
"SELECT * FROM pay2print.print WHERE id = :id",
{"id": print_id},
"SELECT * FROM pay2print.print WHERE payment_hash = :payment_hash",
{"payment_hash": payment_hash},
Print,
)

Expand Down
1 change: 0 additions & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class CreatePrinter(BaseModel):


class Print(BaseModel):
id: str = Field(default_factory=urlsafe_short_hash)
printer: str
payment_hash: str
file: str
Expand Down
4 changes: 3 additions & 1 deletion templates/pay2print/photo.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ <h2 class="text-h5">
autoplay
style="display: none"
></video>
<h3 v-if="!webcam" class="text-h6 text-center">Device does not support camera!</h3>
<h3 v-if="!webcam" class="text-h6 text-center">
Device does not support camera!
</h3>
<p class="text-center text-negative" v-text="webcamError"></p>
<canvas ref="canvas" width="0" height="0"></canvas>
<q-card-section
Expand Down

0 comments on commit 3231d8f

Please sign in to comment.