mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
fix dialog close and add API.
This commit is contained in:
@ -69,7 +69,8 @@ func (h *RoomHandler) Route(r chi.Router) {
|
||||
|
||||
r.With(h.uploadMiddleware).Route("/upload", func(r chi.Router) {
|
||||
r.Post("/drop", h.uploadDrop)
|
||||
r.Post("/dialog", h.uploadDialog)
|
||||
r.Post("/dialog", h.uploadDialogPost)
|
||||
r.Delete("/dialog", h.uploadDialogClose)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,7 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
utils.HttpSuccess(w)
|
||||
}
|
||||
|
||||
|
||||
func (h *RoomHandler) uploadDialog(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
r.ParseMultipartForm(MAX_UPLOAD_SIZE)
|
||||
|
||||
if r.MultipartForm == nil {
|
||||
@ -148,3 +147,17 @@ func (h *RoomHandler) uploadDialog(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
utils.HttpSuccess(w)
|
||||
}
|
||||
|
||||
func (h *RoomHandler) uploadDialogClose(w http.ResponseWriter, r *http.Request) {
|
||||
if !h.desktop.IsFileChooserDialogOpen() {
|
||||
utils.HttpBadRequest(w, "File chooser dialog is not open.")
|
||||
return
|
||||
}
|
||||
|
||||
if !h.desktop.CloseFileChooserDialog() {
|
||||
utils.HttpInternalServerError(w, "Unable to close file chooser dialog.")
|
||||
return
|
||||
}
|
||||
|
||||
utils.HttpSuccess(w)
|
||||
}
|
||||
|
Reference in New Issue
Block a user