Skip to content

Commit

Permalink
Merge pull request #2624 from RocketChat/r0p0s3c/develop
Browse files Browse the repository at this point in the history
Fixups to allow running out of subdirectory
  • Loading branch information
engelgabriel committed Mar 28, 2016
2 parents f05c6d4 + f1801a2 commit 83c56cf
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 20 additions & 18 deletions packages/rocketchat-lib/client/lib/settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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) + '<br/><br/>' + 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) + '<br/><br/>' + 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()
22 changes: 14 additions & 8 deletions packages/rocketchat-lib/lib/startup/settingsOnLoadSiteUrl.coffee
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 2 additions & 2 deletions packages/rocketchat-lib/server/startup/settings.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ RocketChat.settings.addGroup 'Layout', ->
@add 'Layout_Home_Body', 'Welcome to Rocket.Chat <br> 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 <br> Go to APP SETTINGS -> Layout to customize this page.', { type: 'code', code: 'text/html', multiline: true, public: true }
@add 'Layout_Privacy_Policy', 'Privacy Policy <br> Go to APP SETTINGS -> Layout to customize this page.', { type: 'code', code: 'text/html', multiline: true, public: true }
@add 'Layout_Sidenav_Footer', '<div><a href="https://github.com/RocketChat/Rocket.Chat" class="logo" target="_blank"> <img src="/images/logo/logo.svg?v=3" /></a><div class="github-tagline"><span class="icon-pencil" style="color: #994C00"></span> with <span class="icon-heart" style="color: red"></span> on <span class="icon-github-circled"></span></div></div>', { type: 'code', code: 'text/html', public: true, i18nDescription: 'Layout_Sidenav_Footer_description' }
@add 'Layout_Sidenav_Footer', '<div><a href="https://github.com/RocketChat/Rocket.Chat" class="logo" target="_blank"> <img src="images/logo/logo.svg?v=3" /></a><div class="github-tagline"><span class="icon-pencil" style="color: #994C00"></span> with <span class="icon-heart" style="color: red"></span> on <span class="icon-github-circled"></span></div></div>', { 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', '<a class="logo" href="/"><img src="/assets/logo?v=3" /></a>', { type: 'code', code: 'text/html', multiline: true, public: true }
@add 'Layout_Login_Header', '<a class="logo" href="/"><img src="assets/logo?v=3" /></a>', { 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 <a href="/terms-of-service">Terms of Service</a> and <a href="/privacy-policy">Privacy Policy</a>. If you do not agree, you cannot use Rocket.Chat.', { type: 'string', multiline: true, public: true }


Expand Down
12 changes: 6 additions & 6 deletions packages/rocketchat-livechat/app/client/stylesheets/fontello.css
Original file line number Diff line number Diff line change
@@ -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;
}
Expand All @@ -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');
}
}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="wrapper">
<header>
<a class="logo" href="/">
<img src="/images/logo/logo.svg?v=3" />
<img src="images/logo/logo.svg?v=3" />
</a>
</header>
<div class="cms-page">
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-sharedsecret/sharedsecret.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<img src=#{lockImage} style='width:8px;height:9px;'></img> " + decrypted
message.html = "<img src=#{lockImage} style='width:8px;height:9px;'></img> " + decrypted

Expand Down
8 changes: 4 additions & 4 deletions packages/rocketchat-theme/assets/stylesheets/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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%;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions packages/rocketchat-theme/assets/stylesheets/fontello.css
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-master/master/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="wrapper">
<header>
<a class="logo" href="/">
<img src="/images/logo/logo.svg?v=3" />
<img src="images/logo/logo.svg?v=3" />
</a>
</header>
<h1>{{_ "Not_found_or_not_allowed"}}</h1>
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui-master/master/logoLayout.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="wrapper">
<header>
<a class="logo" href="/">
<img src="/images/logo/logo.svg?v=3" />
<img src="images/logo/logo.svg?v=3" />
</a>
</header>
{{> Template.dynamic template=render}}
Expand Down
38 changes: 19 additions & 19 deletions packages/rocketchat-ui-master/master/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
<meta name="rating" content="general" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="msapplication-TileColor" content="#04436a">
<meta name="msapplication-TileImage" content="/images/logo/mstile-144x144.png?v=3">
<meta name="msapplication-config" content="/images/logo/browserconfig.xml?v=3">
<meta name="msapplication-TileImage" content="images/logo/mstile-144x144.png?v=3">
<meta name="msapplication-config" content="images/logo/browserconfig.xml?v=3">
<meta name="theme-color" content="#04436a">
<link rel="manifest" href="/images/logo/manifest.json?v=3">
<link rel="manifest" href="images/logo/manifest.json?v=3">
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/nocfbnnmjnndkbipkabodnheejiegccf">
<link rel="icon" sizes="any" type="image/svg+xml" href="/assets/favicon.svg?v=3">
<link rel="icon" sizes="256x256" type="image/png" href="/assets/favicon_256.png?v=3">
<link rel="icon" sizes="192x192" type="image/png" href="/assets/favicon_192.png?v=3">
<link rel="icon" sizes="128x128" type="image/png" href="/assets/favicon_128.png?v=3">
<link rel="icon" sizes="96x96" type="image/png" href="/assets/favicon_96.png?v=3">
<link rel="icon" sizes="64x64" type="image/png" href="/assets/favicon_64.png?v=3">
<link rel="icon" sizes="any" type="image/svg+xml" href="assets/favicon.svg?v=3">
<link rel="icon" sizes="256x256" type="image/png" href="assets/favicon_256.png?v=3">
<link rel="icon" sizes="192x192" type="image/png" href="assets/favicon_192.png?v=3">
<link rel="icon" sizes="128x128" type="image/png" href="assets/favicon_128.png?v=3">
<link rel="icon" sizes="96x96" type="image/png" href="assets/favicon_96.png?v=3">
<link rel="icon" sizes="64x64" type="image/png" href="assets/favicon_64.png?v=3">
<!--
<link rel="icon" sizes="48x48" type="image/png" href="/images/logo/favicon-48x48.png?v=3">
<link rel="icon" sizes="32x32" type="image/png" href="/images/logo/favicon-32x32.png?v=3">
<link rel="icon" sizes="16x16" type="image/png" href="/images/logo/favicon-16x16.png?v=3">
-->
<link rel="shortcut icon" sizes="16x16 32x32 48x48" type="image/x-icon" href="/assets/favicon.ico?v=3" />
<link rel="apple-touch-icon" sizes="57x57" href="/images/logo/apple-touch-icon-57x57.png?v=3">
<link rel="apple-touch-icon" sizes="60x60" href="/images/logo/apple-touch-icon-60x60.png?v=3">
<link rel="apple-touch-icon" sizes="72x72" href="/images/logo/apple-touch-icon-72x72.png?v=3">
<link rel="apple-touch-icon" sizes="76x76" href="/images/logo/apple-touch-icon-76x76.png?v=3">
<link rel="apple-touch-icon" sizes="114x114" href="/images/logo/apple-touch-icon-114x114.png?v=3">
<link rel="apple-touch-icon" sizes="120x120" href="/images/logo/apple-touch-icon-120x120.png?v=3">
<link rel="apple-touch-icon" sizes="144x144" href="/images/logo/apple-touch-icon-144x144.png?v=3">
<link rel="apple-touch-icon" sizes="152x152" href="/images/logo/apple-touch-icon-152x152.png?v=3">
<link rel="apple-touch-icon" sizes="180x180" href="/images/logo/apple-touch-icon-180x180.png?v=3">
<link rel="shortcut icon" sizes="16x16 32x32 48x48" type="image/x-icon" href="assets/favicon.ico?v=3" />
<link rel="apple-touch-icon" sizes="57x57" href="images/logo/apple-touch-icon-57x57.png?v=3">
<link rel="apple-touch-icon" sizes="60x60" href="images/logo/apple-touch-icon-60x60.png?v=3">
<link rel="apple-touch-icon" sizes="72x72" href="images/logo/apple-touch-icon-72x72.png?v=3">
<link rel="apple-touch-icon" sizes="76x76" href="images/logo/apple-touch-icon-76x76.png?v=3">
<link rel="apple-touch-icon" sizes="114x114" href="images/logo/apple-touch-icon-114x114.png?v=3">
<link rel="apple-touch-icon" sizes="120x120" href="images/logo/apple-touch-icon-120x120.png?v=3">
<link rel="apple-touch-icon" sizes="144x144" href="images/logo/apple-touch-icon-144x144.png?v=3">
<link rel="apple-touch-icon" sizes="152x152" href="images/logo/apple-touch-icon-152x152.png?v=3">
<link rel="apple-touch-icon" sizes="180x180" href="images/logo/apple-touch-icon-180x180.png?v=3">
</head>

<body>
Expand Down
19 changes: 18 additions & 1 deletion packages/rocketchat-ui-master/server/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,21 @@ Inject.rawBody('page-loading', `
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>`);
</div>`
);

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', `<base href="${base_url}">`);
} else {
Inject.rawHead('base', '');
}
});
});
7 changes: 3 additions & 4 deletions packages/rocketchat-ui/lib/getAvatarUrlFromUsername.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
6 changes: 3 additions & 3 deletions packages/rocketchat-ui/views/app/audioNotification.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template name="audioNotification">
<audio id="chatAudioNotification" preload>
<source src="/sounds/notify.ogg" type="audio/ogg" />
<source src="/sounds/notify.mp3" type="audio/mpeg" />
<source src="sounds/notify.ogg" type="audio/ogg" />
<source src="sounds/notify.mp3" type="audio/mpeg" />
</audio>
<audio id="chatNewRoomNotification" preload>
<source src="/sounds/door_chime.mp3" type="audio/mpeg" />
<source src="sounds/door_chime.mp3" type="audio/mpeg" />
</audio>
</template>
8 changes: 4 additions & 4 deletions packages/rocketchat-ui/views/fxos.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="wrapper">
<header>
<a class="logo" href="/">
<img src="/images/logo/logo.svg?v=3" />
<img src="images/logo/logo.svg?v=3" />
</a>
</header>
<div class="cms-page">
Expand All @@ -19,7 +19,7 @@ <h1>{{_ "Install_FxOs"}}</h1>
<div class="wrapper">
<header>
<a class="logo" href="/">
<img src="/images/logo/logo.svg?v=3" />
<img src="images/logo/logo.svg?v=3" />
</a>
</header>
<div class="cms-page">
Expand All @@ -35,7 +35,7 @@ <h1>{{_ "Install_FxOs"}}</h1>
<div class="wrapper">
<header>
<a class="logo" href="/">
<img src="/images/logo/logo.svg?v=3" />
<img src="images/logo/logo.svg?v=3" />
</a>
</header>
<div class="cms-page">
Expand All @@ -45,4 +45,4 @@ <h1>{{_ "Install_FxOs"}}</h1>
</div>
</div>
</section>
</template>
</template>

0 comments on commit 83c56cf

Please sign in to comment.