diff --git a/koki/asahi.html b/koki/asahi.html index 994f853..ce07563 100644 --- a/koki/asahi.html +++ b/koki/asahi.html @@ -36,6 +36,7 @@
+

スタンプ

diff --git a/koki/otp.js b/koki/otp.js index 7ac008e..5364fdb 100644 --- a/koki/otp.js +++ b/koki/otp.js @@ -1,9 +1,7 @@ document.addEventListener("DOMContentLoaded", ()=>{ var mainElem = document.getElementById("main"), userinput = document.getElementById("user"), - codeinput = document.getElementById("passcode"), - noteinput = document.getElementById("note"), - reply = document.getElementById("reply"); + codeinput = document.getElementById("passcode"); var conn, PORT=8889, server = location.hostname||"localhost"; // server = "localhost"; var userInfo = { diff --git a/koki/otp.rb b/koki/otp.rb index b303d6a..bc65316 100755 --- a/koki/otp.rb +++ b/koki/otp.rb @@ -37,11 +37,7 @@ if param["authok"] # 認証完了したクライアントとは自由に通信 p "USER=#{user}" - if given["note"] - data["reply"] = userdb.notAI(given, user) - param["last"] = Time.now - end - elsif given["tmpkey"] + if given["tmpkey"] # tmpkeyとパスコードの組み合わせを送ってきたとき param["skey"] = userdb.authTmpKey(user, given["tmpkey"], given["passcode"]) STDERR.puts "tmpKeyAuth= #{param['skey']}" @@ -74,32 +70,4 @@ # p "bye"+ws_conn.inspect printf("%d GUEST(s)\n", clients.length) end - EM::defer do # 共通で実行するスレッド - # Thread.new do のほうがいいかも - puts "..captured!" - Thread.new { # 別スレッドを起こして並行動作させる - loop do # 無限ループ(末尾で5秒休憩) - clients.each do |conn, hash| # 全クライアントに対して繰り返す - next unless hash["last"] # 最終操作時刻未設定ならパス - p Time.now - hash["last"] - if Time.now - hash["last"] > 10 - # 10秒書き込み操作のないクライアントにメッセージを送る - rep = %w(なんか喋り おーい おるんか? 暇だ ぬ ほぇ? 静寂 遅いわ - どしたん話聞こか 打鍵が遅いのか? 帰ってよいか? つまらぬ).sample - conn.send(JSON.generate({"reply"=>rep})) - hash["last"] = Time.now # 最終操作時刻を上書き - end - end - sleep 5 - end - } # 別スレッドここまで - loop do - print("Enter message for all clients: ") - line = gets - puts("Sending") - clients.keys.each{|conn| - conn.send(JSON.generate({"reply"=>line.chomp})) - } - end - end end