diff --git a/packages/rocketchat-assets/package.js b/packages/rocketchat-assets/package.js index b4e51c031662..19d0477df392 100644 --- a/packages/rocketchat-assets/package.js +++ b/packages/rocketchat-assets/package.js @@ -13,7 +13,8 @@ Package.onUse(function(api) { 'underscore', 'webapp', 'rocketchat:file', - 'rocketchat:lib' + 'rocketchat:lib', + 'webapp-hashing' ]); api.addFiles('server/assets.coffee', 'server'); diff --git a/packages/rocketchat-assets/server/assets.coffee b/packages/rocketchat-assets/server/assets.coffee index 64df1800b7a7..64f4fe339a79 100644 --- a/packages/rocketchat-assets/server/assets.coffee +++ b/packages/rocketchat-assets/server/assets.coffee @@ -1,5 +1,6 @@ sizeOf = Npm.require 'image-size' mime = Npm.require 'mime-types' +crypto = Npm.require 'crypto' mime.extensions['image/vnd.microsoft.icon'] = ['ico'] @@ -9,64 +10,64 @@ mime.extensions['image/vnd.microsoft.icon'] = ['ico'] assets = 'logo': - label: 'logo (svg, png)' - defaultUrl: 'images/logo/logo.svg?v=3' + label: 'logo (svg, png, jpg)' + defaultUrl: 'images/logo/logo.svg' constraints: type: 'image' - extensions: ['svg', 'png'] + extensions: ['svg', 'png', 'jpg', 'jpeg'] width: undefined height: undefined - 'favicon.ico': + 'favicon': label: 'favicon.ico' - defaultUrl: 'favicon.ico?v=3' + defaultUrl: 'favicon.ico' constraints: type: 'image' extensions: ['ico'] width: undefined height: undefined - 'favicon.svg': + 'favicon': label: 'favicon.svg' - defaultUrl: 'images/logo/icon.svg?v=3' + defaultUrl: 'images/logo/icon.svg' constraints: type: 'image' extensions: ['svg'] width: undefined height: undefined - 'favicon_64.png': + 'favicon_64': label: 'favicon.png (64x64)' - defaultUrl: 'images/logo/favicon-64x64.png?v=3' + defaultUrl: 'images/logo/favicon-64x64.png' constraints: type: 'image' extensions: ['png'] width: 64 height: 64 - 'favicon_96.png': + 'favicon_96': label: 'favicon.png (96x96)' - defaultUrl: 'images/logo/favicon-96x96.png?v=3' + defaultUrl: 'images/logo/favicon-96x96.png' constraints: type: 'image' extensions: ['png'] width: 96 height: 96 - 'favicon_128.png': + 'favicon_128': label: 'favicon.png (128x128)' - defaultUrl: 'images/logo/favicon-128x128.png?v=3' + defaultUrl: 'images/logo/favicon-128x128.png' constraints: type: 'image' extensions: ['png'] width: 128 height: 128 - 'favicon_192.png': + 'favicon_192': label: 'favicon.png (192x192)' - defaultUrl: 'images/logo/android-chrome-192x192.png?v=3' + defaultUrl: 'images/logo/android-chrome-192x192.png' constraints: type: 'image' extensions: ['png'] width: 192 height: 192 - 'favicon_256.png': + 'favicon_256': label: 'favicon.png (256x256)' - defaultUrl: 'images/logo/favicon-256x256.png?v=3' + defaultUrl: 'images/logo/favicon-256x256.png' constraints: type: 'image' extensions: ['png'] @@ -74,44 +75,16 @@ assets = height: 256 -RocketChat.settings.addGroup 'Assets' -for key, value of assets - RocketChat.settings.add "Assets_#{key}", '', { type: 'asset', group: 'Assets', fileConstraints: value.constraints, i18nLabel: value.label, asset: key } - - -Meteor.methods - unsetAsset: (asset) -> - unless Meteor.userId() - throw new Meteor.Error 'invalid-user', "[methods] unsetAsset -> Invalid user" - - hasPermission = RocketChat.authz.hasPermission Meteor.userId(), 'manage-assets' - unless hasPermission - throw new Meteor.Error 'manage-assets-not-allowed', "[methods] unsetAsset -> Manage assets not allowed" - - if not assets[asset]? - throw new Meteor.Error "Invalid_asset" - - RocketChatAssetsInstance.deleteFile asset - RocketChat.settings.clearById "Assets_#{asset}" - - -Meteor.methods +RocketChat.Assets = new class setAsset: (binaryContent, contentType, asset) -> - unless Meteor.userId() - throw new Meteor.Error 'invalid-user', "[methods] setAsset -> Invalid user" - - hasPermission = RocketChat.authz.hasPermission Meteor.userId(), 'manage-assets' - unless hasPermission - throw new Meteor.Error 'manage-assets-not-allowed', "[methods] unsetAsset -> Manage assets not allowed" - if not assets[asset]? throw new Meteor.Error "Invalid_asset" - if mime.extension(contentType) not in assets[asset].constraints.extensions + extension = mime.extension(contentType) + if extension not in assets[asset].constraints.extensions throw new Meteor.Error "Invalid_file_type", contentType file = new Buffer(binaryContent, 'binary') - if assets[asset].constraints.width? or assets[asset].constraints.height? dimensions = sizeOf file @@ -126,28 +99,168 @@ Meteor.methods ws = RocketChatAssetsInstance.createWriteStream asset, contentType ws.on 'end', Meteor.bindEnvironment -> Meteor.setTimeout -> - RocketChat.settings.updateById "Assets_#{asset}", "/assets/#{asset}" + RocketChat.settings.updateById "Assets_#{asset}", { + url: "/assets/#{asset}.#{extension}" + defaultUrl: assets[asset].defaultUrl + } , 200 rs.pipe ws return + unsetAsset: (asset) -> + if not assets[asset]? + throw new Meteor.Error "Invalid_asset" + + RocketChatAssetsInstance.deleteFile asset + + RocketChat.settings.updateById "Assets_#{asset}", {defaultUrl: assets[asset].defaultUrl} + return + + refreshClients: -> + process.emit('message', {refresh: 'client'}) + + +RocketChat.settings.addGroup 'Assets' +for key, value of assets + do (key, value) -> + RocketChat.settings.add "Assets_#{key}", {defaultUrl: value.defaultUrl}, { type: 'asset', group: 'Assets', fileConstraints: value.constraints, i18nLabel: value.label, asset: key, public: true } + +Meteor.startup -> + forEachAsset = (key, value) -> + RocketChat.settings.get "Assets_#{key}", (settingKey, settingValue) -> + if settingValue is undefined + value.cache = undefined + return + + file = RocketChatAssetsInstance.getFileWithReadStream key + if not file + value.cache = undefined + return + + data = [] + file.readStream.on 'data', Meteor.bindEnvironment (chunk) -> + data.push chunk + + file.readStream.on 'end', Meteor.bindEnvironment -> + data = Buffer.concat(data) + hash = crypto.createHash('sha1').update(data).digest('hex') + extension = settingValue.url.split('.').pop() + value.cache = + path: "assets/#{key}.#{extension}" + cacheable: false + sourceMapUrl: undefined + where: 'client' + type: 'asset' + content: data + extension: extension + url: "/assets/#{key}.#{extension}?#{hash}" + size: file.length + uploadDate: file.uploadDate + contentType: file.contentType + hash: hash + + + forEachAsset(key, value) for key, value of assets + +calculateClientHash = WebAppHashing.calculateClientHash +WebAppHashing.calculateClientHash = (manifest, includeFilter, runtimeConfigOverride) -> + for key, value of assets + if not value.cache? && not value.defaultUrl? + continue + + manifestItem = _.find manifest, (item) -> + return item.path is key + + cache = {} + if value.cache + cache = + path: value.cache.path + cacheable: value.cache.cacheable + sourceMapUrl: value.cache.sourceMapUrl + where: value.cache.where + type: value.cache.type + url: value.cache.url + size: value.cache.size + hash: value.cache.hash + + WebAppInternals.staticFiles["/__cordova/assets/#{key}"] = value.cache + WebAppInternals.staticFiles["/__cordova/assets/#{key}.#{value.cache.extension}"] = value.cache + else + extension = value.defaultUrl.split('.').pop() + cache = + path: "assets/#{key}.#{extension}" + cacheable: false + sourceMapUrl: undefined + where: 'client' + type: 'asset' + url: "/assets/#{key}.#{extension}?v3" + # size: value.cache.size + hash: 'v3' + + WebAppInternals.staticFiles["/__cordova/assets/#{key}"] = WebAppInternals.staticFiles["/__cordova/#{value.defaultUrl}"] + WebAppInternals.staticFiles["/__cordova/assets/#{key}.#{extension}"] = WebAppInternals.staticFiles["/__cordova/#{value.defaultUrl}"] + + + if manifestItem? + index = manifest.indexOf(manifestItem) + + manifest[index] = cache + else + manifest.push cache + + return calculateClientHash.call this, manifest, includeFilter, runtimeConfigOverride + + +Meteor.methods + refreshClients: -> + unless Meteor.userId() + throw new Meteor.Error 'invalid-user', "[methods] unsetAsset -> Invalid user" + + hasPermission = RocketChat.authz.hasPermission Meteor.userId(), 'manage-assets' + unless hasPermission + throw new Meteor.Error 'manage-assets-not-allowed', "[methods] unsetAsset -> Manage assets not allowed" + + RocketChat.Assets.refreshClients + + + unsetAsset: (asset) -> + unless Meteor.userId() + throw new Meteor.Error 'invalid-user', "[methods] unsetAsset -> Invalid user" + + hasPermission = RocketChat.authz.hasPermission Meteor.userId(), 'manage-assets' + unless hasPermission + throw new Meteor.Error 'manage-assets-not-allowed', "[methods] unsetAsset -> Manage assets not allowed" + + RocketChat.Assets.unsetAsset asset + + + setAsset: (binaryContent, contentType, asset) -> + unless Meteor.userId() + throw new Meteor.Error 'invalid-user', "[methods] setAsset -> Invalid user" + + hasPermission = RocketChat.authz.hasPermission Meteor.userId(), 'manage-assets' + unless hasPermission + throw new Meteor.Error 'manage-assets-not-allowed', "[methods] unsetAsset -> Manage assets not allowed" + + RocketChat.Assets.setAsset binaryContent, contentType, asset + return + WebApp.connectHandlers.use '/assets/', Meteor.bindEnvironment (req, res, next) -> params = - asset: decodeURIComponent(req.url.replace(/^\//, '').replace(/\?.*$/, '')) - - file = RocketChatAssetsInstance.getFileWithReadStream params.asset + asset: decodeURIComponent(req.url.replace(/^\//, '').replace(/\?.*$/, '')).replace(/\.[^.]*$/, '') - # res.setHeader 'Content-Disposition', 'inline' + file = assets[params.asset]?.cache if not file? if assets[params.asset]?.defaultUrl? - res.writeHead 301, - Location: Meteor.absoluteUrl(assets[params.asset].defaultUrl) + req.url = '/'+assets[params.asset].defaultUrl + WebAppInternals.staticFilesMiddleware WebAppInternals.staticFiles, req, res, next else res.writeHead 404 - res.end() + res.end() + return reqModifiedHeader = req.headers["if-modified-since"]; @@ -162,7 +275,8 @@ WebApp.connectHandlers.use '/assets/', Meteor.bindEnvironment (req, res, next) - res.setHeader 'Expires', '-1' res.setHeader 'Last-Modified', file.uploadDate?.toUTCString() or new Date().toUTCString() res.setHeader 'Content-Type', file.contentType - res.setHeader 'Content-Length', file.length + res.setHeader 'Content-Length', file.size - file.readStream.pipe res + res.writeHead 200 + res.end(file.content) return diff --git a/packages/rocketchat-lib/i18n/de.i18n.json b/packages/rocketchat-lib/i18n/de.i18n.json index 246be9488737..c76b59bfa844 100644 --- a/packages/rocketchat-lib/i18n/de.i18n.json +++ b/packages/rocketchat-lib/i18n/de.i18n.json @@ -400,7 +400,6 @@ "Layout" : "Layout", "Layout_Home_Body" : "Inhalt der Startseite", "Layout_Home_Title" : "Titel der Startseite", - "Layout_Login_Header" : "Kopfzeile der Anmeldeseite", "Layout_Login_Terms" : "Anmeldebedingungen", "Layout_Privacy_Policy" : "Datenschutzbestimmungen", "Layout_Sidenav_Footer" : "Seitenfußzeile", @@ -1011,4 +1010,4 @@ "Your_Open_Source_solution" : "Deine eigene Open-Source-Chat-Lösung.", "Your_password_is_wrong" : "Falsches Passwort", "Your_push_was_sent_to_s_devices" : "Die Push-Nachricht wurde an %s Geräte gesendet." -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/en.i18n.json b/packages/rocketchat-lib/i18n/en.i18n.json index 6810ad847c5f..86b8762a8db4 100644 --- a/packages/rocketchat-lib/i18n/en.i18n.json +++ b/packages/rocketchat-lib/i18n/en.i18n.json @@ -132,6 +132,7 @@ "Application_added" : "Application added", "Application_Name" : "Application Name", "Application_updated" : "Application updated", + "Apply_and_refresh_all_clients" : "Apply and refresh all clients", "Archive" : "Archive", "Archive_Unarchive" : "Archive / Unarchive", "are_also_typing" : "are also typing", @@ -185,6 +186,7 @@ "Clear_all_unreads_question" : "Clear all unreads?", "Client_ID" : "Client ID", "Client_Secret" : "Client Secret", + "Clients_will_refresh_in_a_few_seconds" : "Clients will refresh in a few seconds", "close" : "close", "Closed" : "Closed", "coming_soon" : "coming soon", @@ -407,7 +409,6 @@ "Layout" : "Layout", "Layout_Home_Body" : "Home Body", "Layout_Home_Title" : "Home Title", - "Layout_Login_Header" : "Login Header", "Layout_Login_Terms" : "Login Terms", "Layout_Privacy_Policy" : "Privacy Policy", "Layout_Sidenav_Footer" : "Side Navigation Footer", diff --git a/packages/rocketchat-lib/i18n/es.i18n.json b/packages/rocketchat-lib/i18n/es.i18n.json index 9e3bfaaa1bb9..84af7be6a4cb 100644 --- a/packages/rocketchat-lib/i18n/es.i18n.json +++ b/packages/rocketchat-lib/i18n/es.i18n.json @@ -288,7 +288,6 @@ "Layout" : "Diseño", "Layout_Home_Body" : "Cuerpo de pagina de inicio", "Layout_Home_Title" : "Titulo de pagina de inicio", - "Layout_Login_Header" : "Encabezado de Inicio de Sesión ", "Layout_Login_Terms" : "Términos de Inicio de Sesión ", "Layout_Privacy_Policy" : "Política de Privacidad", "Layout_Sidenav_Footer" : "Pie de Pagina de la Barra de Navegación Lateral", @@ -728,4 +727,4 @@ "Your_entry_has_been_deleted" : "Tu entrada ha sido eliminada", "Your_file_has_been_deleted" : "Tu archivo ha sido eliminado.", "Your_Open_Source_solution" : "Tu propia solución de chat de código abierto" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/fi.i18n.json b/packages/rocketchat-lib/i18n/fi.i18n.json index b5aee6a9b20a..4ab26bd847bf 100644 --- a/packages/rocketchat-lib/i18n/fi.i18n.json +++ b/packages/rocketchat-lib/i18n/fi.i18n.json @@ -310,7 +310,6 @@ "Layout" : "Ulkoasu", "Layout_Home_Body" : "Etusivun runko", "Layout_Home_Title" : "Etusivun otsikko", - "Layout_Login_Header" : "Kirjautumisruudun ylätunniste", "Layout_Login_Terms" : "Kirjautumisehdot", "Layout_Privacy_Policy" : "Tietosuojakäytäntö", "Layout_Sidenav_Footer" : "Sivunavigoinnin alatunniste", @@ -808,4 +807,4 @@ "Your_mail_was_sent_to_s" : "Sähköpostisi lähetettiin, vastaanottaja %s", "Your_Open_Source_solution" : "Your own Open Source chat solution", "Your_push_was_sent_to_s_devices" : "Push-viesti lähetettiin %s laitteeseen" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/fr.i18n.json b/packages/rocketchat-lib/i18n/fr.i18n.json index ccec48bea7ac..1361a21ca552 100644 --- a/packages/rocketchat-lib/i18n/fr.i18n.json +++ b/packages/rocketchat-lib/i18n/fr.i18n.json @@ -395,7 +395,6 @@ "Layout" : "Disposition", "Layout_Home_Body" : "Contenu de la page d'accueil", "Layout_Home_Title" : "Titre de la page d'accueil", - "Layout_Login_Header" : "En-tête de connexion", "Layout_Login_Terms" : "Conditions de connexion", "Layout_Privacy_Policy" : "Politique de confidentialité", "Layout_Sidenav_Footer" : "Pied de page de la sidebar", @@ -1002,4 +1001,4 @@ "Your_Open_Source_solution" : "Votre propre solution de chat Open Source", "Your_password_is_wrong" : "Votre mot de passe est incorrect !", "Your_push_was_sent_to_s_devices" : "Votre notification a été envoyée à %s appareils" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/he.i18n.json b/packages/rocketchat-lib/i18n/he.i18n.json index 07645abfee15..5f30bd793126 100644 --- a/packages/rocketchat-lib/i18n/he.i18n.json +++ b/packages/rocketchat-lib/i18n/he.i18n.json @@ -170,7 +170,6 @@ "Layout" : "פריסה", "Layout_Home_Body" : "גוף עמוד הבית", "Layout_Home_Title" : "כותרת עמוד הבית", - "Layout_Login_Header" : "כותרת כניסה", "Layout_Login_Terms" : "תנאי כניסה", "Layout_Privacy_Policy" : "מדיניות פרטיות", "Layout_Terms_of_Service" : "תנאי השירות", @@ -423,4 +422,4 @@ "You_will_not_be_able_to_recover" : "לא תהיה לך אפשרות לשחזר את ההודעה הזו!", "Your_entry_has_been_deleted" : "הרשומה שלך נמחקה", "Your_Open_Source_solution" : "הפתרון " -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/ja.i18n.json b/packages/rocketchat-lib/i18n/ja.i18n.json index d156a6de1618..dff59d987dad 100644 --- a/packages/rocketchat-lib/i18n/ja.i18n.json +++ b/packages/rocketchat-lib/i18n/ja.i18n.json @@ -384,7 +384,6 @@ "Layout" : "レイアウト", "Layout_Home_Body" : "ホーム画面の本文", "Layout_Home_Title" : "ホーム画面のタイトル", - "Layout_Login_Header" : "ログイン画面のヘッダー", "Layout_Login_Terms" : "ログイン画面の規約", "Layout_Privacy_Policy" : "プライバシーポリシー", "Layout_Sidenav_Footer" : "サイドナビゲーションのフッター", @@ -990,4 +989,4 @@ "Your_Open_Source_solution" : "独自のオープンソースチャットソリューション", "Your_password_is_wrong" : "パスワードが間違っています!", "Your_push_was_sent_to_s_devices" : "プッシュ通知が %s 台のデバイスへ送信されました" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/km.i18n.json b/packages/rocketchat-lib/i18n/km.i18n.json index 657614cbbcbf..db7675a91dec 100644 --- a/packages/rocketchat-lib/i18n/km.i18n.json +++ b/packages/rocketchat-lib/i18n/km.i18n.json @@ -209,7 +209,6 @@ "Layout" : "ប្លង់", "Layout_Home_Body" : "តួរសេចក្តីទំព័រដើម", "Layout_Home_Title" : "ចំណងជើងទំព័រដើម", - "Layout_Login_Header" : "ក្បាលទំព័រចូល", "Layout_Login_Terms" : "លក្ខ័ណចូល", "Layout_Privacy_Policy" : "គោលការណ៍ឯកជនភាព", "Layout_Sidenav_Footer" : "ចំហៀង​របស់​កម្មវិធី​រុករក​បាតកថា", @@ -516,4 +515,4 @@ "You_will_not_be_able_to_recover" : "អ្នក​នឹង​មិនអាច​ទាញ​មក​វិញ!", "Your_entry_has_been_deleted" : "ការ​បញ្ចូល​អ្នក​បាន​លប់", "Your_Open_Source_solution" : "ដំណោះ​ស្រាយ​ពិភាក្សាកូដ​ចំហរ​របស់​អ្នក" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/ko.i18n.json b/packages/rocketchat-lib/i18n/ko.i18n.json index 8fd5ada578b2..4256744c9622 100644 --- a/packages/rocketchat-lib/i18n/ko.i18n.json +++ b/packages/rocketchat-lib/i18n/ko.i18n.json @@ -221,7 +221,6 @@ "Layout" : "레이아웃", "Layout_Home_Body" : "홈 본문 내용", "Layout_Home_Title" : "홈 제목", - "Layout_Login_Header" : "로그인 헤더", "Layout_Login_Terms" : "로그인 약관", "Layout_Privacy_Policy" : "개인정보취급방침", "Layout_Sidenav_Footer" : "옆 네비 바닥글", @@ -541,4 +540,4 @@ "You_will_not_be_able_to_recover" : "이 메시지는 복구할 수 없습니다!", "Your_entry_has_been_deleted" : "항목이 삭제되었습니다.", "Your_Open_Source_solution" : "당신만의 오픈소스 채팅 솔루션" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/ms-MY.i18n.json b/packages/rocketchat-lib/i18n/ms-MY.i18n.json index ff84a04018ad..a2e7ef703b4c 100644 --- a/packages/rocketchat-lib/i18n/ms-MY.i18n.json +++ b/packages/rocketchat-lib/i18n/ms-MY.i18n.json @@ -152,7 +152,6 @@ "Layout" : "Tata atur", "Layout_Home_Body" : "Badan Laman", "Layout_Home_Title" : "Tajuk Halaman Utama", - "Layout_Login_Header" : "Login Header", "Layout_Login_Terms" : "Terma Log masuk", "Layout_Privacy_Policy" : "Dasar Privasi", "Layout_Sidenav_Footer" : "Navigasi Belah Tepi Footer", @@ -394,4 +393,4 @@ "You_need_confirm_email" : "Anda perlu mengesahkan e-mel anda untuk melog masuk!", "You_will_not_be_able_to_recover" : "Anda tidak boleh membaik pulih.", "Your_entry_has_been_deleted" : "Entri anda telah dipadam." -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/nl.i18n.json b/packages/rocketchat-lib/i18n/nl.i18n.json index 0f9c49bdf441..c922d5c1230d 100644 --- a/packages/rocketchat-lib/i18n/nl.i18n.json +++ b/packages/rocketchat-lib/i18n/nl.i18n.json @@ -320,7 +320,6 @@ "Layout" : "Lay-out", "Layout_Home_Body" : "Home Body", "Layout_Home_Title" : "Home Titel", - "Layout_Login_Header" : "Login Header", "Layout_Login_Terms" : "Login voorwaarden", "Layout_Privacy_Policy" : "Privacybeleid", "Layout_Sidenav_Footer" : "Side Navigation Footer", @@ -842,4 +841,4 @@ "Your_mail_was_sent_to_s" : "Uw e-mail werd verzonden naar %s", "Your_Open_Source_solution" : "Uw eigen Open Source chat-oplossing", "Your_push_was_sent_to_s_devices" : "Je push werd verzonden naar %s apparaten" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/pl.i18n.json b/packages/rocketchat-lib/i18n/pl.i18n.json index a441c5680d94..098df643b8f4 100644 --- a/packages/rocketchat-lib/i18n/pl.i18n.json +++ b/packages/rocketchat-lib/i18n/pl.i18n.json @@ -242,7 +242,6 @@ "Layout" : "Wygląd i treść", "Layout_Home_Body" : "Treść strony głównej", "Layout_Home_Title" : "Tytuł strony głównej", - "Layout_Login_Header" : "Nagłówek formularza logowania", "Layout_Login_Terms" : "Regulamin rejestacji", "Layout_Privacy_Policy" : "Polityka Prywatności", "Layout_Sidenav_Footer" : "Stopka panelu nawigacyjnego", @@ -601,4 +600,4 @@ "You_will_not_be_able_to_recover" : "Nie będziesz w stanie odzyskać tej wiadomości!", "Your_entry_has_been_deleted" : "Twój wpis został usunięty.", "Your_Open_Source_solution" : "Twój własny czat Open Source" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/pt.i18n.json b/packages/rocketchat-lib/i18n/pt.i18n.json index c229831c22d2..506a9500849d 100644 --- a/packages/rocketchat-lib/i18n/pt.i18n.json +++ b/packages/rocketchat-lib/i18n/pt.i18n.json @@ -229,7 +229,6 @@ "Layout" : "Layout", "Layout_Home_Body" : "Corpo da Home", "Layout_Home_Title" : "Título da Home", - "Layout_Login_Header" : "Header do Login", "Layout_Login_Terms" : "Termos de Login", "Layout_Privacy_Policy" : "Política de Privacidade", "Layout_Sidenav_Footer" : "Rodapé da Navegação Lateral", @@ -545,4 +544,4 @@ "Your_entry_has_been_deleted" : "Sua mensagem foi excluída.", "Your_Open_Source_solution" : "Sua própria solução Open Source", "Your_push_was_sent_to_s_devices" : "Sua natificação foi enviada para %s dispositivos" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/ro.i18n.json b/packages/rocketchat-lib/i18n/ro.i18n.json index d6206f7bea76..04993b731c38 100644 --- a/packages/rocketchat-lib/i18n/ro.i18n.json +++ b/packages/rocketchat-lib/i18n/ro.i18n.json @@ -354,7 +354,6 @@ "Layout" : "Layout", "Layout_Home_Body" : "Corp pagină 'Acasă'", "Layout_Home_Title" : "Titlu pagină 'Acasă'", - "Layout_Login_Header" : "Header Autentificare", "Layout_Login_Terms" : "Termeni Autentificare", "Layout_Privacy_Policy" : "Politica de confidențialitate", "Layout_Sidenav_Footer" : "Footer meniu lateral", @@ -915,4 +914,4 @@ "Your_mail_was_sent_to_s" : "E-mail-ul a fost trimis la %s", "Your_Open_Source_solution" : "Propria soluție de chat Open Source", "Your_push_was_sent_to_s_devices" : "Mesajul Push a fost trimis la %s dispozitive" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/ru.i18n.json b/packages/rocketchat-lib/i18n/ru.i18n.json index cc59336aad3c..4c0480815c70 100644 --- a/packages/rocketchat-lib/i18n/ru.i18n.json +++ b/packages/rocketchat-lib/i18n/ru.i18n.json @@ -392,7 +392,6 @@ "Layout" : "План", "Layout_Home_Body" : "Контент главной", "Layout_Home_Title" : "Название главной", - "Layout_Login_Header" : "Заголовок логина", "Layout_Login_Terms" : "Правила составления логина", "Layout_Privacy_Policy" : "Политика конфиденциальности", "Layout_Sidenav_Footer" : "Футер навигационной панели", @@ -998,4 +997,4 @@ "Your_Open_Source_solution" : "Ваш собственный чат на базе Open Source-технологий", "Your_password_is_wrong" : "Неверный пароль!", "Your_push_was_sent_to_s_devices" : "Ваше push-уведомление было отправлено на % устройств." -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/zh-HK.i18n.json b/packages/rocketchat-lib/i18n/zh-HK.i18n.json index 9cac35cd67aa..a2b4bf01dc63 100644 --- a/packages/rocketchat-lib/i18n/zh-HK.i18n.json +++ b/packages/rocketchat-lib/i18n/zh-HK.i18n.json @@ -115,7 +115,6 @@ "Layout" : "布局", "Layout_Home_Body" : "首页正文", "Layout_Home_Title" : "首页标题", - "Layout_Login_Header" : "登录页面标头", "Layout_Login_Terms" : "登录条款", "Layout_Privacy_Policy" : "隐私政策", "Layout_Sidenav_Footer" : "侧面导航页脚", @@ -319,4 +318,4 @@ "You_will_not_be_able_to_recover" : "您将无法恢复!", "Your_entry_has_been_deleted" : "您的项目已被删除。", "Your_Open_Source_solution" : "您自己的开源聊天解决方案" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/zh-TW.i18n.json b/packages/rocketchat-lib/i18n/zh-TW.i18n.json index d619e6f18e6e..26c1b24f2c65 100644 --- a/packages/rocketchat-lib/i18n/zh-TW.i18n.json +++ b/packages/rocketchat-lib/i18n/zh-TW.i18n.json @@ -142,7 +142,6 @@ "Layout" : "介面", "Layout_Home_Body" : "首页正文", "Layout_Home_Title" : "首頁標題", - "Layout_Login_Header" : "登录页面标头", "Layout_Login_Terms" : "登录条款", "Layout_Privacy_Policy" : "隱私政策", "Layout_Sidenav_Footer" : "侧面导航页脚", @@ -393,4 +392,4 @@ "Your_entry_has_been_deleted" : "您的项目已被删除。", "Your_Open_Source_solution" : "您自己的開源聊天軟體", "Your_push_was_sent_to_s_devices" : "你的推播被送到 %s 裝置" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/i18n/zh.i18n.json b/packages/rocketchat-lib/i18n/zh.i18n.json index 7111a4d9eaa9..4b77f532a95b 100644 --- a/packages/rocketchat-lib/i18n/zh.i18n.json +++ b/packages/rocketchat-lib/i18n/zh.i18n.json @@ -381,7 +381,6 @@ "Layout" : "布局", "Layout_Home_Body" : "首页正文", "Layout_Home_Title" : "首页标题", - "Layout_Login_Header" : "登录页面标头", "Layout_Login_Terms" : "登录条款", "Layout_Privacy_Policy" : "隐私政策", "Layout_Sidenav_Footer" : "侧面导航页脚", @@ -977,4 +976,4 @@ "Your_Open_Source_solution" : "您自己的开源聊天解决方案", "Your_password_is_wrong" : "密码错误!", "Your_push_was_sent_to_s_devices" : "成功向 %s 台设备推送" -} \ No newline at end of file +} diff --git a/packages/rocketchat-lib/server/functions/settings.coffee b/packages/rocketchat-lib/server/functions/settings.coffee index 0619604923e5..5c2824080938 100644 --- a/packages/rocketchat-lib/server/functions/settings.coffee +++ b/packages/rocketchat-lib/server/functions/settings.coffee @@ -160,6 +160,8 @@ RocketChat.settings.updateById = (_id, value) -> if not _id or not value? return false + value._updatedAt = new Date + return RocketChat.models.Settings.updateValueById _id, value diff --git a/packages/rocketchat-lib/server/startup/settings.coffee b/packages/rocketchat-lib/server/startup/settings.coffee index dffc83abf73e..d4bc1d6739b0 100644 --- a/packages/rocketchat-lib/server/startup/settings.coffee +++ b/packages/rocketchat-lib/server/startup/settings.coffee @@ -176,7 +176,6 @@ RocketChat.settings.addGroup 'Layout', -> @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_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-ui-admin/admin/admin.coffee b/packages/rocketchat-ui-admin/admin/admin.coffee index 080474c9a824..bf2bd4b6f6ce 100644 --- a/packages/rocketchat-ui-admin/admin/admin.coffee +++ b/packages/rocketchat-ui-admin/admin/admin.coffee @@ -210,6 +210,10 @@ Template.admin.events return toastr.error TAPi18n.__ 'Error_updating_settings' if err toastr.success TAPi18n.__ 'Settings_updated' + "click .submit .refresh-clients": (e, t) -> + Meteor.call 'refreshClients', -> + toastr.success TAPi18n.__ 'Clients_will_refresh_in_a_few_seconds' + "click .submit .add-custom-oauth": (e, t) -> config = title: TAPi18n.__ 'Add_custom_oauth' diff --git a/packages/rocketchat-ui-admin/admin/admin.html b/packages/rocketchat-ui-admin/admin/admin.html index 3dee317da557..fe62d12adc27 100644 --- a/packages/rocketchat-ui-admin/admin/admin.html +++ b/packages/rocketchat-ui-admin/admin/admin.html @@ -117,9 +117,9 @@

{{/if}} {{#if $eq type 'asset'}} - {{#if value}} + {{#if value.url}}
-
+
@@ -167,6 +167,9 @@

{{#if $eq group._id 'OAuth'}} {{/if}} + {{#if $eq group._id 'Assets'}} + + {{/if}}

{{/unless}} diff --git a/packages/rocketchat-ui-login/login/header.coffee b/packages/rocketchat-ui-login/login/header.coffee index de15c0a07ae8..b9bcec6c49f3 100644 --- a/packages/rocketchat-ui-login/login/header.coffee +++ b/packages/rocketchat-ui-login/login/header.coffee @@ -1,3 +1,5 @@ Template.loginHeader.helpers - header: -> - RocketChat.settings.get 'Layout_Login_Header' \ No newline at end of file + logoUrl: -> + asset = RocketChat.settings.get('Assets_logo') + if asset? + return asset.url or asset.defaultUrl diff --git a/packages/rocketchat-ui-login/login/header.html b/packages/rocketchat-ui-login/login/header.html index d48ab3d02fce..b5c01151ae4d 100644 --- a/packages/rocketchat-ui-login/login/header.html +++ b/packages/rocketchat-ui-login/login/header.html @@ -1,5 +1,5 @@ diff --git a/server/startup/migrations/v36.coffee b/server/startup/migrations/v36.coffee new file mode 100644 index 000000000000..11a63e6f3f59 --- /dev/null +++ b/server/startup/migrations/v36.coffee @@ -0,0 +1,21 @@ +url = Npm.require 'url' +RocketChat.Migrations.add + version: 35 + up: -> + loginHeader = RocketChat.models.Settings.findOne _id: 'Layout_Login_Header' + + if not loginHeader?.value? + return + + match = loginHeader.value.match(/