tomayac / SVGcode

Convert color bitmap images to color SVG vector images.
https://svgco.de
GNU General Public License v2.0
779 stars 117 forks source link

Make Share Target working #91

Closed MeFoDy closed 1 year ago

MeFoDy commented 1 year ago

Hi,

I've installed the app as PWA in my Android phone. Tried to use it as share target from another application (default Images app, for example). Unfrotunately, it opens the SVGCo.de with 404 error on github pages. After some debug I found that sharing tries to open the app with https://svgco.de/share-target/ url, which is not exist.

I had the same problem with my app, because I used your code (thank you for inspiration!). And I fixed it such way: https://github.com/MeFoDy/dnd-tokenizer/commit/59d897b26903452c3515e456789571cb602d2c45

tomayac commented 1 year ago

I just confirmed that it's not working, but I wonder why. I have screen-recorded evidence of it working before: https://web.dev/svgcode/#web-share-target-files. The Web Share Target API calls are handled by https://svgco.de/share-target/sharetargetsw.js. Do you see anything wrong with it? Maybe some Workbox update broke it? Do you have an idea?

MeFoDy commented 1 year ago

I tried to debug and still can't understand, why it's broken. It looks like it has been broken since https://github.com/tomayac/SVGcode/commit/7dbee6ee1731874e67fb2987a53069dc12161a85. I've found that I have sharetarget.sw service worker active. Tried to add a breakpoint in chrome dev tools on fetch. And it didn't stopped until I tried to open https://svgco.de/share-target/index.html. Looks like magic for me.

tomayac commented 1 year ago

Good detective work. Looks like it’s running into a case like this. So maybe moving the file back to / and/or changing the registration order will fix it. Need to play with it when I get to my laptop.

tomayac commented 1 year ago

I have gone back to the previous state where sharetargetsw.js was installed from /, but uses a scope of /share-target/. Hope this works?!

tomayac commented 1 year ago

I believe this is fixed via https://github.com/tomayac/SVGcode/commit/297f7a228b0a9407478afaf147a7cd7f58ceea08. Please re-open when this still doesn't work. Thank you!