!7 cmodule Cruddie > DynPrintLogAndEnabled { !include #1027628 // HTTP+HTTPS servers transient WebChatBot chatBot; S myLink() { ret "https://cruddie.site/"; } S botLink() { ret appendWithSlash(myLink(), "bot"); } start-thread { dm_restartOnFieldChange enabled(); if (!enabled) ret; chatBot = new WebChatBot; chatBot.baseLink = botLink(); chatBot.thoughtBot = new O { S initialMessage() { ret "Hello"; } S answer(S s) { ret "I hear you"; } }; start_webServers(javaxSecretDir("cruddie.site/keystore.p12"), "botcompany"); } O webServe(S uri, SS params) { printVars("webServe", +uri); S cookie = serveHttp_cookieHandling(); new Matches m; if (startsWith(appendSlash(uri), "/bot/", m)) ret chatBot.html("/" + m.rest(), params, cookie); S jsOnSpeech = "window.submitAMsg(result);"; ret hhtml(hhead( htitle("CRUDDIE") + hLoadJQuery2()) + hbody(hfullcenter( p(hsnippetimage(#1102905)) + p("Chat bot coming up.") + p("Server temperature is " + dm_cpuTemperature()) + p(hSpeechRecognition(jsOnSpeech, true, "en-US", false, noWebKit := "Use Chrome if you want speech recognition")) + hscript_src(botLink()) ))); } }