I tried commenting out some parts in the downloadFile function in telegram-web-app.js, and it was able to pop up a confirm modal for me to download it. However, when I clicked to download, the program crashed. It might be because the internal implementation does not support the data:image/png;base64 (canvas.toDataURL("image/png")) format.
Does anyone have a solution?