summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/lib
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2019-06-04 17:26:46 -0500
committerPaul Slaughter <pslaughter@gitlab.com>2019-06-07 09:12:11 -0500
commit908829089c2f739af47e58bac11c51bd423bb2d1 (patch)
tree443c4dce74f387f1a7a7e614c419230ae56474b1 /app/assets/javascripts/lib
parentf08abfcc3275c41e3e92e3504188359cc773730c (diff)
downloadgitlab-ce-908829089c2f739af47e58bac11c51bd423bb2d1.tar.gz
Update IDE file mirror service (ce utils)ce-5276-3-update-ide-diff-and-mirror-modules
**Notes:** This module is a client to the webide-file-sync service. https://gitlab.com/gitlab-org/webide-file-sync
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r--app/assets/javascripts/lib/utils/url_utility.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js
index b5474fc5c71..32fd0990374 100644
--- a/app/assets/javascripts/lib/utils/url_utility.js
+++ b/app/assets/javascripts/lib/utils/url_utility.js
@@ -1,3 +1,5 @@
+import { join as joinPaths } from 'path';
+
// Returns an array containing the value(s) of the
// of the key passed as an argument
export function getParameterValues(sParam) {
@@ -157,4 +159,12 @@ export function isSafeURL(url) {
}
}
-export { join as joinPaths } from 'path';
+export function getWebSocketProtocol() {
+ return window.location.protocol.replace('http', 'ws');
+}
+
+export function getWebSocketUrl(path) {
+ return `${getWebSocketProtocol()}//${joinPaths(window.location.host, path)}`;
+}
+
+export { joinPaths };