Skip to content
Snippets Groups Projects
Commit 9b4876c5 authored by Diego Sampaio's avatar Diego Sampaio
Browse files

Merge branch 'develop' of github.com:RocketChat/Rocket.Chat into develop

parents 7dee035b 3bb885ae
No related merge requests found
Showing
with 142 additions and 19 deletions
......@@ -65,6 +65,7 @@
"Add_Members" : "Add Members",
"Add_users" : "Add users",
"Administration" : "Administration",
"Alias" : "Alias",
"All_channels" : "All channels",
"Allow_Invalid_SelfSigned_Certs" : "Allow Invalid Self-Signed Certs",
"Allow_Invalid_SelfSigned_Certs_Description" : "Allow invalid and self-signed SSL certificate's for link validation and previews.",
......@@ -79,6 +80,7 @@
"Are_you_sure" : "Are you sure?",
"Auto_Load_Images" : "Auto Load Images",
"Avatar_changed_successfully" : "Avatar changed successfully",
"Avatar_URL" : "Avatar URL",
"Avatar_url_invalid_or_error" : "The url provided is invalid or not accessible. Please try again, but with a different url.",
"away" : "away",
"Away" : "Away",
......@@ -102,6 +104,7 @@
"Channels" : "Channels",
"Channels_list" : "List of public channels",
"Chat_Rooms" : "Chat Rooms",
"Choose_the_alias_that_will_appear_before_the_username_in_messages" : "Choose the alias that will appear before the username in messages.",
"Choose_the_username_that_this_integration_will_post_as" : "Choose the username that this integration will post as.",
"Clear_all_unreads_question" : "Clear all unreads?",
"close" : "close",
......@@ -118,6 +121,7 @@
"Create_new_private_group" : "Create a new private group",
"Create_new_public_channel" : "Create a new public channel",
"Created_at" : "Created at",
"Created_at_s_by_s" : "Created at <strong>%s</strong> by <strong>%s</strong>",
"Custom_oauth_helper" : "When setting up your OAuth Provider, you'll have to inform a Callback URL. Use <pre>%s</pre> .",
"Custom_oauth_unique_name" : "Custom oauth unique name",
"days" : "days",
......@@ -153,8 +157,8 @@
"FileUpload" : "File Upload",
"FileUpload_Enabled" : "File Uploads Enabled",
"FileUpload_MaxFileSize" : "Maximum File Upload Size (in bytes)",
"FileUpload_MediaTypeWhiteList" : "Accepted Media Types",
"FileUpload_MediaType_NotAccepted" : "Media Types Not Accepted",
"FileUpload_MediaTypeWhiteList" : "Accepted Media Types",
"FileUpload_MediaTypeWhiteListDescription" : "Comma-separated list of media types",
"Follow_social_profiles" : "Follow our social profiles, fork us on github and share your thoughts about the rocket.chat app on our trello board.",
"Forgot_password" : "Forgot your password",
......@@ -285,6 +289,7 @@
"Name" : "Name",
"Name_cant_be_empty" : "Name can't be empty",
"Name_optional" : "Name (optional)",
"New_integration" : "New integration",
"New_messages" : "New messages",
"New_password" : "New password",
"No_channel_with_name_%s_was_found" : "No channel with name <strong>\"%s\"</strong> was found!",
......@@ -320,10 +325,8 @@
"Please_wait_activation" : "Please wait, this can take some time.",
"Please_wait_statistics" : "Please wait, statistics are being generated.",
"Post_as" : "Post as",
"New_integration" : "New integration",
"Post_to_s_as_s" : "Post to <strong>%s</strong> as <strong>%s</strong>",
"Created_at_s_by_s" : "Created at <strong>%s</strong> by <strong>%s</strong>",
"Post_to_Channel" : "Post to Channel",
"Post_to_s_as_s" : "Post to <strong>%s</strong> as <strong>%s</strong>",
"Powered_by" : "Powered by",
"Preferences" : "Preferences",
"Preferences_saved" : "Preferences saved",
......@@ -402,6 +405,7 @@
"Send_your_JSON_payloads_to_this_URL" : "Send your JSON payloads to this URL.",
"Settings" : "Settings",
"Settings_updated" : "Settings updated",
"Should_be_a_URL_of_an_image" : "Should be a URL of an image.",
"Should_exists_a_user_with_this_username" : "Should exists a user with this username.",
"Showing_online_users" : "Showing <b>__total_online__</b> of __total__ users",
"Showing_results" : "<p>Showing <b>%s</b> results</p>",
......@@ -481,6 +485,7 @@
"User_left_male" : "Has left the channel.",
"User_logged_out" : "User is logged out",
"User_not_found_or_incorrect_password" : "User not found or incorrect password",
"User_or_channel_name" : "User or channel name",
"User_removed_by" : "User <em>__user_removed__</em> removed by <em>__user_by__</em>.",
"User_Settings" : "User Settings",
"User_updated_successfully" : "User updated successfully",
......@@ -505,6 +510,7 @@
"Yes_clear_all" : "Yes, clear all!",
"Yes_delete_it" : "Yes, delete it!",
"you_are_in_preview_mode_of" : "You are in preview mode of channel #<strong>__room_name__</strong>",
"You_can_change_a_different_avatar_too" : "You can change a different avatar too",
"You_need_confirm_email" : "You need to confirm your email to login!",
"You_should_name_it_to_easily_manage_your_integrations" : "You should name it to easily manage your integrations.",
"You_will_not_be_able_to_recover" : "You will not be able to recover this message!",
......
......@@ -40,3 +40,9 @@
border-bottom: none;
}
}
.message-example {
li {
list-style: none;
}
}
Template.integrationsIncoming.onCreated ->
@record = new ReactiveVar
username: 'rocket.cat'
Template.integrationsIncoming.helpers
hasPermission: ->
......@@ -10,12 +15,42 @@ Template.integrationsIncoming.helpers
data = ChatIntegrations.findOne({_id: params.id})
if data?
data.url = Meteor.absoluteUrl("hooks/#{encodeURIComponent(data._id)}/#{encodeURIComponent(data.userId)}/#{encodeURIComponent(data.token)}")
Template.instance().record.set data
return data
return {}
return Template.instance().record.curValue
example: ->
record = Template.instance().record.get()
return {} =
_id: Random.id()
alias: record.alias
avatar: record.avatar
msg: 'Example message'
bot:
i: Random.id()
attachments: [{
title: "Rocket.Chat"
title_link: "https://rocket.chat"
text: "Rocket.Chat, the best open source chat"
image_url: "https://rocket.chat/images/mockup.png"
color: "#764FA5"
}]
ts: new Date
u:
_id: Random.id()
username: record.username
Template.integrationsIncoming.events
"blur input": (e, t) ->
t.record.set
name: $('[name=name]').val().trim()
alias: $('[name=alias]').val().trim()
avatar: $('[name=avatar]').val().trim()
channel: $('[name=channel]').val().trim()
username: $('[name=username]').val().trim()
"click .submit > .delete": ->
params = Template.instance().data.params()
......@@ -42,6 +77,8 @@ Template.integrationsIncoming.events
"click .submit > .save": ->
name = $('[name=name]').val().trim()
alias = $('[name=alias]').val().trim()
avatar = $('[name=avatar]').val().trim()
channel = $('[name=channel]').val().trim()
username = $('[name=username]').val().trim()
......@@ -53,6 +90,8 @@ Template.integrationsIncoming.events
integration =
channel: channel
alias: alias if alias isnt ''
avatar: avatar if avatar isnt ''
name: name if name isnt ''
params = Template.instance().data.params?()
......
......@@ -23,7 +23,7 @@
<div class="input-line double-col">
<label>{{_ "Post_as"}}</label>
<div>
{{#if data.username}}
{{#if data.token}}
<input type="text" name="username" value="{{data.username}}" disabled="disabled" />
{{else}}
<input type="text" name="username" value="{{data.username}}" />
......@@ -32,6 +32,21 @@
<div class="settings-description">{{_ "Should_exists_a_user_with_this_username"}}</div>
</div>
</div>
<div class="input-line double-col">
<label>{{_ "Alias"}} ({{_ "optional"}})</label>
<div>
<input type="text" name="alias" value="{{data.alias}}" placeholder="{{_ 'Optional'}}" />
<div class="settings-description">{{_ "Choose_the_alias_that_will_appear_before_the_username_in_messages"}}</div>
</div>
</div>
<div class="input-line double-col">
<label>{{_ "Avatar_URL"}} ({{_ "optional"}})</label>
<div>
<input type="url" name="avatar" value="{{data.avatar}}" placeholder="{{_ 'Optional'}}" />
<div class="settings-description">{{_ "You_can_change_a_different_avatar_too"}}</div>
<div class="settings-description">{{_ "Should_be_a_URL_of_an_image"}}</div>
</div>
</div>
{{#if data.token}}
<div class="input-line double-col">
<label>Webhook URL</label>
......@@ -42,6 +57,9 @@
</div>
</div>
{{/if}}
<div class="input-line message-example">
{{#nrr nrrargs 'message' example}}{{/nrr}}
</div>
</div>
</div>
<div class="submit">
......
......@@ -71,6 +71,8 @@ Api.addRoute ':integrationId/:userId/:token', authRequired: true,
error: 'invalid-channel-type'
message =
avatar: integration.avatar
alias: integration.alias
msg: @bodyParams.text or ''
attachments: @bodyParams.attachments
parseUrls: false
......
......@@ -39,6 +39,8 @@ Meteor.methods
RocketChat.models.Integrations.update integrationId,
$set:
name: integration.name
avatar: integration.avatar
alias: integration.alias
channel: integration.channel
_updatedAt: new Date
_updatedBy: RocketChat.models.Users.findOne @userId, {fields: {username: 1}}
......
......@@ -10,7 +10,7 @@ RocketChat.sendMessage = (user, message, room, options) ->
message.rid = room._id
if not message.parseUrls is false
if message.parseUrls isnt false
if urls = message.msg.match /([A-Za-z]{3,9}):\/\/([-;:&=\+\$,\w]+@{1})?([-A-Za-z0-9\.]+)+:?(\d+)?((\/[-\+=!:~%\/\.@\,\w]+)?\??([-\+=&!:;%@\/\.\,\w]+)?#?([\w]+)?)?/g
message.urls = urls.map (url) -> url: url
......
......@@ -10,13 +10,13 @@ Meteor.methods
name = name.toLowerCase().replace(/[^a-z0-9]/g, '')
name = s.capitalize(name)
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}" , false , { type: 'boolean', group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Enable'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_url" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_URL'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_token_path" , '/oauth/token' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Token_Path'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_identity_path" , '/me' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Identity_Path'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_authorize_path" , '/oauth/authorize', { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Authorize_Path'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_id" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_id'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_secret" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Secret'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_label_text" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Text'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_label_color", '#FFFFFF' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Color'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_color" , '#13679A' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Color'}
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}" , false , { type: 'boolean', group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Enable', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_url" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_URL', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_token_path" , '/oauth/token' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Token_Path', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_identity_path" , '/me' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Identity_Path', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_authorize_path" , '/oauth/authorize', { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Authorize_Path', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_id" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_id', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_secret" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Secret', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_label_text" , '' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Text', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_label_color", '#FFFFFF' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Color', persistent: true }
RocketChat.settings.add "Accounts_OAuth_Custom_#{name}_button_color" , '#13679A' , { type: 'string' , group: 'Accounts', section: "Custom OAuth: #{name}", i18nLabel: 'Accounts_OAuth_Custom_Button_Color', persistent: true }
......@@ -427,6 +427,7 @@ select,
input[type='text'],
input[type='number'],
input[type='email'],
input[type='url'],
input[type='password'] {
-webkit-appearance: none;
height: 35px;
......@@ -466,6 +467,7 @@ form.inline {
input[type='text'],
input[type='number'],
input[type='email'],
input[type='url'],
input[type='password'] {
width: auto;
}
......@@ -2700,6 +2702,11 @@ a.github-fork {
&.temp .body {
opacity: .5;
}
.message-alias {
color: #aaa;
font-weight: 400;
padding-left: 2px;
}
}
.compact {
......
......@@ -32,6 +32,11 @@
padding-right: 0px;
}
code {
unicode-bidi: embed;
direction: ltr;
}
.side-nav {
.right(0px);
.header {
......
......@@ -136,6 +136,7 @@ select,
input[type='text'],
input[type='number'],
input[type='email'],
input[type='url'],
input[type='password'] {
border-color: #E7E7E7;
background-color: #fff;
......
<template name="message">
<li id="{{_id}}" class="message sequential {{system}} {{t}} {{own}} {{isTemp}} {{chatops}}" data-username="{{u.username}}" data-bot="{{isBot}}" data-date="{{date}}">
<a class="thumb user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{> avatar username=u.username}}</a>
<a class="user user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{u.username}}</a>
{{#if avatar}}
<a class="thumb user-card-message" href="#" data-username="{{u.username}}" tabindex="1">
<div class="avatar">
<div class="avatar-image" style="background-image:url({{avatar}});"></div>
</div>
</a>
{{else}}
<a class="thumb user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{> avatar username=u.username}}</a>
{{/if}}
{{#if alias}}
<a class="user user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{alias}} <span class="message-alias">@{{u.username}}</span></a>
{{else}}
<a class="user user-card-message" href="#" data-username="{{u.username}}" tabindex="1">{{u.username}}</a>
{{/if}}
<span class="info">
{{#if isBot}}
<span class="is-bot">BOT</span>
......
private/avatars/rocketcat.png

6.61 KiB

......@@ -5,6 +5,26 @@ Meteor.startup ->
RocketChat.models.Rooms.createWithIdTypeAndName 'GENERAL', 'c', 'general',
default: true
if not RocketChat.models.Users.findOneById('rocket.cat')?
RocketChat.models.Users.create
_id: 'rocket.cat'
name: "Rocket.Cat"
username: 'rocket.cat'
status: "offline"
statusDefault: "offline"
utcOffset: 0
active: true
bot: true
rs = RocketChatFile.bufferToStream new Buffer(Assets.getBinary('avatars/rocketcat.png'), 'utf8')
RocketChatFileAvatarInstance.deleteFile "rocket.cat.jpg"
ws = RocketChatFileAvatarInstance.createWriteStream "rocket.cat.jpg", 'image/png'
ws.on 'end', Meteor.bindEnvironment ->
RocketChat.models.Users.setAvatarOrigin 'rocket.cat', 'local'
rs.pipe(ws)
if process.env.ADMIN_EMAIL? and process.env.ADMIN_PASS?
re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if re.test process.env.ADMIN_EMAIL
......
Meteor.startup ->
Migrations.add
version: 25
up: ->
RocketChat.models.Settings.update({ _id: /Accounts_OAuth_Custom/ }, { $set: { persistent: true }, $unset: {hidden: true} }, { multi: true })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment