Skip to content

Commit 72889dc

Browse files
committed
Add undo/redo to HTTPServer
1 parent 086bbd1 commit 72889dc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Source/Utils/OpenEphysHttpServer.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "../MainWindow.h"
3535
#include "../AccessClass.h"
3636
#include "../UI/ProcessorList.h"
37+
#include "../UI/EditorViewport.h"
3738

3839
#include "Utils.h"
3940

@@ -852,6 +853,32 @@ class OpenEphysHttpServer : juce::Thread {
852853
}
853854

854855

856+
});
857+
858+
svr_->Get("/api/undo", [this](const httplib::Request& req, httplib::Response& res) {
859+
std::string message_str;
860+
LOGD( "Received undo request" );
861+
862+
json ret;
863+
res.set_content(ret.dump(), "application/json");
864+
res.status = 400;
865+
866+
const MessageManagerLock mml;
867+
AccessClass::getEditorViewport()->undo();
868+
869+
});
870+
871+
svr_->Get("/api/redo", [this](const httplib::Request& req, httplib::Response& res) {
872+
std::string message_str;
873+
LOGD( "Received redo request" );
874+
875+
json ret;
876+
res.set_content(ret.dump(), "application/json");
877+
res.status = 400;
878+
879+
const MessageManagerLock mml;
880+
AccessClass::getEditorViewport()->redo();
881+
855882
});
856883

857884
LOGC("Beginning HTTP server on port ", PORT);

0 commit comments

Comments
 (0)