From 64979308ac3239e95d7323eb68bcd2ab4d38fed5 Mon Sep 17 00:00:00 2001 From: westmakaha Date: Tue, 1 Sep 2015 00:05:26 -0400 Subject: [PATCH] initial sandstorm port --- .meteor/packages | 8 +- .meteor/platforms | 2 - .meteor/versions | 4 +- .../default/virtualbox/action_provision | 1 + .../default/virtualbox/action_set_name | 1 + .../machines/default/virtualbox/creator_uid | 1 + .../.vagrant/machines/default/virtualbox/id | 1 + .../machines/default/virtualbox/index_uuid | 1 + .../machines/default/virtualbox/private_key | 27 ++++++ .../default/virtualbox/synced_folders | 1 + .sandstorm/Vagrantfile | 83 +++++++++++++++++++ .sandstorm/build.sh | 15 ++++ .sandstorm/global-setup.sh | 30 +++++++ .sandstorm/launcher.sh | 16 ++++ .sandstorm/sandstorm-pkgdef.capnp | 66 +++++++++++++++ .sandstorm/setup.sh | 47 +++++++++++ .sandstorm/stack | 1 + client/lib/avatar.coffee | 3 +- client/views/account/avatar/prompt.html | 3 +- client/views/app/sideNav/userStatus.html | 3 + client/views/main.html | 12 ++- client/views/username/sandstormshare.html | 7 ++ packages/rocketchat-hubot/hubot.coffee | 4 +- .../settings/server/updateServices.coffee | 1 + .../client/oembedImageWidget.coffee | 3 +- server/configuration/accounts_meld.coffee | 3 +- server/lib/accounts.coffee | 12 +-- server/startup/avatar.coffee | 12 ++- server/startup/initialData.coffee | 1 + 29 files changed, 346 insertions(+), 23 deletions(-) create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/action_provision create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/action_set_name create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/creator_uid create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/id create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/index_uuid create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/private_key create mode 100644 .sandstorm/.vagrant/machines/default/virtualbox/synced_folders create mode 100644 .sandstorm/Vagrantfile create mode 100755 .sandstorm/build.sh create mode 100755 .sandstorm/global-setup.sh create mode 100755 .sandstorm/launcher.sh create mode 100644 .sandstorm/sandstorm-pkgdef.capnp create mode 100755 .sandstorm/setup.sh create mode 100644 .sandstorm/stack create mode 100644 client/views/username/sandstormshare.html diff --git a/.meteor/packages b/.meteor/packages index a23bfb4c45a2..f6ee307e1edf 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -34,10 +34,10 @@ rocketchat:markdown rocketchat:me #rocketchat:slashcommands-invite rocketchat:mentions -rocketchat:oembed -rocketchat:webrtc -#rocketchat:external #rocketchat:hubot +#rocketchat:oembed +rocketchat:webrtc-ib +#rocketchat:external #rocketchat:irc konecty:change-case @@ -82,3 +82,5 @@ monbro:mongodb-mapreduce-aggregation rocketchat:custom-oauth rocketchat:gitlab rocketchat:statistics +kenton:accounts-sandstorm + diff --git a/.meteor/platforms b/.meteor/platforms index 2d49a8563321..8a3a35f9f627 100644 --- a/.meteor/platforms +++ b/.meteor/platforms @@ -1,4 +1,2 @@ -android browser -ios server diff --git a/.meteor/versions b/.meteor/versions index 6d51817b8643..f0c9af8cfc76 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -46,6 +46,7 @@ jquery@1.11.3_2 json@1.0.3 kadira:blaze-layout@2.0.1 kadira:flow-router@2.4.0 +kenton:accounts-sandstorm@0.1.4 kevohagan:sweetalert@1.0.0 konecty:autolinker@1.0.2 konecty:change-case@2.3.0 @@ -114,9 +115,8 @@ rocketchat:logger@0.0.1 rocketchat:markdown@0.0.1 rocketchat:me@0.0.1 rocketchat:mentions@0.0.1 -rocketchat:oembed@0.0.1 rocketchat:statistics@0.0.1 -rocketchat:webrtc@0.0.1 +rocketchat:webrtc-ib@0.0.1 routepolicy@1.0.5 service-configuration@1.0.4 session@1.1.0 diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/action_provision b/.sandstorm/.vagrant/machines/default/virtualbox/action_provision new file mode 100644 index 000000000000..4f8991f5fe2d --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/action_provision @@ -0,0 +1 @@ +1.5:c17761bf-b2f4-49da-87b9-79a95da91252 \ No newline at end of file diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/action_set_name b/.sandstorm/.vagrant/machines/default/virtualbox/action_set_name new file mode 100644 index 000000000000..9a8930725a3b --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/action_set_name @@ -0,0 +1 @@ +1440583526 \ No newline at end of file diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/creator_uid b/.sandstorm/.vagrant/machines/default/virtualbox/creator_uid new file mode 100644 index 000000000000..e37d32abba42 --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/creator_uid @@ -0,0 +1 @@ +1000 \ No newline at end of file diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/id b/.sandstorm/.vagrant/machines/default/virtualbox/id new file mode 100644 index 000000000000..eb9637c6cf22 --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/id @@ -0,0 +1 @@ +c17761bf-b2f4-49da-87b9-79a95da91252 \ No newline at end of file diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/index_uuid b/.sandstorm/.vagrant/machines/default/virtualbox/index_uuid new file mode 100644 index 000000000000..fb8410bdfa9c --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/index_uuid @@ -0,0 +1 @@ +0d8eab53d7a1444288ff01aef6a03573 \ No newline at end of file diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/private_key b/.sandstorm/.vagrant/machines/default/virtualbox/private_key new file mode 100644 index 000000000000..d30d91db6e7e --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/private_key @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAk1hkJc1e5h4yDnnOCJ29YUf0x1DhgSkGY0hcfWAubSEGS1HX +bxLIE+Al44jENNPrrdddtCKY+onxeefQo7FUFxVMEOM5JqFzpyq1Sliw9w7QmJef +DImS0z54ezqQ952W7BQc/XOndVpzvRPVREcRccOdGk5P60zoWZP/Oy4tviHcH7RM +faeBrs7ykD6RJKAjKwuMF3p/+FlPCPwql8cTifYZspFwFTja/XStk3PX4eLle5si +ZFN7SjsDa+FflUenmgkpW04E6TUaQHVhapHJCCbYRqwCrUX/5Yf2PakFPqfnRBaE +KKkGLRnVc7UrCDk21m/IZRmTHgSLAyDEGkFOIwIDAQABAoIBAHCJBAQzNJXA3i5c +LVY7U5bnJDbOuUyyjqRpcep3+T10CaChI088Iv+7JHUB0gkfClO9t12LRxejH4Eh +4iIDn9v5ch07zjyI9xHn9oqP7qji8cJ5mwoyUKdygQZtFqdn/wrT2chh+rYQnXD9 +otcBCHvBEU40HanzFUrFVBxZCqq5fP69ujsOVghykyzI5mWIRNGFXyvN8HxjXMr6 +mSiCvzEMscTZzdoCvy18lvDTWg5GyPLq9EM+4xQoEqlQv2RQEUmC2wC4JK09bJ8T +d19RGax1Nvbvw0ywWTgG/blGS0h7Q4aJziIL1Bv1IoIonn69wjL/qaWh+vqhL6QV +m87qh7ECgYEAwzy0kwO5Xo1mWZN4lJ8WrU7xh5TtsSJkfMlEQNsmhHAFN9B7p7MX +CrIAMd+U9z8ptxgFZwfoff4Qcb9QkHo8wZLj9vYWTAoJ0VyvVwUTwi4D5lHvFDe/ +IX2N4pJv5AB3+xValyg+z6ShGKmWJuLhCYtcYFxdr8tZ45RlHYzv0V0CgYEAwTP1 +F3dURItjPVQ7BSHXmPoSTSuhAjbQp+jWOIEa+wnM3K3OncfbICFqSwFsz1cjKDjz +fAMXw9is7s/T8CEm6u4DFKbZ2qlAcvq02oqZu1/6UZXxTXFdjfQaKpSQ4ZWMxVBE +nKIs/e/416zCH6zd1Xauus92xI+zse5iSn++JX8CgYBGu/ewS+kdGJ28VnGZZwoQ +QEnBlXOIea1uiHzyAnQyB2PclOw4FeqDNXpcl2ShL4EtlMZgTb0t6J6Ml4PY1HCu +sUlmcEIjyn9EGxBrtqsx7vn6uDSmXowg1hxRujxPntvZXCM2IJ6hHERBay+7Zveh +PZx6TPykdEhc66a2zhkVAQKBgAOwHTaUdYxVaNCL4hCIA9iMtXq5oXosV7FM1YIA +nOY72qg/vRjv7rPfT2sdHNmcXTRwWd19JZ/8a9inKPGFgHutjWuAf9oXrv5C4N7n +FGYqP9n81b1Xs6R5C2LSsS1NMIG3tYeT5O33/bUIPDBkmVtwx4cTXL4FzDVSSpgH +dja7AoGAMAXuTIrq1+L6sMQYgwx/9loN4KkdYAP7ZDlX+2uROzk2u/aCw9dGIJMs +R5JSS5+5oG2MRNTAnz/35qge5M9ucRdiNKdxO4jLK9e009m+wl4AxVFFRz0Bz8Nf +QYlzA2d5S3I1EJSUNjjDkEq9szaVeRmVKt40n3X/JKjTggX6Ibg= +-----END RSA PRIVATE KEY----- diff --git a/.sandstorm/.vagrant/machines/default/virtualbox/synced_folders b/.sandstorm/.vagrant/machines/default/virtualbox/synced_folders new file mode 100644 index 000000000000..a01b299f5db4 --- /dev/null +++ b/.sandstorm/.vagrant/machines/default/virtualbox/synced_folders @@ -0,0 +1 @@ +{"virtualbox":{"/opt/app":{"guestpath":"/opt/app","hostpath":"/home/sam/projects/Rocket.Chat/Rocket.Chat","disabled":false},"/host-dot-sandstorm":{"guestpath":"/host-dot-sandstorm","hostpath":"/home/sam/.sandstorm","disabled":false},"/vagrant":{"guestpath":"/vagrant","hostpath":"/home/sam/projects/Rocket.Chat/Rocket.Chat","disabled":false}}} \ No newline at end of file diff --git a/.sandstorm/Vagrantfile b/.sandstorm/Vagrantfile new file mode 100644 index 000000000000..c8421bb98619 --- /dev/null +++ b/.sandstorm/Vagrantfile @@ -0,0 +1,83 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # We base ourselves off Debian Jessie + config.vm.box = "debian/jessie64" + + if Vagrant.has_plugin?("vagrant-vbguest") then + # vagrant-vbguest is a Vagrant plugin that upgrades + # the version of VirtualBox Guest Additions within each + # guest. If you have the vagrant-vbguest plugin, then it + # needs to know how to compile kernel modules, etc., and so + # we give it this hint about operating system type. + config.vm.guest = "debian" + end + + # We forward port 6080, the Sandstorm web port, so that developers can + # visit their sandstorm app from their browser as local.sandstorm.io:6080 + # (aka 127.0.0.1:6080). + config.vm.network :forwarded_port, guest: 6080, host: 6080 + + # Use a shell script to "provision" the box. This installs Sandstorm using + # the bundled installer. + config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/global-setup.sh" + # Then, do stack-specific and app-specific setup. + config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/setup.sh" + + # Shared folders are configured per-provider since vboxsf can't handle >4096 open files, + # NFS requires privilege escalation every time you bring a VM up, + # and 9p is only available on libvirt. + + # Calculate the number of CPUs and the amount of RAM the system has, + # in a platform-dependent way; further logic below. + cpus = nil + total_kB_ram = nil + + host = RbConfig::CONFIG['host_os'] + if host =~ /darwin/ + cpus = `sysctl -n hw.ncpu`.to_i + total_kB_ram = `sysctl -n hw.memsize`.to_i / 1024 + elsif host =~ /linux/ + cpus = `nproc`.to_i + total_kB_ram = `grep MemTotal /proc/meminfo | awk '{print $2}'`.to_i + end + # Use the same number of CPUs within Vagrant as the system, with 1 + # as a default. + # + # Use at least 512MB of RAM, and if the system has more than 2GB of + # RAM, use 1/4 of the system RAM. This seems a reasonable compromise + # between having the Vagrant guest operating system not run out of + # RAM entirely (which it basically would if we went much lower than + # 512MB) and also allowing it to use up a healthily large amount of + # RAM so it can run faster on systems that can afford it. + if cpus.nil? + cpus = 1 + end + if total_kB_ram.nil? or total_kB_ram < 2048000 + assign_ram_mb = 512 + else + assign_ram_mb = (total_kB_ram / 1024 / 4) + end + # Actually apply these CPU/memory values to the providers. + config.vm.provider :virtualbox do |vb, override| + vb.cpus = cpus + vb.memory = assign_ram_mb + + override.vm.synced_folder "..", "/opt/app" + override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm" + override.vm.synced_folder "..", "/vagrant" + end + config.vm.provider :libvirt do |libvirt, override| + libvirt.cpus = cpus + libvirt.memory = assign_ram_mb + libvirt.random_hostname = true + + override.vm.synced_folder "..", "/opt/app", type: "9p", accessmode: "passthrough" + override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm", type: "9p", accessmode: "passthrough" + override.vm.synced_folder "..", "/vagrant", type: "9p", accessmode: "passthrough" + end +end diff --git a/.sandstorm/build.sh b/.sandstorm/build.sh new file mode 100755 index 000000000000..50a730f64f8a --- /dev/null +++ b/.sandstorm/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -euo pipefail + +# Make meteor bundle + +METEOR_WAREHOUSE_DIR="${METEOR_WAREHOUSE_DIR:-$HOME/.meteor}" +METEOR_DEV_BUNDLE=$(dirname $(readlink -f "$METEOR_WAREHOUSE_DIR/meteor"))/dev_bundle + +cd /opt/app +meteor build --directory /home/vagrant/ +(cd /home/vagrant/bundle/programs/server && "$METEOR_DEV_BUNDLE/bin/npm" install) + +# Copy our launcher script into the bundle so the grain can start up. +mkdir -p /home/vagrant/bundle/opt/app/.sandstorm/ +cp /opt/app/.sandstorm/launcher.sh /home/vagrant/bundle/opt/app/.sandstorm/ diff --git a/.sandstorm/global-setup.sh b/.sandstorm/global-setup.sh new file mode 100755 index 000000000000..303c9d22c1d5 --- /dev/null +++ b/.sandstorm/global-setup.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -euo pipefail +echo localhost > /etc/hostname +hostname localhost +curl https://install.sandstorm.io/ > /host-dot-sandstorm/caches/install.sh +SANDSTORM_CURRENT_VERSION=$(curl -fs "https://install.sandstorm.io/dev?from=0&type=install") +SANDSTORM_PACKAGE="sandstorm-$SANDSTORM_CURRENT_VERSION.tar.xz" +if [[ ! -f /host-dot-sandstorm/caches/$SANDSTORM_PACKAGE ]] ; then + curl --output "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" "https://dl.sandstorm.io/$SANDSTORM_PACKAGE" +fi +bash /host-dot-sandstorm/caches/install.sh -d -e "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" +modprobe ip_tables +# Make the vagrant user part of the sandstorm group so that commands like +# `spk dev` work. +usermod -a -G 'sandstorm' 'vagrant' +# Bind to all addresses, so the vagrant port-forward works. +sudo sed --in-place='' \ + --expression='s/^BIND_IP=.*/BIND_IP=0.0.0.0/' \ + /opt/sandstorm/sandstorm.conf +# TODO: update sandstorm installer script to ask about dev accounts, and +# specify a value for this option in the default config? +if ! grep --quiet --no-messages ALLOW_DEV_ACCOUNTS=true /opt/sandstorm/sandstorm.conf ; then + echo "ALLOW_DEV_ACCOUNTS=true" | sudo tee -a /opt/sandstorm/sandstorm.conf + sudo service sandstorm restart +fi +# Enable apt-cacher-ng proxy to make things faster if one appears to be running on the gateway IP +GATEWAY_IP=$(ip route | grep ^default | cut -d ' ' -f 3) +if nc -z "$GATEWAY_IP" 3142 ; then + echo "Acquire::http::Proxy \"http://$GATEWAY_IP:3142\";" > /etc/apt/apt.conf.d/80httpproxy +fi diff --git a/.sandstorm/launcher.sh b/.sandstorm/launcher.sh new file mode 100755 index 000000000000..4a7ab020aaae --- /dev/null +++ b/.sandstorm/launcher.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +echo '** Starting mongo...' +/bin/niscud \ + --fork --port 4002 --dbpath /var --noauth --bind_ip 127.0.0.1 \ + --nohttpinterface --noprealloc --logpath /var/mongo.log & + +# TODO: wait for niscu to be up +echo '** Starting Meteor...' + +export MONGO_URL="mongodb://127.0.0.1:4002/meteor"; +export ROOT_URL="http://127.0.0.1:8000"; +export PORT="8000"; + +node /main.js diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp new file mode 100644 index 000000000000..0921cfcd7d50 --- /dev/null +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -0,0 +1,66 @@ +@0xdb0b8a1059adf258; + +using Spk = import "/sandstorm/package.capnp"; +# This imports: +# $SANDSTORM_HOME/latest/usr/include/sandstorm/package.capnp +# Check out that file to see the full, documented package definition format. + +const pkgdef :Spk.PackageDefinition = ( + # The package definition. Note that the spk tool looks specifically for the + # "pkgdef" constant. + + id = "1yqjjc9yru8e577pm95peu7t32ccf1xf0mepkvxj9ezch9amj82h", + # Your app ID is actually its public key. The private key was placed in + # your keyring. All updates must be signed with the same key. + + manifest = ( + # This manifest is included in your app package to tell Sandstorm + # about your app. + + appTitle = (defaultText = "Rocket.Chat"), + + appVersion = 0, # Increment this for every release. + + appMarketingVersion = (defaultText = "0.6"), + # Human-readable representation of appVersion. Should match the way you + # identify versions of your app in documentation and marketing. + + actions = [ + # Define your "new document" handlers here. + ( title = (defaultText = "New Rocket.Chat"), + command = .myCommand + # The command to run when starting for the first time. (".myCommand" + # is just a constant defined at the bottom of the file.) + ) + ], + + continueCommand = .myCommand + # This is the command called to start your app back up after it has been + # shut down for inactivity. Here we're using the same command as for + # starting a new instance, but you could use different commands for each + # case. + ), + + sourceMap = ( + # The following directories will be copied into your package. + searchPath = [ + ( sourcePath = "/home/vagrant/bundle" ), + ( sourcePath = "/opt/meteor-spk/meteor-spk.deps" ) + ] + ), + + alwaysInclude = [ "." ] + # This says that we always want to include all files from the source map. + # (An alternative is to automatically detect dependencies by watching what + # the app opens while running in dev mode. To see what that looks like, + # run `spk init` without the -A option.) +); + +const myCommand :Spk.Manifest.Command = ( + # Here we define the command used to start up your server. + argv = ["/sandstorm-http-bridge", "8000", "--", "/opt/app/.sandstorm/launcher.sh"], + environ = [ + # Note that this defines the *entire* environment seen by your app. + (key = "PATH", value = "/usr/local/bin:/usr/bin:/bin") + ] +); diff --git a/.sandstorm/setup.sh b/.sandstorm/setup.sh new file mode 100755 index 000000000000..7f2b3609ddb8 --- /dev/null +++ b/.sandstorm/setup.sh @@ -0,0 +1,47 @@ +#!/bin/bash +set -euo pipefail + +cd /opt/ + +PACKAGE=meteor-spk-0.1.4 +PACKAGE_FILENAME="$PACKAGE.tar.xz" +CACHE_TARGET="/host-dot-sandstorm/caches/${PACKAGE_FILENAME}" + +# Fetch meteor-spk tarball if not cached +if [ ! -f "$CACHE_TARGET" ] ; then + curl https://dl.sandstorm.io/${PACKAGE_FILENAME} > "$CACHE_TARGET" +fi + +# Extract to /opt +tar xf "$CACHE_TARGET" + +# Create symlink so we can rely on the path /opt/meteor-spk +ln -s "${PACKAGE}" meteor-spk + +# Add bash, and its dependencies, so they get mapped into the image. +# Bash runs the launcher script. +cp -a /bin/bash /opt/meteor-spk/meteor-spk.deps/bin/ +cp -a /lib/x86_64-linux-gnu/libncurses.so.* /opt/meteor-spk/meteor-spk.deps/lib/x86_64-linux-gnu/ +cp -a /lib/x86_64-linux-gnu/libtinfo.so.* /opt/meteor-spk/meteor-spk.deps/lib/x86_64-linux-gnu/ + +# Unfortunately, Meteor does not explicitly make it easy to cache packages, but +# we know experimentally that the package is mostly directly extractable to a +# user's $HOME/.meteor directory. +METEOR_RELEASE=1.1.0.2 +METEOR_PLATFORM=os.linux.x86_64 +METEOR_TARBALL_FILENAME="meteor-bootstrap-${METEOR_PLATFORM}.tar.gz" +METEOR_TARBALL_URL="https://d3sqy0vbqsdhku.cloudfront.net/packages-bootstrap/${METEOR_RELEASE}/${METEOR_TARBALL_FILENAME}" +METEOR_CACHE_TARGET="/host-dot-sandstorm/caches/${METEOR_TARBALL_FILENAME}" + +# Fetch meteor tarball if not cached +if [ ! -f "$METEOR_CACHE_TARGET" ] ; then + curl "$METEOR_TARBALL_URL" > "${METEOR_CACHE_TARGET}.partial" + mv "${METEOR_CACHE_TARGET}"{.partial,} +fi + +# Extract as unprivileged user, which is the usual meteor setup +cd /home/vagrant/ +su -c "tar xf '${METEOR_CACHE_TARGET}'" vagrant +# Link into global PATH +ln -s /home/vagrant/.meteor/meteor /usr/bin/meteor + diff --git a/.sandstorm/stack b/.sandstorm/stack new file mode 100644 index 000000000000..f148e1141a45 --- /dev/null +++ b/.sandstorm/stack @@ -0,0 +1 @@ +meteor diff --git a/client/lib/avatar.coffee b/client/lib/avatar.coffee index 8864fa52beb7..e16a8559e198 100644 --- a/client/lib/avatar.coffee +++ b/client/lib/avatar.coffee @@ -4,7 +4,8 @@ if not username? return - return "#{Meteor.absoluteUrl()}avatar/#{username}.jpg?_dc=#{random}" + # return "#{Meteor.absoluteUrl()}avatar/#{username}.jpg?_dc=#{random}" + return "/avatar/#{username}.jpg?_dc=#{random}" Blaze.registerHelper 'avatarUrlFromUsername', getAvatarUrlFromUsername diff --git a/client/views/account/avatar/prompt.html b/client/views/account/avatar/prompt.html index e41996ffb023..f219f53c28b1 100644 --- a/client/views/account/avatar/prompt.html +++ b/client/views/account/avatar/prompt.html @@ -58,7 +58,7 @@

{{/unless}} - + diff --git a/client/views/app/sideNav/userStatus.html b/client/views/app/sideNav/userStatus.html index 97e782c1e445..b0ea4b3488c4 100644 --- a/client/views/app/sideNav/userStatus.html +++ b/client/views/app/sideNav/userStatus.html @@ -18,10 +18,13 @@

{{username}}

{{_ "Busy" context="male"}} {{_ "Invisible"}} {{_ "My_Account"}} + {{/with}} diff --git a/client/views/main.html b/client/views/main.html index 02ebe6cce1cd..4dd6fd5622a0 100644 --- a/client/views/main.html +++ b/client/views/main.html @@ -44,11 +44,18 @@ diff --git a/client/views/username/sandstormshare.html b/client/views/username/sandstormshare.html new file mode 100644 index 000000000000..090a89d8a458 --- /dev/null +++ b/client/views/username/sandstormshare.html @@ -0,0 +1,7 @@ + diff --git a/packages/rocketchat-hubot/hubot.coffee b/packages/rocketchat-hubot/hubot.coffee index fa2ee105b7df..35d2cbb94d96 100644 --- a/packages/rocketchat-hubot/hubot.coffee +++ b/packages/rocketchat-hubot/hubot.coffee @@ -55,8 +55,8 @@ class RocketChatAdapter extends Hubot.Adapter console.log 'ROCKETCHATADAPTER -> send'.blue # console.log envelope, strings sendHelper @robot, envelope, strings, (string) => - console.log "send #{envelope.room}: #{string} (#{envelope.user.id})" if DEBUG - RocketChat.sendMessage RocketBot.user, { msg: string }, { _id: envelope.room } + # console.log "send #{envelope.room}: #{string} (#{envelope.user.id})" if DEBUG + RocketChat.sendMessage RocketBot.user, { msg: string }, { _id: envelope.room } # Public: Raw method for sending emote data back to the chat source. # diff --git a/packages/rocketchat-lib/settings/server/updateServices.coffee b/packages/rocketchat-lib/settings/server/updateServices.coffee index 42c0098b7aa5..6d8af700197c 100644 --- a/packages/rocketchat-lib/settings/server/updateServices.coffee +++ b/packages/rocketchat-lib/settings/server/updateServices.coffee @@ -10,6 +10,7 @@ updateServices = -> serviceName = service._id.replace('Accounts_OAuth_', '') + if serviceName is 'Meteor' serviceName = 'meteor-developer' diff --git a/packages/rocketchat-oembed/client/oembedImageWidget.coffee b/packages/rocketchat-oembed/client/oembedImageWidget.coffee index 4a4089af0fbd..f801b22c6fec 100644 --- a/packages/rocketchat-oembed/client/oembedImageWidget.coffee +++ b/packages/rocketchat-oembed/client/oembedImageWidget.coffee @@ -1,3 +1,4 @@ Template.oembedImageWidget.helpers showImage: -> - return @downloadImages is true or not Meteor.Device.isPhone() \ No newline at end of file + return true + # @downloadImages is true or not Meteor.Device.isPhone() \ No newline at end of file diff --git a/server/configuration/accounts_meld.coffee b/server/configuration/accounts_meld.coffee index 11c5206caf46..e6e4a89fe005 100644 --- a/server/configuration/accounts_meld.coffee +++ b/server/configuration/accounts_meld.coffee @@ -1,6 +1,7 @@ orig_updateOrCreateUserFromExternalService = Accounts.updateOrCreateUserFromExternalService Accounts.updateOrCreateUserFromExternalService = (serviceName, serviceData, options) -> - if serviceName not in ['facebook', 'github', 'google', 'meteor-developer', 'linkedin', 'twitter'] and serviceData._oAuthCustom isnt true + + if serviceName not in ['facebook', 'github', 'gitlab', 'google', 'meteor-developer', 'linkedin', 'twitter', 'sandstorm'] and serviceData._oAuthCustom isnt true return if serviceName is 'meteor-developer' diff --git a/server/lib/accounts.coffee b/server/lib/accounts.coffee index 5c565cb516c7..e5fe2398cec7 100644 --- a/server/lib/accounts.coffee +++ b/server/lib/accounts.coffee @@ -15,16 +15,18 @@ Accounts.emailTemplates.resetPassword.text = (user, url) -> verifyEmailText user, url Accounts.onCreateUser (options, user) -> - # console.log 'onCreateUser ->',JSON.stringify arguments, null, ' ' - # console.log 'options ->',JSON.stringify options, null, ' ' - # console.log 'user ->',JSON.stringify user, null, ' ' + console.log 'onCreateUser ->',JSON.stringify arguments, null, ' ' + console.log 'options ->',JSON.stringify options, null, ' ' + console.log 'user ->',JSON.stringify user, null, ' ' user.status = 'offline' user.active = not RocketChat.settings.get 'Accounts_ManuallyApproveNewUsers' + # disable admin for sandstorm # when inserting first user, set admin: true - unless Meteor.users.findOne() - user.admin = true + # unless Meteor.users.findOne() + # user.admin = true + if not user?.name? or user.name is '' if options.profile?.name? diff --git a/server/startup/avatar.coffee b/server/startup/avatar.coffee index 770f371e92c5..2a03c5be8a19 100644 --- a/server/startup/avatar.coffee +++ b/server/startup/avatar.coffee @@ -1,8 +1,11 @@ Meteor.startup -> - storeType = 'GridFS' + storeType = 'FileSystem' + + + # Sandstorm must store avatar in mongo + #if RocketChat.settings.get 'avatarStore_type' + # storeType = RocketChat.settings.get 'avatarStore_type' - if RocketChat.settings.get 'Accounts_AvatarStoreType' - storeType = RocketChat.settings.get 'Accounts_AvatarStoreType' RocketChatStore = RocketChatFile[storeType] @@ -18,7 +21,7 @@ Meteor.startup -> transformWrite = (file, readStream, writeStream) -> RocketChatFile.gm(readStream, file.fileName).background('#ffffff').resize(width, height+'^>').gravity('Center').extent(width, height).stream('jpeg').pipe(writeStream) - path = "~/uploads" + path = "/var" if RocketChat.settings.get('Accounts_AvatarStorePath')?.trim() isnt '' path = RocketChat.settings.get 'Accounts_AvatarStorePath' @@ -29,6 +32,7 @@ Meteor.startup -> transformWrite: transformWrite WebApp.connectHandlers.use '/avatar/', (req, res, next) -> + console.log 'avatar called!' this.params = username: req.url.replace(/^\//, '').replace(/\?.*$/, '') diff --git a/server/startup/initialData.coffee b/server/startup/initialData.coffee index 9af24b91b5b8..d82f4eb7763e 100644 --- a/server/startup/initialData.coffee +++ b/server/startup/initialData.coffee @@ -16,6 +16,7 @@ Meteor.startup -> name: 'general' msgs: 0 + 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