bakape / hydron

media tagger and organizer
GNU Lesser General Public License v3.0
95 stars 9 forks source link

Dev/options #51

Closed Kamuso closed 4 years ago

Kamuso commented 5 years ago

In main.js, the option to delete files works, but add/remove tags and set name don't. The request for add/remove tags has a return status of 200 but doesn't seem to do anything, set name gives a 405. I don't know what I'm doing wrong there. I also need to make the upload page and the fetch tags option before this is finished.

bakape commented 5 years ago

The request for add/remove tags has a return status of 200

I don't remember testing these. Will dig deeper and see, if it is my fault later this evening.

set name gives a 405

Try /api/images/:id/name - without the trailing slash.

bakape commented 5 years ago

Yup, tag adding is broken somehow. This will take more time to fix.

Kamuso commented 5 years ago

Try /api/images/:id/name - without the trailing slash.

This made the request work, but the name had a bunch of extra data in it so I've got to fix that.

Yup, tag adding is broken somehow. This will take more time to fix.

r.Form.Get("tags") gives a blank string. I'll fix this at the same time as setting the name.

Kamuso commented 5 years ago

Okay, everything works as intended now, need to validate input, add fetchtags, and add upload page.

bakape commented 5 years ago

r.Form.Get("tags")

Odd, because that is not the bug I was seeing in the debugger. It went down to db.AddTagsTX() just fine and then something made it not write to the DB. Also, it might be because you are using multipart POST requests there (FormData API). I produced my bug with a PATCH to http://localhost:8010/api/images/e9336dc8634de6ef577232959e8c526dc7434e50/tags/?tags=sakura_kyouko style URL. Notice the query string.

bakape commented 5 years ago

The tag issue is caused by #54 so just assume it works and I will fix it myself later on.

Kamuso commented 5 years ago

I think this will do for now. I wasn't sure how to make dropping images resolve to the import page, so I left that out. Upload progress is shown in the terminal, not the browser, but it seems good enough for now.

bakape commented 5 years ago

Okay. So now we have 2 conflicting ways to upload files in the web UI. Personally I like having a separate upload page like you built more, but automatically navigating to it on image drag&drop would be nice too. Perhaps that can be done by issuing a HTTP redirect to the upload page after all images are uploaded, but not thumbnailed. But that would also mena we would need to persist uploaded resources cross-request. Using the History API might be better then. Thoughts on this?

Upload progress is shown in the terminal, not the browser, but it seems good enough for now.

You can use Transfer-Encoding: chunked and stream upload progress and any errors to the client on each tick. WIll require calling .Flush() on the http.ResponseWriter after each tick to prevent buffering. That can be used to display a progress bar.

Overall - great work. I'll get back to hydron once I'm more or less done with captchouli meguca integration.

Kamuso commented 5 years ago

Merry Christmas, have an update.

Mostly fixing some oversights in the import page.

2 conflicting ways to upload files in the web UI

I think it would be simplest to remove drag and drop uploads from the browser page and just have it in the imports page. There is a demo of that in this update, so depends how you feel about that.

You can use Transfer-Encoding: chunked and stream upload progress and any errors to the client on each tick.

I experimented with this but couldn't manage to get it to work. I tried a timed for loop to send some data in batches but it was all sent all together at the end. I don't think I'll be able to get that working on my own.

bakape commented 5 years ago

I think it would be simplest to remove drag and drop uploads from the browser page and just have it in the imports page. There is a demo of that in this update, so depends how you feel about that.

Drag and drop should ideally forward all your dropped files to the upload progress page. The way it is implemented now breaks navigation somewhat.

I experimented with this but couldn't manage to get it to work. I tried a timed for loop to send some data in batches but it was all sent all together at the end. I don't think I'll be able to get that working on my own.

Server Sent Events and some JS listening on the frontend? That way you can also reuse the current code that displays imports as they are completed. https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events https://github.com/alexandrevicenzi/go-sse

Kamuso commented 5 years ago

The way it is implemented now breaks navigation somewhat.

Right, but removing drag&drop from the search page would fix this. Would you accept that instead of redirecting? It would be much simpler.

Server Sent Events and some JS listening on the frontend?

Turns out SSE isn't necessary, the server code that I had before was correct, the JS wasn't. It now works properly using a ReadableStream.

bakape commented 5 years ago

Right, but removing drag&drop from the search page would fix this. Would you accept that instead of redirecting? It would be much simpler.

I can write the redirect part, once we have a complete upload page.

Kamuso commented 5 years ago

I'm all done here, then.

bakape commented 5 years ago

Okay. I'll take a look at this next weekend.

On Sun, 24 Mar 2019 at 01:18, Kamuso notifications@github.com wrote:

I'm all done here, then.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bakape/hydron/pull/51#issuecomment-475913059, or mute the thread https://github.com/notifications/unsubscribe-auth/AHfPsANRDyLUo9j7CFK8VtComUWb_do6ks5vZrZUgaJpZM4XFTru .

bakape commented 5 years ago

Okay, good work. I merged this into dev/options. Once I add my own changes pertaining to drag&drop, I'll merge this into master.

Kamuso commented 4 years ago

Added the drag&drop behaviour you wanted. Also did some general clean up, like refactoring the indentation hell in import.js. Would have pushed to the new pr you made, but I didn't accept the collaboration invite before it expired. tehe pero

bakape commented 4 years ago

This has been a very long week.

On Tue, 28 Jul 2020, 13:30 Kamuso, notifications@github.com wrote:

Added the drag&drop behaviour you wanted. Also did some general clean up, like refactoring the indentation hell in import.js. Would have pushed to the new pr you made, but I didn't accept the collaboration invite before it expired. tehe pero

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bakape/hydron/pull/51#issuecomment-664962819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB347MFJ7ARDP2UHZFI6NGLR52SERANCNFSM4FYVHLXA .

bakape commented 4 years ago

sugoi