!7

cmodule KeyRobotWebServer > DynPrintLog {
  switchable int httpPort = 8083;
  
  start-thread {
    dm_serveHttpFromFunction(httpPort, func(S uri, SS params) {
      assertTrue(isLocalhost(getClientIP()));
      
      if (eq(uri, "/type")) {
        robot_keyPressAndRelease(parseInt(params.get('keycode)));
        ret "OK";
      }

      ret "what";
    });
  }
}