- To connect to the weechat relay service we connect using a URL. A typical URL consists of 4 parts. {scheme}://{host}:{port}/{path}. The path can be changed by enterying the relay's full URL (except the scheme).
+ The hostname field can be used to set a custom path. Or a URL parameter can be used see section 'URL Parameters'.
+
+
+ To connect to the weechat relay service we connect using a URL. A typical URL consists of 4 parts. {scheme}://{host}:{port}/{path}. The path can be changed by entering the relay's full URL (except the scheme).
scheme: The scheme must never be input. The scheme is "ws" if TLS isn't used and it is "wss" if TLS is used.
2001:db8:85a3::8a2e:370:7334 (must wrap IPv6 address in square brackets)
2001:db8:85a3::8a2e:370:7334:8000 (must wrap IPv6 address in square brackets)
+
URL Parameters
+
+ Parameters can be passed in the URL to prefill the fields. This can be useful when you have multiple relays and want to use bookmarks to manage them.
+ We do not recommend passing the password in this was as it will be visible in plain text and stored in the bookmark but it is possible. Special characters should be URL encoded.
+
+
+ If we want just the path for example: https://glowing-bear.org/?path=weechat2
+
+
+ An example: https://glowing-bear.org/?host=my.domain.com&port=8000&password=hunter2&autoconnect=true
+
Parameters can be passed in the URL to prefill the fields. This can be useful when you have multiple relays and want to use bookmarks to manage them.
- We do not recommend passing the password in this was as it will be visible in plain text and stored in the bookmark but it is possible. Special characters should be URL encoded.
+ We do not recommend passing the password in this way as it will be visible in plain text and stored in history/bookmarks but it is possible. Special characters should be URL encoded.
If we want just the path for example: https://glowing-bear.org/?path=weechat2
From 6fcb54f7aad752a8e5f6bff2158307d761676186 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Wed, 18 Dec 2019 18:40:51 +0100
Subject: [PATCH 03/13] Don't use base
---
index.html | 1 -
js/glowingbear.js | 5 ++++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index 1707de2..4ce8573 100644
--- a/index.html
+++ b/index.html
@@ -12,7 +12,6 @@
-
diff --git a/js/glowingbear.js b/js/glowingbear.js
index a738361..164ce74 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -13,7 +13,10 @@ var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatMode
weechat.compileProvider = $compileProvider;
//remove hashbang from url
- $locationProvider.html5Mode(true).hashPrefix('');
+ $locationProvider.html5Mode({
+ enabled: true,
+ requireBase: false
+ }).hashPrefix('');
}]);
weechat.config(['$compileProvider', function ($compileProvider) {
// hack to determine whether we're executing the tests
From 3bffb13930b740cf7ff61b3af7eb562965bede80 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Wed, 18 Dec 2019 19:52:27 +0100
Subject: [PATCH 04/13] no redirecting, removeautoconnect on hash
---
js/glowingbear.js | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 164ce74..85b318c 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -11,12 +11,6 @@ document.addEventListener("deviceready", function () {
var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', '$locationProvider', function($compileProvider, $locationProvider) {
// hacky way to be able to find out if we're in debug mode
weechat.compileProvider = $compileProvider;
-
- //remove hashbang from url
- $locationProvider.html5Mode({
- enabled: true,
- requireBase: false
- }).hashPrefix('');
}]);
weechat.config(['$compileProvider', function ($compileProvider) {
// hack to determine whether we're executing the tests
@@ -988,30 +982,22 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
if($location.search().password) { $scope.settings.password = $location.search().password;}
if($location.search().autoconnect) { $scope.settings.autoconnect = $location.search().autoconnect === 'true';}
- if (window.location.hash) {
- notifications.requestNotificationPermission();
- $rootScope.sslError = false;
- $rootScope.securityError = false;
- $rootScope.errorMessage = false;
- $rootScope.bufferBottom = true;
- $scope.connectbutton = 'Connecting';
- $scope.connectbuttonicon = 'glyphicon-chevron-right';
- connection.connect(settings.host, settings.port, settings.path, password, ssl);
- }
};
}]);
-weechat.config(['$routeProvider',
- function($routeProvider) {
+weechat.config(['$routeProvider', '$locationProvider',
+ function($routeProvider, $locationProvider) {
$routeProvider.when('/', {
templateUrl: 'index.html',
controller: 'WeechatCtrl'
- })
- //for legacy reasons redirect the /#! to /
- .otherwise({
- redirectTo: '/'
});
+
+ //remove hashbang from url
+ $locationProvider.html5Mode({
+ enabled: true,
+ requireBase: false
+ }).hashPrefix('');
}
]);
From 844810408d8c18dd658a5f06469b703ec47f08c1 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Wed, 18 Dec 2019 20:05:19 +0100
Subject: [PATCH 05/13] Preserve pathname in location
---
js/glowingbear.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 85b318c..5fd941d 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -8,7 +8,7 @@ document.addEventListener("deviceready", function () {
}
}, false);
-var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', '$locationProvider', function($compileProvider, $locationProvider) {
+var weechat = angular.module('weechat', ['ngRoute', 'localStorage', 'weechatModels', 'bufferResume', 'plugins', 'IrcUtils', 'ngSanitize', 'ngWebsockets', 'ngTouch'], ['$compileProvider', function($compileProvider) {
// hacky way to be able to find out if we're in debug mode
weechat.compileProvider = $compileProvider;
}]);
@@ -23,6 +23,8 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
function ($rootScope, $scope, $store, $timeout, $location, $log, models, bufferResume, connection, notifications, utils, settings)
{
+ $location.path(window.location.pathname);
+
window.openBuffer = function(channel) {
$scope.openBuffer(channel);
$scope.$apply();
From 0b0ab115a07fde15dea1dd1bcab399d1093e751d Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Wed, 18 Dec 2019 20:10:06 +0100
Subject: [PATCH 06/13] revert setthing pathname
---
js/glowingbear.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 5fd941d..33bf5f6 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -23,8 +23,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
function ($rootScope, $scope, $store, $timeout, $location, $log, models, bufferResume, connection, notifications, utils, settings)
{
- $location.path(window.location.pathname);
-
window.openBuffer = function(channel) {
$scope.openBuffer(channel);
$scope.$apply();
From d9509bafd0868ec3a585745bf82dd6b7eeee4181 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Fri, 20 Dec 2019 00:39:43 +0100
Subject: [PATCH 07/13] Chang get parameters to hash parameters
---
js/glowingbear.js | 34 ++++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 33bf5f6..27fd73e 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -698,6 +698,22 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.totpInvalid = !/^\d{4,10}$/.test($scope.totp);
};
+ $scope.parseHash = function() {
+
+ //Fill in url parameters, they take precedence over the stored settings, but store them
+ var params = $location.$$hash.split('&').map(function(val) {return {key: val.split('=')[0], value: val.split('=')[1]}});
+ var hostParam = params.find(function(p) { return p.key === 'host'; });
+ var portParam = params.find(function(p) { return p.key === 'port'; });
+ var pathParam = params.find(function(p) { return p.key === 'path'; });
+ var passwordParam = params.find(function(p) { return p.key === 'password'; });
+ var autoconnectParam = params.find(function(p) { return p.key === 'autoconnect'; });
+ if(hostParam) { $scope.settings.host = hostParam.value; $scope.settings.hostField = hostParam.value;}
+ if(portParam) { $scope.settings.port = parseInt(portParam.value);}
+ if(pathParam) { $scope.settings.path = pathParam.value;}
+ if(passwordParam) { $scope.settings.password = passwordParam.value;}
+ if(autoconnectParam) { $scope.settings.autoconnect = autoconnectParam.value === 'true';}
+ };
+
$scope.connect = function() {
notifications.requestNotificationPermission();
@@ -972,23 +988,21 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
}
};
+ window.onhashchange = function() {
+ console.log('hash has changed');
+ $scope.parseHash();
+ };
+
$scope.init = function() {
$scope.parseHost();
-
- //Fill in url parameters, they take precedence over the stored settings, but store them
- if($location.search().host) { $scope.settings.host = $location.search().host; $scope.settings.hostField = $location.search().host;}
- if($location.search().port) { $scope.settings.port = parseInt($location.search().port);}
- if($location.search().path) { $scope.settings.path = $location.search().path;}
- if($location.search().password) { $scope.settings.password = $location.search().password;}
- if($location.search().autoconnect) { $scope.settings.autoconnect = $location.search().autoconnect === 'true';}
-
+ $scope.parseHash();
};
}]);
weechat.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
- $routeProvider.when('/', {
+ $routeProvider.when('', {
templateUrl: 'index.html',
controller: 'WeechatCtrl'
});
@@ -997,7 +1011,7 @@ weechat.config(['$routeProvider', '$locationProvider',
$locationProvider.html5Mode({
enabled: true,
requireBase: false
- }).hashPrefix('');
+ });
}
]);
From 0c45b402cfb31921ab366ada8a2216fb6e1f535d Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Fri, 20 Dec 2019 00:43:45 +0100
Subject: [PATCH 08/13] Update documentation for hash paramters
---
index.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index 4ce8573..1c502a8 100644
--- a/index.html
+++ b/index.html
@@ -272,10 +272,10 @@ chown -R username:username ~username
We do not recommend passing the password in this way as it will be visible in plain text and stored in history/bookmarks but it is possible. Special characters should be URL encoded.
- If we want just the path for example: https://glowing-bear.org/?path=weechat2
+ If we want just the path for example: https://glowing-bear.org/#path=weechat2
- An example: https://glowing-bear.org/?host=my.domain.com&port=8000&password=hunter2&autoconnect=true
+ An example: https://glowing-bear.org/#host=my.domain.com&port=8000&password=hunter2&autoconnect=true
Available parameters:
From 6dc8fab9dd9fb5dcb5828e40b2565aab46b57796 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Fri, 20 Dec 2019 00:48:50 +0100
Subject: [PATCH 09/13] remove debug comment
---
js/glowingbear.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 27fd73e..1eccad5 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -989,7 +989,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
};
window.onhashchange = function() {
- console.log('hash has changed');
$scope.parseHash();
};
From 47bcd8c5180dca58918e54798181018839d0f3f1 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Fri, 20 Dec 2019 01:04:21 +0100
Subject: [PATCH 10/13] missing semi colon
---
js/glowingbear.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index 1eccad5..d70f6dc 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -701,7 +701,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.parseHash = function() {
//Fill in url parameters, they take precedence over the stored settings, but store them
- var params = $location.$$hash.split('&').map(function(val) {return {key: val.split('=')[0], value: val.split('=')[1]}});
+ var params = $location.$$hash.split('&').map(function(val) { return {key: val.split('=')[0], value: val.split('=')[1]}; });
var hostParam = params.find(function(p) { return p.key === 'host'; });
var portParam = params.find(function(p) { return p.key === 'port'; });
var pathParam = params.find(function(p) { return p.key === 'path'; });
From 85ef6d897fb0c9bbcc761381886681f9b0b7c570 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Sat, 21 Dec 2019 00:18:06 +0100
Subject: [PATCH 11/13] Refactor and correct parseHash
---
js/glowingbear.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/js/glowingbear.js b/js/glowingbear.js
index d70f6dc..be3ab09 100644
--- a/js/glowingbear.js
+++ b/js/glowingbear.js
@@ -701,17 +701,17 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.parseHash = function() {
//Fill in url parameters, they take precedence over the stored settings, but store them
- var params = $location.$$hash.split('&').map(function(val) { return {key: val.split('=')[0], value: val.split('=')[1]}; });
- var hostParam = params.find(function(p) { return p.key === 'host'; });
- var portParam = params.find(function(p) { return p.key === 'port'; });
- var pathParam = params.find(function(p) { return p.key === 'path'; });
- var passwordParam = params.find(function(p) { return p.key === 'password'; });
- var autoconnectParam = params.find(function(p) { return p.key === 'autoconnect'; });
- if(hostParam) { $scope.settings.host = hostParam.value; $scope.settings.hostField = hostParam.value;}
- if(portParam) { $scope.settings.port = parseInt(portParam.value);}
- if(pathParam) { $scope.settings.path = pathParam.value;}
- if(passwordParam) { $scope.settings.password = passwordParam.value;}
- if(autoconnectParam) { $scope.settings.autoconnect = autoconnectParam.value === 'true';}
+ var params = {};
+ $location.$$hash.split('&').map(function(val) {
+ var segs = val.split('=');
+ params[segs[0]] = segs[1];
+ });
+ if(params.host) { $scope.settings.host = params.host; $scope.settings.hostField = params.host; }
+ if(params.port) { $scope.settings.port = parseInt(params.port); }
+ if(params.path) { $scope.settings.path = params.path; $scope.settings.hostField = $scope.settings.host + ":" + $scope.settings.port + "/" + $scope.settings.path; }
+ if(params.password) { $scope.password = params.password; }
+ if(params.autoconnect) { $scope.settings.autoconnect = params.autoconnect === 'true'; }
+
};
$scope.connect = function() {
From f82d3484a631681b2ddf74c0cea0b9b74e944331 Mon Sep 17 00:00:00 2001
From: Jeremy Mahieu
Date: Sat, 21 Dec 2019 00:52:42 +0100
Subject: [PATCH 12/13] Show autoconnect checkbox if it's checked
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index 1c502a8..f8ffbb5 100644
--- a/index.html
+++ b/index.html
@@ -144,7 +144,7 @@
Encryption. Strongly recommended! Need help? Check below.
-