diff --git a/Dockerfile b/Dockerfile index 9857176fc09..f7687b5fed4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,8 +30,6 @@ RUN apk update \ FROM base as prod -RUN addgroup -S -g 1000 greenlight && adduser -S -G greenlight -u 999 greenlight - ARG PACKAGES='libpq-dev tzdata imagemagick yarn bash' COPY --from=build $RAILS_ROOT/vendor/bundle ./vendor/bundle COPY package.json yarn.lock ./ @@ -44,8 +42,5 @@ RUN apk update \ && apk upgrade \ && update-ca-certificates -RUN chown -R greenlight /usr/src/app/tmp - -USER 999 EXPOSE ${PORT} ENTRYPOINT [ "./bin/start" ] diff --git a/Gemfile b/Gemfile index 8d6dc760912..338447edbb8 100644 --- a/Gemfile +++ b/Gemfile @@ -13,7 +13,7 @@ gem 'bigbluebutton-api-ruby', '1.9.1' gem 'bootsnap', require: false gem 'clamby', '~> 1.6.10' gem 'cssbundling-rails', '>= 1.3.3' -gem 'data_migrate', '>= 9.2.0' +gem 'data_migrate', '>= 9.3.0' gem 'dotenv-rails' gem 'google-cloud-storage', '~> 1.44', require: false gem 'hcaptcha' diff --git a/Gemfile.lock b/Gemfile.lock index 3b3f1a5e414..83431157a1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -117,7 +117,7 @@ GEM rubyzip (>= 1.3.0) xml-simple (~> 1.1) bigdecimal (3.1.6) - bindata (2.4.15) + bindata (2.5.0) bindex (0.8.1) bootsnap (1.16.0) msgpack (~> 1.2) @@ -142,7 +142,7 @@ GEM crass (1.0.6) cssbundling-rails (1.3.3) railties (>= 6.0.0) - data_migrate (9.2.0) + data_migrate (9.3.0) activerecord (>= 6.1) railties (>= 6.1) date (3.3.4) @@ -157,8 +157,7 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - drb (2.2.0) - ruby2_keywords + drb (2.2.1) erubi (1.12.0) factory_bot (6.4.5) activesupport (>= 5.0.0) @@ -167,12 +166,12 @@ GEM railties (>= 5.0.0) faker (3.1.1) i18n (>= 1.8.11, < 2) - faraday (2.7.10) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) - faraday-net_http (3.0.2) + faraday-net_http (3.1.0) + net-http ffi (1.15.5) globalid (1.2.1) activesupport (>= 6.1) @@ -233,9 +232,10 @@ GEM jsbundling-rails (1.2.2) railties (>= 6.0.0) json (2.6.3) - json-jwt (1.16.3) + json-jwt (1.16.6) activesupport (>= 4.2) aes_key_wrap + base64 bindata faraday (~> 2.0) faraday-follow_redirects @@ -265,6 +265,8 @@ GEM msgpack (1.6.0) multi_json (1.15.0) mutex_m (0.2.0) + net-http (0.4.1) + uri net-imap (0.4.10) date net-protocol @@ -432,7 +434,6 @@ GEM ruby-progressbar (1.13.0) ruby-vips (2.1.4) ffi (~> 1.12) - ruby2_keywords (0.0.5) rubyzip (2.3.2) selenium-webdriver (4.8.0) rexml (~> 3.2, >= 3.2.5) @@ -466,6 +467,7 @@ GEM concurrent-ruby (~> 1.0) uber (0.1.0) unicode-display_width (2.4.2) + uri (0.13.0) validate_email (0.1.6) activemodel (>= 3.0) mail (>= 2.2.5) @@ -514,7 +516,7 @@ DEPENDENCIES capybara clamby (~> 1.6.10) cssbundling-rails (>= 1.3.3) - data_migrate (>= 9.2.0) + data_migrate (>= 9.3.0) debug dotenv-rails factory_bot (>= 6.4.1) diff --git a/app/assets/locales/el.json b/app/assets/locales/el.json index 089f347b427..4efe070c00b 100644 --- a/app/assets/locales/el.json +++ b/app/assets/locales/el.json @@ -278,7 +278,11 @@ "change_privacy_link": "Αλλαγή του συνδέσμου για το απόρρητο που εμφανίζεται στο κάτω μέρος της σελίδας", "helpcenter": "Κέντρο Βοήθειας", "change_helpcenter_link": "Αλλαγή του συνδέσμου για το Κέντρο βοήθειας που εμφανίζεται κάτω από το προφίλ. ", + "maintenance": "Μήνυμα κατάστασης συντήρησης", + "change_maintenance_text": "Αλλάξτε το κείμενο του μηνύματος κατάστασης συντήρησης που εμφανίζεται στην κεφαλίδα", "change_url": "Αλλαγή URL", + "set_text": "Ορισμός κειμένου", + "clear_banner": "Διαγραφή μηνύματος", "enter_link": "Εισαγάγετε εδώ το σύνδεσμο" }, "settings": { @@ -288,7 +292,11 @@ "allow_users_to_preupload_presentation": "Να επιτρέπεται στους χρήστες να μεταφορτώνουν παρουσιάσεις νωρίτερα", "allow_users_to_preupload_presentation_description": "Οι χρήστες μπορούν να μεταφορτώνουν νωρίτερα μια παρουσίαση για χρήση όπως την προεπιλεγμένη για συγκεκριμένη αίθουσα διασκέψεων", "default_visibility": "Προεπιλεγμένη ορατότητα καταγραφής", - "default_visibility_description": "Όλες οι καταγραφές που δημιουργήθηκαν πρόσφατα θα έχουν αυτήν την ορατότητα από προεπιλογή" + "default_visibility_description": "Όλες οι καταγραφές που δημιουργήθηκαν πρόσφατα θα έχουν αυτήν την ορατότητα από προεπιλογή", + "session_timeout": "Λήξη συνεδρίας", + "session_timeout_description": "Μπορείτε να ρυθμίσετε το χρονικό όριο της συνεδρίας με ένα προεπιλεγμένο cookie διάρκειας 1 ημέρας ή με ένα επεκτεινόμενης συνεδρίας 7 ημερών.", + "default_session_timeout": "Προεπιλογή (1 ημέρα)", + "extended_session_timeout": "Επέκταση (7 ημέρες)" }, "registration": { "registration": "Εγγραφή", @@ -676,7 +684,8 @@ "site_settings": { "fields": { "value": { - "placeholder": "Εισαγάγετε εδώ το σύνδεσμο..." + "placeholder": "Εισαγάγετε εδώ το σύνδεσμο...", + "text_placeholder": "Εισαγάγετε εδώ το κείμενο..." } } }, diff --git a/app/assets/stylesheets/application.bootstrap.scss b/app/assets/stylesheets/application.bootstrap.scss index 57e48faba32..6c949d0ba6b 100644 --- a/app/assets/stylesheets/application.bootstrap.scss +++ b/app/assets/stylesheets/application.bootstrap.scss @@ -315,9 +315,17 @@ input.search-bar { border-color: var(--brand-color); color: white; + &:active { + background-color: var(--brand-color) !important; + border-color: var(--brand-color) !important; + color: white !important; + } + &:hover { - box-shadow: inset 0 0 200px 200px rgba(0, 0, 0, 0.1); + background-color: var(--brand-color); + border-color: var(--brand-color); color: white; + box-shadow: inset 0 0 200px 200px rgba(0, 0, 0, 0.1); } &:focus { @@ -331,8 +339,15 @@ input.search-bar { background-color: white; box-shadow: var(--brand-color-light); + &:active { + border-color: var(--brand-color) !important; + background-color: white !important; + color: var(--brand-color) !important; + } + &:hover { border-color: var(--brand-color); + background-color: white; color: var(--brand-color); } diff --git a/app/controllers/api/v1/migrations/external_controller.rb b/app/controllers/api/v1/migrations/external_controller.rb index d15956d37ad..39ab29703d9 100644 --- a/app/controllers/api/v1/migrations/external_controller.rb +++ b/app/controllers/api/v1/migrations/external_controller.rb @@ -125,13 +125,15 @@ def create_room return render_error(status: :bad_request, errors: 'Provider does not exist') end - return render_data status: :created if Room.exists? friendly_id: room_hash[:friendly_id] - user = User.find_by(email: room_hash[:owner_email], provider: room_hash[:provider]) return render_error(status: :bad_request, errors: 'The room owner does not exist.') unless user - room = Room.new(room_hash.except(:owner_email, :provider, :room_settings, :shared_users_emails).merge({ user: })) + room = if Room.exists?(friendly_id: room_hash[:friendly_id]) + Room.find_by(friendly_id: room_hash[:friendly_id]) + else + Room.new(room_hash.except(:owner_email, :provider, :room_settings, :shared_users_emails, :presentation).merge({ user: })) + end # Redefines the validations method to do nothing # rubocop:disable Lint/EmptyBlock @@ -139,6 +141,12 @@ def create_room room.define_singleton_method(:set_meeting_id) {} # rubocop:enable Lint/EmptyBlock + if room_hash[:presentation] + attachment_blob_io = StringIO.new(Base64.decode64(room_hash[:presentation][:blob])) + attachment = ActiveStorage::Blob.create_and_upload!(io: attachment_blob_io, filename: room_hash[:presentation][:filename]) + room.presentation.attach(attachment) + end + return render_error(status: :bad_request, errors: room&.errors&.to_a) unless room.save if room_hash[:room_settings].any? @@ -146,13 +154,8 @@ def create_room room_meeting_options_joined = RoomMeetingOption.includes(:meeting_option) .where(room_id: room.id, 'meeting_options.name': room_hash[:room_settings].keys) - okay = true - room_meeting_options_joined.each do |room_meeting_option| - option_name = room_meeting_option.meeting_option.name - okay = false unless room_meeting_option.update(value: room_hash[:room_settings][option_name]) - end - - return render_error status: :bad_request, errors: 'Something went wrong when migrating the room settings.' unless okay + return render_error status: :bad_request, errors: 'Something went wrong when migrating the room settings.' unless + room_meeting_options_joined.collect { |o| o.update(value: room_hash[:room_settings][o.meeting_option.name]) }.all? end return render_data status: :created unless room_hash[:shared_users_emails].any? @@ -160,12 +163,8 @@ def create_room # Finds all the users that have a SharedAccess to the Room shared_with_users = User.where(email: room_hash[:shared_users_emails], provider: room_hash[:provider]) - okay = true - shared_with_users.each do |shared_with_user| - okay = false unless SharedAccess.new(room_id: room.id, user_id: shared_with_user.id).save - end - - return render_error status: :bad_request, errors: 'Something went wrong when sharing the room.' unless okay + return render_error status: :bad_request, errors: 'Something went wrong when sharing the room.' unless + shared_with_users.collect { |u| SharedAccess.new(room_id: room.id, user_id: u.id).save }.all? render_data status: :created end @@ -231,7 +230,8 @@ def room_params decrypted_params.require(:room).permit(:name, :friendly_id, :meeting_id, :last_session, :owner_email, :provider, shared_users_emails: [], room_settings: %w[record muteOnStart guestPolicy glAnyoneCanStart glAnyoneJoinAsModerator - glViewerAccessCode glModeratorAccessCode]) + glViewerAccessCode glModeratorAccessCode], + presentation: %w[blob filename]) end def settings_params diff --git a/app/services/setting_getter.rb b/app/services/setting_getter.rb index fda7f838d17..eb9a61afa18 100644 --- a/app/services/setting_getter.rb +++ b/app/services/setting_getter.rb @@ -52,11 +52,7 @@ def call private def transform_value(site_setting) - if site_setting.setting.name == 'BrandingImage' - return rails_blob_path site_setting.image, only_path: true if site_setting.image.attached? - - return ActionController::Base.helpers.image_path('bbb_logo.png') - end + return rails_blob_path site_setting.image, only_path: true if site_setting.setting.name == 'BrandingImage' && site_setting.image.attached? case site_setting.value when 'true' diff --git a/db/data/20220713143528_populate_site_settings.rb b/db/data/20220713143528_populate_site_settings.rb index 48b8cb4f768..951a2aabeff 100644 --- a/db/data/20220713143528_populate_site_settings.rb +++ b/db/data/20220713143528_populate_site_settings.rb @@ -18,12 +18,18 @@ class PopulateSiteSettings < ActiveRecord::Migration[7.0] def up + image_path = begin + ActionController::Base.helpers.image_path('bbb_logo.png') + rescue StandardError + 'https://github.com/bigbluebutton/greenlight/blob/master/app/assets/images/bbb_logo.png' + end + SiteSetting.create! [ { setting: Setting.find_by(name: 'PrimaryColor'), value: '#467fcf', provider: 'greenlight' }, { setting: Setting.find_by(name: 'PrimaryColorLight'), value: '#e8eff9', provider: 'greenlight' }, { setting: Setting.find_by(name: 'PrimaryColorDark'), value: '#316cbe', provider: 'greenlight' }, { setting: Setting.find_by(name: 'BrandingImage'), - value: ActionController::Base.helpers.image_path('bbb_logo.png'), + value: image_path, provider: 'greenlight' }, { setting: Setting.find_by(name: 'Terms'), value: '', provider: 'greenlight' }, { setting: Setting.find_by(name: 'PrivacyPolicy'), value: '', provider: 'greenlight' }, diff --git a/gl-install.sh b/gl-install.sh index cdf04942446..89e0a1f9972 100755 --- a/gl-install.sh +++ b/gl-install.sh @@ -96,14 +96,6 @@ main() { check_ubuntu_lts need_x64 - DOCKER_COMPOSE_CMD="docker-compose" - # Test if docker-compose command exists - if ! command -v $DOCKER_COMPOSE_CMD &> /dev/null - then - # Change the command to the build in docker compose command - DOCKER_COMPOSE_CMD="docker compose" - fi - while builtin getopts "s:e:b:hdk" opt "${@}"; do case $opt in @@ -466,9 +458,9 @@ install_greenlight_v3(){ # Adding Keycloak if [ -n "$INSTALL_KC" ]; then # When attepmting to install/update Keycloak let us attempt to create the database to resolve any issues caused by postgres false negatives. - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml up -d postgres && say "started postgres" - wait_postgres_start($DOCKER_COMPOSE_CMD) - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml exec -T postgres psql -U postgres -c 'CREATE DATABASE keycloakdb;' + docker-compose -f $GL3_DIR/docker-compose.yml up -d postgres && say "started postgres" + wait_postgres_start + docker-compose -f $GL3_DIR/docker-compose.yml exec -T postgres psql -U postgres -c 'CREATE DATABASE keycloakdb;' fi if ! grep -q 'keycloak:' $GL3_DIR/docker-compose.yml; then @@ -478,7 +470,7 @@ install_greenlight_v3(){ # Add Keycloak say "Adding Keycloak..." - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml down + docker-compose -f $GL3_DIR/docker-compose.yml down cp -v $GL3_DIR/docker-compose.yml $GL3_DIR/docker-compose.base.yml # Persist working base compose file for admins as a Backup. docker run --rm --entrypoint sh $GL_IMG_REPO -c 'cat docker-compose.kc.yml' >> $GL3_DIR/docker-compose.yml @@ -528,17 +520,17 @@ HERE # Eager pulling images. say "pulling latest greenlight-v3 services images..." - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml pull + docker-compose -f $GL3_DIR/docker-compose.yml pull if check_container_running greenlight-v3; then # Restarting Greenlight-v3 services after updates. say "greenlight-v3 is updating..." say "shutting down greenlight-v3..." - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml down + docker-compose -f $GL3_DIR/docker-compose.yml down fi say "starting greenlight-v3..." - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml up -d + docker-compose -f $GL3_DIR/docker-compose.yml up -d sleep 5 say "greenlight-v3 is now installed and accessible on: https://$HOST${GL_RELATIVE_URL_ROOT:-$GL_DEFAULT_PATH}" say "To create Greenlight administrator account, see: https://docs.bigbluebutton.org/greenlight/v3/install#creating-an-admin-account" @@ -560,10 +552,10 @@ HERE wait_postgres_start() { say "Waiting for the Postgres DB to start..." - $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml up -d postgres || err "failed to start Postgres service - retry to resolve" + docker-compose -f $GL3_DIR/docker-compose.yml up -d postgres || err "failed to start Postgres service - retry to resolve" local tries=0 - while ! $DOCKER_COMPOSE_CMD -f $GL3_DIR/docker-compose.yml exec -T postgres pg_isready 2> /dev/null 1>&2; do + while ! docker-compose -f $GL3_DIR/docker-compose.yml exec -T postgres pg_isready 2> /dev/null 1>&2; do echo -n . sleep 3 if (( ++tries == 3 )); then