diff --git a/.meteor/packages b/.meteor/packages index c5ff36b8a1cf..23f68b9e2f61 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -124,7 +124,7 @@ mrt:reactive-store mystor:device-detection nimble:restivus nooitaf:colors -ostrio:cookies@2.0.1 +ostrio:cookies pauli:accounts-linkedin perak:codemirror percolate:synced-cron diff --git a/packages/rocketchat-lib/client/lib/settings.coffee b/packages/rocketchat-lib/client/lib/settings.coffee index 7a19eb1d3fb3..c6ad33d2dbca 100644 --- a/packages/rocketchat-lib/client/lib/settings.coffee +++ b/packages/rocketchat-lib/client/lib/settings.coffee @@ -41,23 +41,25 @@ Meteor.startup -> if RocketChat.authz.hasRole(Meteor.userId(), 'admin') is false or Meteor.settings.public.sandstorm return c.stop() - siteUrl = siteUrl.replace /\/$/, '' - if siteUrl isnt location.origin - swal - type: 'warning' - title: t('Warning') - text: t("The_setting_s_is_configured_to_s_and_you_are_accessing_from_s", t('Site_Url'), siteUrl, location.origin) + '

' + t("Do_you_want_to_change_to_s_question", location.origin) - showCancelButton: true - confirmButtonText: t('Yes') - cancelButtonText: t('Cancel') - closeOnConfirm: false - html: true - , -> - Meteor.call 'saveSetting', 'Site_Url', location.origin, -> - swal - title: t('Saved') - type: 'success' - timer: 1000 - showConfirmButton: false + Meteor.setTimeout -> + if __meteor_runtime_config__.ROOT_URL isnt location.origin + currentUrl = location.origin + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + swal + type: 'warning' + title: t('Warning') + text: t("The_setting_s_is_configured_to_s_and_you_are_accessing_from_s", t('Site_Url'), siteUrl, currentUrl) + '

' + t("Do_you_want_to_change_to_s_question", currentUrl) + showCancelButton: true + confirmButtonText: t('Yes') + cancelButtonText: t('Cancel') + closeOnConfirm: false + html: true + , -> + Meteor.call 'saveSetting', 'Site_Url', currentUrl, -> + swal + title: t('Saved') + type: 'success' + timer: 1000 + showConfirmButton: false + , 100 return c.stop() diff --git a/packages/rocketchat-lib/lib/startup/settingsOnLoadSiteUrl.coffee b/packages/rocketchat-lib/lib/startup/settingsOnLoadSiteUrl.coffee index 3862eacf7b60..778b6fd3c11f 100644 --- a/packages/rocketchat-lib/lib/startup/settingsOnLoadSiteUrl.coffee +++ b/packages/rocketchat-lib/lib/startup/settingsOnLoadSiteUrl.coffee @@ -1,17 +1,23 @@ -if Meteor.isServer - url = Npm.require('url') - RocketChat.settings.get 'Site_Url', (key, value) -> if value?.trim() isnt '' - __meteor_runtime_config__.ROOT_URL = value + host = value.replace(/\/$/, '') + prefix = "" + match = value.match(/([^/]+\/{2}[^/]+)(\/.+)/) + if match? + host = match[1] + prefix = match[2].replace(/\/$/, '') + + __meteor_runtime_config__.ROOT_URL = host + __meteor_runtime_config__.ROOT_URL_PATH_PREFIX = prefix + __meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = host if Meteor.absoluteUrl.defaultOptions?.rootUrl? - Meteor.absoluteUrl.defaultOptions.rootUrl = value + Meteor.absoluteUrl.defaultOptions.rootUrl = host if Meteor.isServer - RocketChat.hostname = url.parse(value).hostname + RocketChat.hostname = host - process.env.MOBILE_ROOT_URL = value - process.env.MOBILE_DDP_URL = value + process.env.MOBILE_ROOT_URL = host + process.env.MOBILE_DDP_URL = host if WebAppInternals?.generateBoilerplate WebAppInternals.generateBoilerplate() diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee index 8337a4ae48a5..5dfb26bfc36b 100644 --- a/packages/rocketchat-lib/server/startup/settings.coffee +++ b/packages/rocketchat-lib/server/startup/settings.coffee @@ -164,14 +164,14 @@ RocketChat.settings.addGroup 'Layout', -> @add 'Layout_Home_Body', 'Welcome to Rocket.Chat
Go to APP SETTINGS -> Layout to customize this intro.', { type: 'code', code: 'text/html', multiline: true, public: true } @add 'Layout_Terms_of_Service', 'Terms of Service
Go to APP SETTINGS -> Layout to customize this page.', { type: 'code', code: 'text/html', multiline: true, public: true } @add 'Layout_Privacy_Policy', 'Privacy Policy
Go to APP SETTINGS -> Layout to customize this page.', { type: 'code', code: 'text/html', multiline: true, public: true } - @add 'Layout_Sidenav_Footer', '
with on
', { type: 'code', code: 'text/html', public: true, i18nDescription: 'Layout_Sidenav_Footer_description' } + @add 'Layout_Sidenav_Footer', '
with on
', { type: 'code', code: 'text/html', public: true, i18nDescription: 'Layout_Sidenav_Footer_description' } @section 'Custom Scripts', -> @add 'Custom_Script_Logged_Out', '//Add your script', { type: 'code', multiline: true, public: true } @add 'Custom_Script_Logged_In', '//Add your script', { type: 'code', multiline: true, public: true } @section 'Login', -> - @add 'Layout_Login_Header', '', { type: 'code', code: 'text/html', multiline: true, public: true } + @add 'Layout_Login_Header', '', { type: 'code', code: 'text/html', multiline: true, public: true } @add 'Layout_Login_Terms', 'By proceeding to create your account and use Rocket.Chat, you are agreeing to our Terms of Service and Privacy Policy. If you do not agree, you cannot use Rocket.Chat.', { type: 'string', multiline: true, public: true } diff --git a/packages/rocketchat-livechat/app/client/stylesheets/fontello.css b/packages/rocketchat-livechat/app/client/stylesheets/fontello.css index 330780624eb8..4f4480949f22 100644 --- a/packages/rocketchat-livechat/app/client/stylesheets/fontello.css +++ b/packages/rocketchat-livechat/app/client/stylesheets/fontello.css @@ -1,10 +1,10 @@ @font-face { font-family: 'fontello'; - src: url('/fonts/fontello.eot?52343198'); - src: url('/fonts/fontello.eot?52343198#iefix') format('embedded-opentype'), - url('/fonts/fontello.woff?52343198') format('woff'), - url('/fonts/fontello.ttf?52343198') format('truetype'), - url('/fonts/fontello.svg?52343198#fontello') format('svg'); + src: url('fonts/fontello.eot?52343198'); + src: url('fonts/fontello.eot?52343198#iefix') format('embedded-opentype'), + url('fonts/fontello.woff?52343198') format('woff'), + url('fonts/fontello.ttf?52343198') format('truetype'), + url('fonts/fontello.svg?52343198#fontello') format('svg'); font-weight: normal; font-style: normal; } @@ -14,7 +14,7 @@ @media screen and (-webkit-min-device-pixel-ratio:0) { @font-face { font-family: 'fontello'; - src: url('/fonts/fontello.svg?52343198#fontello') format('svg'); + src: url('fonts/fontello.svg?52343198#fontello') format('svg'); } } */ diff --git a/packages/rocketchat-mailer/client/views/mailerUnsubscribe.html b/packages/rocketchat-mailer/client/views/mailerUnsubscribe.html index c308fb973f9e..1f2739055cdd 100644 --- a/packages/rocketchat-mailer/client/views/mailerUnsubscribe.html +++ b/packages/rocketchat-mailer/client/views/mailerUnsubscribe.html @@ -3,7 +3,7 @@
diff --git a/packages/rocketchat-mentions-flextab/client/views/stylesheets/mentionsFlexTab.less b/packages/rocketchat-mentions-flextab/client/views/stylesheets/mentionsFlexTab.less index a8956d799c8e..2bdf1593b385 100644 --- a/packages/rocketchat-mentions-flextab/client/views/stylesheets/mentionsFlexTab.less +++ b/packages/rocketchat-mentions-flextab/client/views/stylesheets/mentionsFlexTab.less @@ -1,6 +1,6 @@ .mentioned-messages-list { &.notready { - background-image: url(/images/logo/loading.gif); + background-image: url(images/logo/loading.gif); background-repeat: no-repeat; background-position: 50% 50%; height: 100px; diff --git a/packages/rocketchat-sharedsecret/sharedsecret.coffee b/packages/rocketchat-sharedsecret/sharedsecret.coffee index 19b72c746ad3..d74265ec7411 100644 --- a/packages/rocketchat-sharedsecret/sharedsecret.coffee +++ b/packages/rocketchat-sharedsecret/sharedsecret.coffee @@ -53,7 +53,7 @@ if (Meteor.isClient) message.msg = "~ encrypted message ~" message.html = "~ encrypted message ~" else - lockImage = "/images/lock8.png" + lockImage = "images/lock8.png" message.msg = " " + decrypted message.html = " " + decrypted diff --git a/packages/rocketchat-theme/assets/stylesheets/base.less b/packages/rocketchat-theme/assets/stylesheets/base.less index 37496f172ce3..5224ba24ce79 100644 --- a/packages/rocketchat-theme/assets/stylesheets/base.less +++ b/packages/rocketchat-theme/assets/stylesheets/base.less @@ -562,7 +562,7 @@ textarea[disabled] { &:after { content: " "; visibility: visible; - background-image: url('/images/logo/loading.gif'); + background-image: url('images/logo/loading.gif'); background-position: center; background-repeat: no-repeat; display: block; @@ -610,7 +610,7 @@ label.required:after { } .loading { - background-image: url('/images/loading.gif'); + background-image: url('images/loading.gif'); background-repeat: no-repeat; background-position: 50%; width: 100%; @@ -3914,7 +3914,7 @@ a.github-fork { bottom: 20px; width: 100px; height: 50px; - background: url(/images/meteor.png) no-repeat center center; + background: url(images/meteor.png) no-repeat center center; background-size: 100% auto; text-indent: -9999em; } @@ -4235,7 +4235,7 @@ a.github-fork { .message-popup-results { &.notready { .message-popup-items { - background-image: url(/images/logo/loading.gif); + background-image: url(images/logo/loading.gif); background-repeat: no-repeat; background-position: 50% 50%; height: 100px; diff --git a/packages/rocketchat-theme/assets/stylesheets/fontello.css b/packages/rocketchat-theme/assets/stylesheets/fontello.css index 55950fcc23fe..a9ca191f9579 100644 --- a/packages/rocketchat-theme/assets/stylesheets/fontello.css +++ b/packages/rocketchat-theme/assets/stylesheets/fontello.css @@ -1,10 +1,10 @@ @font-face { font-family: 'fontello'; - src: url('/fonts/fontello.eot?80104145'); - src: url('/fonts/fontello.eot?80104145#iefix') format('embedded-opentype'), - url('/fonts/fontello.woff2?80104145') format('woff2'), - url('/fonts/fontello.woff?80104145') format('woff'), - url('/fonts/fontello.ttf?80104145') format('truetype'); + src: url('fonts/fontello.eot?80104145'); + src: url('fonts/fontello.eot?80104145#iefix') format('embedded-opentype'), + url('fonts/fontello.woff2?80104145') format('woff2'), + url('fonts/fontello.woff?80104145') format('woff'), + url('fonts/fontello.ttf?80104145') format('truetype'); font-weight: normal; font-style: normal; } diff --git a/packages/rocketchat-ui-master/master/error.html b/packages/rocketchat-ui-master/master/error.html index c818e16b9b95..4290413f22fa 100644 --- a/packages/rocketchat-ui-master/master/error.html +++ b/packages/rocketchat-ui-master/master/error.html @@ -3,7 +3,7 @@

{{_ "Not_found_or_not_allowed"}}

diff --git a/packages/rocketchat-ui-master/master/logoLayout.html b/packages/rocketchat-ui-master/master/logoLayout.html index e1228b4a62f9..c7decca4f52c 100644 --- a/packages/rocketchat-ui-master/master/logoLayout.html +++ b/packages/rocketchat-ui-master/master/logoLayout.html @@ -3,7 +3,7 @@
{{> Template.dynamic template=render}} diff --git a/packages/rocketchat-ui-master/master/main.html b/packages/rocketchat-ui-master/master/main.html index e642cd3f68fe..1a0f6c02dbc7 100644 --- a/packages/rocketchat-ui-master/master/main.html +++ b/packages/rocketchat-ui-master/master/main.html @@ -9,32 +9,32 @@ - - + + - + - - - - - - + + + + + + - - - - - - - - - - + + + + + + + + + + diff --git a/packages/rocketchat-ui-master/server/inject.js b/packages/rocketchat-ui-master/server/inject.js index e63a7e4f7f76..588471fef127 100644 --- a/packages/rocketchat-ui-master/server/inject.js +++ b/packages/rocketchat-ui-master/server/inject.js @@ -9,4 +9,21 @@ Inject.rawBody('page-loading', `
-
`); +
` +); + +RocketChat.settings.get('Site_Url', function() { + Meteor.defer(function() { + if (__meteor_runtime_config__.ROOT_URL_PATH_PREFIX && __meteor_runtime_config__.ROOT_URL_PATH_PREFIX.trim() !== '') { + let base_url = __meteor_runtime_config__.ROOT_URL+__meteor_runtime_config__.ROOT_URL_PATH_PREFIX; + + if(/\/$/.test(base_url) === false) { + base_url += '/'; + } + + Inject.rawHead('base', ``); + } else { + Inject.rawHead('base', ''); + } + }); +}); diff --git a/packages/rocketchat-ui/lib/getAvatarUrlFromUsername.coffee b/packages/rocketchat-ui/lib/getAvatarUrlFromUsername.coffee index b913816c52d2..392e2ebfe4aa 100644 --- a/packages/rocketchat-ui/lib/getAvatarUrlFromUsername.coffee +++ b/packages/rocketchat-ui/lib/getAvatarUrlFromUsername.coffee @@ -3,9 +3,8 @@ random = Session?.keys[key] or 0 if not username? return - if Meteor.isCordova - path = Meteor.absoluteUrl() + path = Meteor.absoluteUrl().replace /\/$/, '' else - path = '/' - "#{path}avatar/#{encodeURIComponent(username)}.jpg?_dc=#{random}" + path = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX || ''; + "#{path}/avatar/#{encodeURIComponent(username)}.jpg?_dc=#{random}" diff --git a/packages/rocketchat-ui/views/app/audioNotification.html b/packages/rocketchat-ui/views/app/audioNotification.html index 8441e702ddd6..d64d58f1508f 100644 --- a/packages/rocketchat-ui/views/app/audioNotification.html +++ b/packages/rocketchat-ui/views/app/audioNotification.html @@ -1,9 +1,9 @@ diff --git a/packages/rocketchat-ui/views/fxos.html b/packages/rocketchat-ui/views/fxos.html index 34418ad7ddf2..23c767884d16 100644 --- a/packages/rocketchat-ui/views/fxos.html +++ b/packages/rocketchat-ui/views/fxos.html @@ -3,7 +3,7 @@
@@ -19,7 +19,7 @@

{{_ "Install_FxOs"}}

@@ -35,7 +35,7 @@

{{_ "Install_FxOs"}}

@@ -45,4 +45,4 @@

{{_ "Install_FxOs"}}

- \ No newline at end of file +