diff --git a/lib/web/public/resources/narou.library.js b/lib/web/public/resources/narou.library.js index 95c58aa1..cd5c4ff4 100644 --- a/lib/web/public/resources/narou.library.js +++ b/lib/web/public/resources/narou.library.js @@ -213,9 +213,17 @@ var Narou = (function() { }, create_ws_uri: function() { + var uri = storage.get("ws_uri"); + if (uri) + return uri; + var host = location.hostname, - port = location.port; - return "ws://" + host + ":" + (parseInt(port) + 1) + "/"; + port = location.port || 80, + protocol = (location.protocol === "https:") ? "wss": "ws"; + uri = protocol + "://" + host + ":" + (parseInt(port) + 1) + "/"; + storage.set("ws_uri", uri); + storage.save(); + return uri; }, onmessage: function(data) { diff --git a/lib/web/public/resources/narou.ui.js b/lib/web/public/resources/narou.ui.js index 6eca83ab..759e38a1 100644 --- a/lib/web/public/resources/narou.ui.js +++ b/lib/web/public/resources/narou.ui.js @@ -1224,6 +1224,24 @@ Mac スタイル:
メニューが画面外にはみ出そうとしたら、 // ページ遷移するだけ }); + /* + * メニュー + * オプション>WebSocket URIを設定する + */ + $("#action-option-ws-uri").on(click_event_name, function(e) { + e.preventDefault(); + slideNavbar.slide(); + bootbox.prompt({ + title: "WebSocket URI:", + value: storage.get("ws_uri"), + callback: function(result) { + if (result) { + storage.set("ws_uri", result); + storage.save(); + } + }}); + }); + /* * メニュー * オプション>ヘルプ diff --git a/lib/web/views/index.haml b/lib/web/views/index.haml index cdad3635..f7aebe88 100644 --- a/lib/web/views/index.haml +++ b/lib/web/views/index.haml @@ -158,6 +158,11 @@ %span %span.glyphicon.glyphicon-wrench 環境設定... + %li#action-option-ws-uri + %a(href="#") + %span + %span.glyphicon.glyphicon-wrench + WebSocketのURIを設定する %li.divider %li#action-option-help %a(href="/help")