From 7f0033a1c55a2a3cbd4acff8e5acfc8458e39662 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 20 Mar 2017 14:44:18 +0100 Subject: [PATCH 01/27] add the word 'click' to the server launch button --- app/assets/stylesheets/_venue.scss | 5 +++++ lib/vrng/src/vrng/venues/core.cljs | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index 45fed4977..6487caab6 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -1205,4 +1205,9 @@ svg#logo { margin-right: 2px; margin-top: -3px; } +} + +#circleButton:hover { + fill:darken($success-color,10%); + transition: darken .2s; } \ No newline at end of file diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index b2d335ac8..1ad4b86ec 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -829,15 +829,22 @@ [:text#buttonText1 {:fill "#fff" :text-anchor "middle" - :y "127" - :height "12" + :y "120" + :height "11" :x "50%"} - "launch"] + "click to"] [:text#buttonText2 {:fill "#fff" :text-anchor "middle" - :y "142" - :height "12" + :y "134" + :height "11" + :x "50%"} + "launch"] + [:text#buttonText3 + {:fill "#fff" + :text-anchor "middle" + :y "149" + :height "11" :x "50%"} "server"]]) From 6cab5a03d23b56dd96393f2c12cb1e8f73192b39 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 20 Mar 2017 15:21:00 +0100 Subject: [PATCH 02/27] add animation --- app/assets/stylesheets/_venue.scss | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index 6487caab6..fa5953de2 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -1096,7 +1096,7 @@ svg#logo { //messages #message-container { padding: 12px 6px; - background: #f8f8f8; + // background: #f8f8f8; min-height: 100vh; padding-bottom: 10px; @include breakpoint(medium) { @@ -1110,7 +1110,7 @@ svg#logo { } .message-losenge { - background: $vr-beige; + margin: 6px; @include box-shadow(3px, 0.3); border-radius: 4px; @@ -1120,6 +1120,7 @@ svg#logo { padding-bottom: 21px; max-width: 60%; position: relative; + animation: fadeLosenge 5s infinite; &.right { background: white; } @@ -1210,4 +1211,18 @@ svg#logo { #circleButton:hover { fill:darken($success-color,10%); transition: darken .2s; -} \ No newline at end of file +} + +@-webkit-keyframes fadeLosenge { + 0% { + background-color: $vr-yellow; + } + 75% { + background-color: #fff; + } + + 100% { + background-color: #fff; + } +} + From f0b5e1057180c3820bcc0b0008afed3f76a6cedd Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 20 Mar 2017 15:53:07 +0100 Subject: [PATCH 03/27] add autoprefixer and animation to stages message --- Gemfile | 1 + Gemfile.lock | 3 +++ app/assets/stylesheets/_venue.scss | 22 ++++++++++++++++------ lib/core_ext.rb | 3 +++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 5f1801d0e..e29be39a1 100644 --- a/Gemfile +++ b/Gemfile @@ -63,6 +63,7 @@ gem 'inifile', require: false gem 'trickery' gem 'closeio', require: false gem 'greensock-rails' +gem "autoprefixer-rails" group :development do diff --git a/Gemfile.lock b/Gemfile.lock index aaa6c1fcb..1297c0185 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -102,6 +102,8 @@ GEM arel (6.0.3) auphonic (0.1.0) faraday + autoprefixer-rails (6.7.7) + execjs babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) @@ -643,6 +645,7 @@ DEPENDENCIES airbrake (~> 5.0) angularjs-file-upload-rails (~> 1.1.0) annotator + autoprefixer-rails better_errors binding_of_caller browser diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index fa5953de2..ef6794bfb 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -1114,13 +1114,16 @@ svg#logo { margin: 6px; @include box-shadow(3px, 0.3); border-radius: 4px; - padding: 6px; + padding: 12px; font-size: .9rem; color: #333; padding-bottom: 21px; - max-width: 60%; + max-width: 80%; position: relative; - animation: fadeLosenge 5s infinite; + background-color: white; + animation: + fadeLosenge 5s, + bounce .5s; &.right { background: white; } @@ -1213,12 +1216,12 @@ svg#logo { transition: darken .2s; } -@-webkit-keyframes fadeLosenge { +@keyframes fadeLosenge { 0% { background-color: $vr-yellow; } - 75% { - background-color: #fff; + 60% { + background-color: $vr-yellow; } 100% { @@ -1226,3 +1229,10 @@ svg#logo { } } +@keyframes bounce { + 0% { transform: scale(.8); opacity: 0 } + 50% { transform: scale(1.2); opacity: .7; } + 60% { transform: scale(0.9); opacity: 1 } + 80% { transform: scale(1.1) } + 100% { transform: scale(1) } +} \ No newline at end of file diff --git a/lib/core_ext.rb b/lib/core_ext.rb index b94c691bc..243646b39 100644 --- a/lib/core_ext.rb +++ b/lib/core_ext.rb @@ -3,8 +3,11 @@ # fix the time class to provide a formatting option for ordinals class Time alias_method :original_strftime, :strftime + def strftime(fmt) original_strftime(fmt).gsub('%o', day.ordinal) + rescue + original_strftime(fmt) end end From 452da56f26c11ac97371a8750403da2fa60bee0d Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 20 Mar 2017 16:54:30 +0100 Subject: [PATCH 04/27] think about messages overflow scroll --- app/assets/stylesheets/_venue.scss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index ef6794bfb..350c94544 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -177,7 +177,8 @@ a.help-link { } .venues { - overflow: visible; + // overflow: hidden; + // max-height: 100vh; } //New stuff: @@ -1098,6 +1099,8 @@ svg#logo { padding: 12px 6px; // background: #f8f8f8; min-height: 100vh; + max-height: 100vh; + overflow-y: scroll; padding-bottom: 10px; @include breakpoint(medium) { padding-bottom: 60px; From 8f0cc40af7a64f3774e7ea2ecb7c065c1aa52872 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 20 Mar 2017 17:49:43 +0100 Subject: [PATCH 05/27] refactor stage buttons into buttons file --- app/assets/stylesheets/_buttons.scss | 19 +++++++++++++ app/assets/stylesheets/_settings.scss | 3 +- app/assets/stylesheets/_venue.scss | 38 +++++++++---------------- app/assets/stylesheets/application.scss | 2 +- lib/vrng/src/vrng/venues/core.cljs | 12 +++++--- 5 files changed, 44 insertions(+), 30 deletions(-) diff --git a/app/assets/stylesheets/_buttons.scss b/app/assets/stylesheets/_buttons.scss index a756e34bc..131eb9f36 100644 --- a/app/assets/stylesheets/_buttons.scss +++ b/app/assets/stylesheets/_buttons.scss @@ -139,4 +139,23 @@ button, .button { .close-button { background: none; +} + +.stage-button { + border: none; + margin: 0; + border-radius: 2px; + box-shadow: 0 1px 2px rgba($talk-dark, 0.2); + background: rgba(white, 0.5); + color: $vr-green; + + &:hover { + background: $vr-green; + color: $white; + } + svg { + margin-right: 12px; + width: 18px; + height: 18px; + } } \ No newline at end of file diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 81bafc474..fbfc7601a 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -114,7 +114,7 @@ $talk-dark: #29292b !default; $primary-color: #2c46b0 !default; // vr blue $secondary-color: #54c6c6 !default; // vr turq $alert-color: #f82847 !default; // vr red -$success-color: #60BD70 !important; // vr greeen (new from nick) +$success-color: #60BD70 !default; // vr greeen (new from nick) $warning-color: #ffed00 !default; // vr yellow $info-color: #fef1de !default; // vr beige $brand-purple: #a339cd !default; //vr-purple @@ -129,6 +129,7 @@ $vr-red: $alert-color; $vr-purple: $brand-purple; $vr-yellow: $warning-color; $vr-beige: $info-color; +$vr-green: $success-color; $topbar-dark: #35363b !default; $input-error-color: $vr-red; diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index 350c94544..632d12d85 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -543,21 +543,7 @@ hr { } #toggles .button { - border: none; - margin: 0; - border-radius: 2px; - box-shadow: 0 1px 2px rgba($talk-dark, 0.2); - background: rgba(white, 0.5); - color: $success-color; - &:hover { - background: $success-color; - color: white; - } - svg { - margin-right: 12px; - width: 18px; - height: 18px; - } + &.active { background: none; color: $success-color; @@ -575,15 +561,19 @@ hr { pointer-events: none; } } - &#device-label { - box-shadow: none; - pointer-events: none; - height: 30px; - background: none; - color: $oil; - svg { - margin-right: 6px; - } + +} + +#device-label { + box-shadow: none; + pointer-events: none; + height: 30px; + background: none; + color: $oil; + svg { + width: 36px; + height: 36px; + margin-right: 6px; } } diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 73330df68..a28a305fd 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -18,7 +18,7 @@ *= require slick */ -@import "settings"; +// @import "settings"; @import "foundation_and_overrides"; /*@import "animate.min.css";*/ /* diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index 1ad4b86ec..f7cfd0d0a 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -581,7 +581,7 @@ (defn mute-comp [] (if (venue-in-state ["connected"]) - [:button.tiny.button.btn-gray.btn-hover-green.hollow.mute-toggle + [:button.button.tiny.stage-button.mute-toggle {:on-click toggle-mute-action} "sound" (if (@page-state :mute) @@ -627,10 +627,10 @@ (defn device-comp [] [:div - [:div#device-label.tiny.button.btn-gray.hollow + [:div#device-label [icon-comp "soundwave"] (device-display-name)] - [:button#device-button.tiny.button.btn-white.btn-hover-green + [:button#device-button.button.tiny.stage-button {:on-click toggle-source-wizard-action} "choose streaming source"]]) @@ -1034,7 +1034,7 @@ (defn autostart-comp [] ;; TODO fix shift of source select when autostart is hidden ;;(if (active-talk) - [:button.tiny.button.btn-gray.btn-hover-green.hollow.text-left + [:button.button.tiny.stage-button.text-left {:class (if (:autostart @page-state) "active" "") :on-click toggle-autostart-action} [icon-comp "bolt"] @@ -1049,6 +1049,9 @@ [:div.small-4.columns.text-right.no-pad [mute-comp]]]) +(defn post-talk-link-comp [] + [:div.clearfix [:a.button.tiny.stage-button {:href (active-talk-url)} "View Your Talk"]]) + (defn messages [] (reverse (sort-by :time (:messages @page-state)))) @@ -1251,6 +1254,7 @@ [:div#left-side.medium-8.columns.no-pad.text-center ; left [toggles-comp] [circles-comp] + [post-talk-link-comp] (if (:active-talk-speakers @page-state) [speakers-comp])] [message-container-comp] ; right From 1e4eb018fc712b572b9c767a3d47e51973086035 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 27 Mar 2017 12:17:28 +0200 Subject: [PATCH 06/27] change long link in message, start refactoring volume meter into stroke --- config/locales/en-frontend.yml | 4 ++-- lib/vrng/src/vrng/venues/core.cljs | 29 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config/locales/en-frontend.yml b/config/locales/en-frontend.yml index e40dee717..05655dc59 100644 --- a/config/locales/en-frontend.yml +++ b/config/locales/en-frontend.yml @@ -99,8 +99,8 @@ en: http://blog.voicerepublic.com/support/troubleshooting-2 waiting_for_reconnect: >- Oops, we lost you! Please check your internet - connection. Please find help here - http://blog.voicerepublic.com/support/troubleshooting-2 + connection. Please find help %{visit-troubleshooting}. + connected_again: >- Phew! You're back. continue_streaming: >- diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index f7cfd0d0a..266681a33 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -297,6 +297,7 @@ false) (defn end-talk-action [talk] + ; hide stop button (track-event "talk end") (PUT (talk-url talk) {:format :json @@ -583,10 +584,10 @@ (if (venue-in-state ["connected"]) [:button.button.tiny.stage-button.mute-toggle {:on-click toggle-mute-action} - "sound" + "monitor" (if (@page-state :mute) [icon-comp "sound_off"] - [icon-comp "sound_on"])] + [icon-comp "headphones"])] ; [:button.tiny.button.btn-gray.btn-hover-green.hollow.float-right "giggle"] )) @@ -769,7 +770,7 @@ {:r "110" :stroke-width "10" :stroke (source-ring-color) - :stroke-dasharray (source-ring-dasharray 110) ; takes the radius + :stroke-dasharray (source-ring-dasharray 50) ; takes the radius :fill "none" :cy "50%" :cx "50%" @@ -779,7 +780,7 @@ (defn- source-audio-meter-radius "min is 20, max is 130" [] - (+ 20 (* (/ (:volume @spork/audio) 255) 110))) + (* (/ (:volume @spork/audio) 255) 15)) (defn- source-audio-meter-opacity "min is 0 max is 0.95" @@ -790,9 +791,11 @@ "Audio meter that pulsates based on the audio signal." [] [:circle - {:r (source-audio-meter-radius) + {:r 75 + :stroke-width (source-audio-meter-radius) + :stroke green :opacity (source-audio-meter-opacity) - :fill green + :fill "none" :cy "50%" :cx "50%"}]) @@ -1316,7 +1319,8 @@ (add-server-message (t message ;;:create-a-talk (str "create a talk")))) - :create-a-talk [:a {:href (new-talk-path)} "create a talk"]))) + :create-a-talk [:a {:href (new-talk-path)} "create a talk"] + ))) (when (= (venue-state) "connected") ;; subscribe to audio & setup audio meter (media/mode! "streamed") @@ -1353,7 +1357,9 @@ (add-server-message (t "message.server_starting")) ["provisioning" "device_required"] - (add-server-message (t "message.server_ready_select_source")) + (do + (toggle-source-wizard-action) + (add-server-message (t "message.server_ready_select_source"))) ["provisioning" "awaiting_stream"] (do @@ -1361,10 +1367,13 @@ (add-server-message (t "message.connecting"))) ["awaiting_stream" "connected"] - (add-server-message (t "message.connected")) + (do + (hide-source-wizard) + (add-server-message (t "message.connected"))) ["connected" "disconnected"] - (add-server-message (t "message.waiting_for_reconnect")) + (add-server-message (t "message.waiting_for_reconnect" + :visit-troubleshooting [:a {:href "http://blog.voicerepublic.com/support/troubleshooting-2" :target "_blank"} "here"])) ["disconnected" "connected"] (if (onair?) From f703c0b8465521b1afbb66a2c480788870dc8346 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 27 Mar 2017 15:02:29 +0200 Subject: [PATCH 07/27] thinner audio vizzualizer --- lib/vrng/src/vrng/venues/core.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index 266681a33..91c4d576d 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -705,6 +705,11 @@ (venue-in-state ["provisioning"]) lightblue :else green)) +(defn stream-ring-color + "Color of the Live Stream Indicator Ring Capacitor" + [] + (if (active-talk-in-state ["live"]) green gray)) + (defn server-ring-dasharray "Server progress." [percentage radius] @@ -780,7 +785,7 @@ (defn- source-audio-meter-radius "min is 20, max is 130" [] - (* (/ (:volume @spork/audio) 255) 15)) + (.min js/Math (* (/ (:volume @spork/audio) 255) 20) 10)) (defn- source-audio-meter-opacity "min is 0 max is 0.95" @@ -791,7 +796,7 @@ "Audio meter that pulsates based on the audio signal." [] [:circle - {:r 75 + {:r 80 :stroke-width (source-audio-meter-radius) :stroke green :opacity (source-audio-meter-opacity) @@ -804,7 +809,7 @@ [] [:circle.base {:r "95" - :stroke gray + :stroke (stream-ring-color) :stroke-width "10" :fill "none" :cy "50%" From 148235ecca4eee8bfeda88dd76d897b540b5f128 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 27 Mar 2017 15:22:49 +0200 Subject: [PATCH 08/27] hide speakers --- lib/vrng/src/vrng/venues/core.cljs | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index 91c4d576d..4f9807816 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -957,18 +957,20 @@ [end-talk-button-comp]]) [gui-labels-comp]]]) -(defn speaker-comp [speaker] - ^{:key speaker} - [:li.clearfix - [:span.float-left - [icon-comp "person"]] - [:span.speaker-name speaker]]) - -(defn speakers-comp [] - [:div#speakers.medium-10.columns.medium-offset-1.end - [:h4.section-title.text-center "Speakers"] - [:ul.menu.vertical.text-center - (doall (map speaker-comp (active-talk-speakers)))]]) + +; Later: +; (defn speaker-comp [speaker] +; ^{:key speaker} +; [:li.clearfix +; [:span.float-left +; [icon-comp "person"]] +; [:span.speaker-name speaker]]) + +; (defn speakers-comp [] +; [:div#speakers.medium-10.columns.medium-offset-1.end +; [:h4.section-title.text-center "Speakers"] +; [:ul.menu.vertical.text-center +; (doall (map speaker-comp (active-talk-speakers)))]]) ;; TODO move this into sections somehow (defn help-comp [] @@ -1263,8 +1265,9 @@ [toggles-comp] [circles-comp] [post-talk-link-comp] - (if (:active-talk-speakers @page-state) - [speakers-comp])] + ; (if (:active-talk-speakers @page-state) + ; [speakers-comp]) + ] [message-container-comp] ; right ;;[chat-input-comp] ] From 90e13b5e6c4b05f74a440651f6e35d4d78185706 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 27 Mar 2017 16:04:50 +0200 Subject: [PATCH 09/27] add and change some icons --- app/assets/stylesheets/_venue.scss | 13 ++++++++-- app/views/shared/_svg_defs.html | 22 +++++++++++++--- lib/cable.svg | 10 ++++++++ lib/svg/cable.svg | 10 ++++++++ lib/svg/eye.svg | 3 +++ lib/svg/gear.svg | 40 ++++++++++++++++++++++++++++++ lib/vrng/src/vrng/venues/core.cljs | 26 ++++++++++++------- 7 files changed, 110 insertions(+), 14 deletions(-) create mode 100644 lib/cable.svg create mode 100644 lib/svg/cable.svg create mode 100644 lib/svg/eye.svg create mode 100644 lib/svg/gear.svg diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index 632d12d85..a505c737a 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -570,10 +570,19 @@ hr { height: 30px; background: none; color: $oil; + font-size: .8rem; + text-transform: uppercase; + letter-spacing: .05rem; + display: inline-block; + margin-right: 12px; + .strong { + font-weight: 700; + } svg { - width: 36px; - height: 36px; + width: 30px; + height: 30px; margin-right: 6px; + vertical-align: middle; } } diff --git a/app/views/shared/_svg_defs.html b/app/views/shared/_svg_defs.html index 6c91c6710..f477ae76b 100644 --- a/app/views/shared/_svg_defs.html +++ b/app/views/shared/_svg_defs.html @@ -1,4 +1,4 @@ - airplanealert airplanealert android cactus cable cactus camera download emailembedfacebookfireworks globe emailembedeye facebookfireworks gear globe + + diff --git a/lib/svg/cable.svg b/lib/svg/cable.svg new file mode 100644 index 000000000..de6cc857f --- /dev/null +++ b/lib/svg/cable.svg @@ -0,0 +1,10 @@ + + + diff --git a/lib/svg/eye.svg b/lib/svg/eye.svg new file mode 100644 index 000000000..2c072377a --- /dev/null +++ b/lib/svg/eye.svg @@ -0,0 +1,3 @@ + + + diff --git a/lib/svg/gear.svg b/lib/svg/gear.svg new file mode 100644 index 000000000..56028b9e7 --- /dev/null +++ b/lib/svg/gear.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index 4f9807816..acc0c9f01 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -30,6 +30,7 @@ :dropdown-menu-open false :talkbar-expanded false :help-text-open false + :stop-stream-open false :device-name (:device_name (:venue @state)) :stats {:listener_count 0}})) @@ -294,7 +295,8 @@ {:format :json :params { :talk { :event "start_talk"}}}) (add-server-message (t "message.streaming")) - false) + false + (:stop-stream-open @page-state) true) (defn end-talk-action [talk] ; hide stop button @@ -629,11 +631,15 @@ (defn device-comp [] [:div [:div#device-label - [icon-comp "soundwave"] - (device-display-name)] + [icon-comp "cable"] + "source: " + [:span.strong + (device-display-name)]] [:button#device-button.button.tiny.stage-button {:on-click toggle-source-wizard-action} - "choose streaming source"]]) + [icon-comp "gear"] + "change" + ]]) (defn talk-item-comp [talk] ^{:key (:id talk)} @@ -657,7 +663,7 @@ [:a {:href (:url (active-talk))} (:title (active-talk))] (if (onair?) [:span.listener-info {:title "listeners"} - [icon-comp "headphones"] " " (listener-count)]) + [icon-comp "person"] " " (listener-count)]) [:span.float-right.time-info (format-countdown (if (onair?) (active-talk-runtime) @@ -954,6 +960,7 @@ (when (onair?) [:g [stream-overlay-ring-comp] + ; (if (:stop-stream-open @page-state) [end-talk-button-comp]]) [gui-labels-comp]]]) @@ -1052,15 +1059,15 @@ (defn toggles-comp [] [:div#toggles.clearfix - [:div.small-4.columns.text-left.no-pad + [:div.small-3.columns.text-left.no-pad [autostart-comp]] - [:div.small-4.columns.text-center.no-pad + [:div.small-6.columns.text-center.no-pad [device-comp]] - [:div.small-4.columns.text-right.no-pad + [:div.small-3.columns.text-right.no-pad [mute-comp]]]) (defn post-talk-link-comp [] - [:div.clearfix [:a.button.tiny.stage-button {:href (active-talk-url)} "View Your Talk"]]) + [:div.clearfix [:a.button.tiny.stage-button {:href (active-talk-url)} [icon-comp "eye"] "View Your Talk"]]) (defn messages [] (reverse (sort-by :time (:messages @page-state)))) @@ -1264,6 +1271,7 @@ [:div#left-side.medium-8.columns.no-pad.text-center ; left [toggles-comp] [circles-comp] + [post-talk-link-comp] ; (if (:active-talk-speakers @page-state) ; [speakers-comp]) From fd53b1363168e6243208d4e995be59fca0610c0e Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 27 Mar 2017 17:10:21 +0200 Subject: [PATCH 10/27] try to make the stop button go away right away --- app/assets/stylesheets/_venue.scss | 2 +- lib/vrng/src/vrng/venues/core.cljs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/_venue.scss b/app/assets/stylesheets/_venue.scss index a505c737a..e8cb2171c 100644 --- a/app/assets/stylesheets/_venue.scss +++ b/app/assets/stylesheets/_venue.scss @@ -1120,7 +1120,7 @@ svg#logo { font-size: .9rem; color: #333; padding-bottom: 21px; - max-width: 80%; + // max-width: 80%; position: relative; background-color: white; animation: diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index acc0c9f01..aacb5c846 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -30,7 +30,7 @@ :dropdown-menu-open false :talkbar-expanded false :help-text-open false - :stop-stream-open false + :hide-stop-button false :device-name (:device_name (:venue @state)) :stats {:listener_count 0}})) @@ -192,7 +192,7 @@ ;; TODO use correct name, noop is not (defn device-display-name [] (or (venue-device-name) - (:name (selected-device)))) + (:name (selected-device)) "Not Selected")) ;; Messaging @@ -295,11 +295,10 @@ {:format :json :params { :talk { :event "start_talk"}}}) (add-server-message (t "message.streaming")) - false - (:stop-stream-open @page-state) true) + false) (defn end-talk-action [talk] - ; hide stop button + (swap! page-state :hide-stop-button true) (track-event "talk end") (PUT (talk-url talk) {:format :json @@ -960,8 +959,8 @@ (when (onair?) [:g [stream-overlay-ring-comp] - ; (if (:stop-stream-open @page-state) - [end-talk-button-comp]]) + (if (not (:hide-stop-button @page-state)) + [end-talk-button-comp])]) [gui-labels-comp]]]) From cf3d24f16f0df8886e3eb2518470b9dba449d264 Mon Sep 17 00:00:00 2001 From: Lino von Burg Date: Mon, 3 Apr 2017 15:21:09 +0200 Subject: [PATCH 11/27] added task for cleaning up cache of old releases --- config/deploy.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/config/deploy.rb b/config/deploy.rb index 234222c30..c2c1cc9d7 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -119,6 +119,25 @@ # end end + + + task :clear_old_caches do + on roles(:app) do + path = "/home/app/app" + within path do + active_release = capture :readlink, '-f', 'current' + active_timestamp = capture :basename, active_release + end + within path + "/releases" do + old_releases = capture(:ls, '--hide', active_timestamp).split + old_releases.each do |old_release| + execute :rm, '-rf', "#{old_release}/tmp/cache/*" + end + end + end + end + after :finishing, :clear_old_caches + end From b296da43b38e4aa5d4d1fca15d9bf93f929740e7 Mon Sep 17 00:00:00 2001 From: Lino von Burg Date: Mon, 3 Apr 2017 18:41:30 +0200 Subject: [PATCH 12/27] move task to rake --- config/deploy.rb | 12 +----------- lib/tasks/deploy.rake | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 lib/tasks/deploy.rake diff --git a/config/deploy.rb b/config/deploy.rb index c2c1cc9d7..23b114738 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -123,17 +123,7 @@ task :clear_old_caches do on roles(:app) do - path = "/home/app/app" - within path do - active_release = capture :readlink, '-f', 'current' - active_timestamp = capture :basename, active_release - end - within path + "/releases" do - old_releases = capture(:ls, '--hide', active_timestamp).split - old_releases.each do |old_release| - execute :rm, '-rf', "#{old_release}/tmp/cache/*" - end - end + execute :rake, "deploy:cleanup:clear_old_caches" end end after :finishing, :clear_old_caches diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake new file mode 100644 index 000000000..737205350 --- /dev/null +++ b/lib/tasks/deploy.rake @@ -0,0 +1,16 @@ +namespace :deploy do + namespace :cleanup do + task :clear_old_caches do + current_path = Rails.root.join('..', '..', 'current') + releases_path = Rails.root.join('..') + active_release_path = File.readlink(current_path) + active_release_timestamp = File.basename(active_release_path) + Dir.chdir(releases_path) do + old_releases = Dir.glob('*') - [active_release_timestamp] + old_releases.each do |old_release| + FileUtils.rm_rf Dir.glob("#{old_release}/tmp/cache/*") + end + end + end + end +end From 1e89f2219713663aa76deea3843c104ce12ddf99 Mon Sep 17 00:00:00 2001 From: Lino von Burg Date: Mon, 10 Apr 2017 13:26:06 +0200 Subject: [PATCH 13/27] add buckets for db-backup --- lib/tasks/fog.rake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/tasks/fog.rake b/lib/tasks/fog.rake index 89c73552b..44707eb2b 100644 --- a/lib/tasks/fog.rake +++ b/lib/tasks/fog.rake @@ -55,13 +55,15 @@ namespace :fog do { key: 'vr-euc1-live-media', location: 'eu-central-1' }, { key: 'vr-euc1-live-slides-uploads', location: 'eu-central-1' }, { key: 'vr-euc1-live-backup-recordings', location: 'eu-central-1' }, + { key: 'vr-euc1-live-db-backups', location: 'eu-central-1' }, { key: 'vr-euc1-staging-audio-uploads', location: 'eu-central-1' }, { key: 'vr-euc1-staging-import', location: 'eu-central-1' }, { key: 'vr-euc1-staging-logs', location: 'eu-central-1' }, { key: 'vr-euc1-staging-media', location: 'eu-central-1' }, { key: 'vr-euc1-staging-slides-uploads', location: 'eu-central-1' }, - { key: 'vr-euc1-staging-backup-recordings', location: 'eu-central-1' } + { key: 'vr-euc1-staging-backup-recordings', location: 'eu-central-1' }, + { key: 'vr-euc1-staging-db-backups', location: 'eu-central-1' } ] desc 'list all buckets' From df90d90b2421f58deeb3b58a2b537c83e155915e Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 10 Apr 2017 13:05:22 +0000 Subject: [PATCH 14/27] fix missing wizard icons by renaming var --- lib/vrng/src/vrng/venues/core.cljs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index 1d5378551..36cb72bf4 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -585,8 +585,8 @@ {:on-click toggle-mute-action} "monitor" (if (@page-state :mute) - [icon-comp "sound_off"] - [icon-comp "headphones"])] + [icon "sound_off"] + [icon "headphones"])] ; [:button.tiny.button.btn-gray.btn-hover-green.hollow.float-right "giggle"] )) @@ -628,13 +628,13 @@ (defn device-comp [] [:div [:div#device-label - [icon-comp "cable"] + [icon "cable"] "source: " [:span.strong (device-display-name)]] [:button#device-button.button.tiny.stage-button {:on-click toggle-source-wizard-action} - [icon-comp "gear"] + [icon "gear"] "change" ]]) @@ -664,7 +664,7 @@ [:a {:href (:url (active-talk))} (:title (active-talk))] (if (onair?) [:span.listener-info {:title "listeners"} - [icon-comp "person"] " " (listener-count)]) + [icon "person"] " " (listener-count)]) [:span.float-right.time-info (format-countdown (if (onair?) (active-talk-runtime) @@ -977,7 +977,7 @@ ; ^{:key speaker} ; [:li.clearfix ; [:span.float-left -; [icon-comp "person"]] +; [icon "person"]] ; [:span.speaker-name speaker]]) ; (defn speakers-comp [] @@ -1061,7 +1061,7 @@ [:button.button.tiny.stage-button.text-left {:class (if (:autostart @page-state) "active" "") :on-click toggle-autostart-action} - [icon-comp "bolt"] + [icon "bolt"] "autostart"]);;) (defn toggles-comp [] @@ -1074,7 +1074,7 @@ [mute-comp]]]) (defn post-talk-link-comp [] - [:div.clearfix [:a.button.tiny.stage-button {:href (active-talk-url)} [icon-comp "eye"] "View Your Talk"]]) + [:div.clearfix [:a.button.tiny.stage-button {:href (active-talk-url)} [icon "eye"] "View Your Talk"]]) (defn messages [] (reverse (sort-by :time (:messages @page-state)))) @@ -1161,14 +1161,14 @@ (defn device-option-comp "Displays a button inside the wizard." - [page icon label delay &{:keys [custom-class] :or {custom-class ""}}] + [page picto label delay &{:keys [custom-class] :or {custom-class ""}}] (let [offset-y (reagent/atom 50) drift (anim/interpolate-to offset-y {:easing ease-in-out-quart :duration 1500}) opacity (reagent/atom 0) fade (anim/interpolate-to opacity {:duration 1500})] ;; (prn page icon label delay custom-class) - (fn [page icon label delay &{:keys [custom-class] :or {custom-class ""}}] + (fn [page picto label delay &{:keys [custom-class] :or {custom-class ""}}] [:li {:class custom-class :on-click (fn [] (select-device-action page)) @@ -1178,7 +1178,8 @@ (reset! opacity 1) (reset! offset-y 0)) delay] [:div.itemwrapper - [icon icon] + + [icon picto] [:br] label]]))) From ef8c7647225ca875b4f4171be3859deb4dfd02bb Mon Sep 17 00:00:00 2001 From: Lino von Burg Date: Mon, 10 Apr 2017 17:06:56 +0200 Subject: [PATCH 15/27] add script for db backup and schedule it to run daily --- bin/backup_database | 24 ++++++++++++++++++++++++ config/schedule.rb | 5 +++++ 2 files changed, 29 insertions(+) create mode 100644 bin/backup_database diff --git a/bin/backup_database b/bin/backup_database new file mode 100644 index 000000000..72c02d1bf --- /dev/null +++ b/bin/backup_database @@ -0,0 +1,24 @@ +#!/usr/bin/env ruby + +require 'yaml' +require 'fileutils' + +config_path = File.expand_path(File.join(%w(.. .. config settings.local.yml)), __FILE__) + +config = YAML.load(File.read(config_path)) + +access_key_id = config['fog']['storage']['aws_access_key_id'] +secret_access_key = config['fog']['storage']['aws_secret_access_key'] + +bucket, region = config['storage']['database_backups'].split('@') + +backup_name = "dumpall-#{Date.today.strftime('%Y%m%d')}.sql.gz" + +backup_path = File.expand_path(File.join(%w(.. .. tmp db)), __FILE__) + +FileUtils.mkdir_p backup_path + +Dir.chdir backup_path do + system("sudo -u postgres pg_dumpall | gzip > #{backup_name}") + system("AWS_ACCESS_KEY_ID=#{access_key_id};AWS_SECRET_ACCESS_KEY=#{secret_access_key};aws s3 mv #{backup_name} s3://#{bucket}/ --region #{region}") +end diff --git a/config/schedule.rb b/config/schedule.rb index 2f55dfc99..3574e8b34 100644 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -22,6 +22,7 @@ # rbenv setup set :job_template, "bash -l -c 'export PATH=/home/app/.rbenv/shims:$PATH && :job'" set :output, "/home/app/app/shared/log/whenever-cron.log" +job_type :bin, "cd :path/bin && ruby :task :output" # Task invokation should be once in an hour every 40.minutes, :roles => [:app] do @@ -60,3 +61,7 @@ rake 'cleanup:stop_disused_streaming_servers' rake 'cleanup:reset_abandoned_venues' end + +every 24.hours, at: '2:00 am', roles: [:app] do + bin 'backup_database' +end From c2b71d788e1e554723a0db0ff7b2b6a026a203b6 Mon Sep 17 00:00:00 2001 From: Nick Niles Date: Mon, 10 Apr 2017 15:51:54 +0000 Subject: [PATCH 16/27] fix stop button error --- lib/vrng/src/vrng/venues/core.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vrng/src/vrng/venues/core.cljs b/lib/vrng/src/vrng/venues/core.cljs index 36cb72bf4..30b4aaa43 100644 --- a/lib/vrng/src/vrng/venues/core.cljs +++ b/lib/vrng/src/vrng/venues/core.cljs @@ -300,7 +300,7 @@ false) (defn end-talk-action [talk] - (swap! page-state :hide-stop-button true) + (swap! page-state assoc :hide-stop-button true) (track-event "talk end") (PUT (talk-url talk) {:format :json From b860b0fc5a28adbb95d6823db161ca21945c9220 Mon Sep 17 00:00:00 2001 From: Lino von Burg Date: Thu, 27 Apr 2017 13:45:39 +0200 Subject: [PATCH 17/27] fixed the repository url for jessie-backports sources --- lib/icecast/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/icecast/Dockerfile b/lib/icecast/Dockerfile index 4f22508a0..b1833332a 100644 --- a/lib/icecast/Dockerfile +++ b/lib/icecast/Dockerfile @@ -11,7 +11,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN groupadd -r icecast && \ useradd -r -g icecast icecast2 -RUN echo 'deb-src http://httpredir.debian.org/debian jessie-backports main' \ +RUN echo 'deb-src http://deb.debian.org/debian/ jessie-backports main' \ >> /etc/apt/sources.list.d/backports.list RUN apt-get -qq -y update && \ apt-get -qq -y install curl build-essential dpkg-dev libssl-dev && \ From 9cfb1658f63d950b954bb7367850af8f8e64d91c Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 11 May 2017 14:19:50 +0200 Subject: [PATCH 18/27] remove Vagrantfile & provision.sh, they moved to the devbox repo --- Vagrantfile | 101 --------------------------------------------------- provision.sh | 44 ---------------------- 2 files changed, 145 deletions(-) delete mode 100644 Vagrantfile delete mode 100644 provision.sh diff --git a/Vagrantfile b/Vagrantfile deleted file mode 100644 index e93829791..000000000 --- a/Vagrantfile +++ /dev/null @@ -1,101 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# All Vagrant configuration is done below. The '2' in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure(2) do |config| - # The most common configuration options are documented and commented below. - # For a complete reference, please see the online documentation at - # https://docs.vagrantup.com. - - # Every Vagrant development environment requires a box. You can search for - # boxes at https://atlas.hashicorp.com/search. - config.vm.box = 'debian/jessie64' - - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - # config.vm.box_check_update = false - - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. - #config.vm.network 'forwarded_port', guest: 3000, host: 3000 - #config.vm.network 'forwarded_port', guest: 3001, host: 3001 - #config.vm.network 'forwarded_port', guest: 22, host: 2222 - - config.ssh.forward_agent = true - - # config.ssh.username = 'vagrant' - # config.ssh.password = 'vagrant' - #config.ssh.insert_key = 'true' - config.ssh.insert_key = false - - # config.ssh.private_key_path = '~/.ssh/id_rsa' - - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network 'private_network', ip: '192.168.33.10' - - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - config.vm.network 'public_network', bridge: 'wlan0: WiFi' - - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - # config.vm.synced_folder '../data', '/vagrant_data' - - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - config.vm.provider 'virtualbox' do |vb| - # Display the VirtualBox GUI when booting the machine - vb.gui = true - # - # Customize the amount of memory on the VM: - vb.memory = 1024 * 6 - - # Utilize 100% of real CPU for the configured Cores - # Note: This is probably the default - vb.customize ['modifyvm', :id, '--cpuexecutioncap', '100'] - - vb.cpus = 4 - end - # - # View the documentation for the provider you are using for more - # information on available options. - - # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies - # such as FTP and Heroku are also available. See the documentation at - # https://docs.vagrantup.com/v2/push/atlas.html for more information. - # config.push.define 'atlas' do |push| - # push.app = 'YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME' - # end - - # The shell is set explicitly to not show an error which is not an - # error (see discussion - # https://github.com/mitchellh/vagrant/issues/1673#issuecomment-28288042) - config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" - # NOTE: Provisioning is only run on the _first_ call to `vagrant up` - # If you want to run it later, use `vagrant provision` - - config.vm.provision 'shell' do |s| - ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip - s.inline = <<-SHELL - echo #{ssh_pub_key} >> /home/vagrant/.ssh/authorized_keys - sudo mkdir -p /root/.ssh - sudo echo #{ssh_pub_key} >> /root/.ssh/authorized_keys - SHELL - end - - # copy provision script - config.vm.provision 'file', source: 'provision.sh', destination: 'provision.sh' - # run provision script - config.vm.provision 'shell', inline: 'sudo bash provision.sh' - -end diff --git a/provision.sh b/provision.sh deleted file mode 100644 index e69f893f6..000000000 --- a/provision.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -echo 'deb http://ftp.debian.org/debian jessie-backports main' > \ - /etc/apt/sources.list.d/backports.list - -apt-get update - -apt-get install -y zsh i3 xinit roxterm git - -# auto login -mkdir -p /etc/systemd/system/getty@tty1.service.d/ -cat > /etc/systemd/system/getty@tty1.service.d/override.conf <~vagrant/.zprofile <> ~vagrant/.zprofile - - -# setup vr -mkdir -p ~vagrant/src -ln -s /vagrant ~vagrant/src/vr - -chown -R vagrant: ~vagrant - -# TODO -su -c 'ssh-keygen -b 2048 -t rsa -f .ssh/id_rsa -N ""' -echo '=== IMPORT THIS KEY TO GITHUB ===' -echo -cat ~vagrant/.ssh/id_rsa.pub -echo -echo '===' From 048bbb4a88fc5848ad94f3881b724224823a080d Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 10:15:28 +0200 Subject: [PATCH 19/27] fix specs (step 1) --- ...dpoint_spec.rb => icebox_endpoint_spec.rb} | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) rename spec/middlewares/{icecast_endpoint_spec.rb => icebox_endpoint_spec.rb} (67%) diff --git a/spec/middlewares/icecast_endpoint_spec.rb b/spec/middlewares/icebox_endpoint_spec.rb similarity index 67% rename from spec/middlewares/icecast_endpoint_spec.rb rename to spec/middlewares/icebox_endpoint_spec.rb index bffb927fe..ac5cd1e37 100644 --- a/spec/middlewares/icecast_endpoint_spec.rb +++ b/spec/middlewares/icebox_endpoint_spec.rb @@ -1,26 +1,26 @@ require 'rails_helper' -describe IcecastEndpoint do +describe IceboxEndpoint do let(:app) { ->(env) {[200, {}, []]} } - let(:request) { Rack::MockRequest.new(IcecastEndpoint.new(app, {})) } + let(:request) { Rack::MockRequest.new(IceboxEndpoint.new(app, {})) } it 'should fail with invalid client token' do - response = request.post('/icecast/complete/bielefeld') + response = request.post('/icebox/complete/bielefeld') expect(response.status).to eq(404) end context 'with venue' do it 'should fail with invalid action' do venue = FactoryGirl.create(:venue, :provisioning) - response = request.post("/icecast/bielefeld/#{venue.client_token}") + response = request.post("/icebox/#{venue.client_token}/bielefeld") expect(response.status).to eq(721) end it 'should receive stats' do venue = FactoryGirl.create(:venue, :provisioning) response = nil - VCR.use_cassette 'icecast stats' do - response = request.post("/icecast/stats/#{venue.client_token}") + VCR.use_cassette 'icebox stats' do + response = request.post("/icebox/#{venue.client_token}/stats") end expect(response.status).to eq(200) end @@ -29,8 +29,8 @@ venue = FactoryGirl.create(:venue, :provisioning) payload = { public_ip_address: '1.2.3.4' } response = nil - VCR.use_cassette 'icecast_complete' do - response = request.post("/icecast/ready/#{venue.client_token}", + VCR.use_cassette 'icebox_complete' do + response = request.post("/icebox/#{venue.client_token}/ready", input: JSON.unparse(payload)) end expect(response.status).to eq(200) @@ -41,8 +41,8 @@ it 'should successfully update venue on connect' do venue = FactoryGirl.create(:venue, :awaiting_stream) response = nil - VCR.use_cassette 'icecast_connect' do - response = request.post("/icecast/connect/#{venue.client_token}") + VCR.use_cassette 'icebox_connect' do + response = request.post("/icebox/#{venue.client_token}/connect") end expect(response.status).to eq(200) expect(venue.reload).to be_connected @@ -52,8 +52,8 @@ it 'should successfully update venue on disconnect' do venue = FactoryGirl.create(:venue, :connected) response = nil - VCR.use_cassette 'icecast_disconnect' do - response = request.post("/icecast/disconnect/#{venue.client_token}") + VCR.use_cassette 'icebox_disconnect' do + response = request.post("/icebox/#{venue.client_token}/disconnect") end expect(response.status).to eq(200) expect(venue.reload).to be_disconnected From e1556047eb0962ca1eafc318c1b0e96d730734f2 Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 10:25:49 +0200 Subject: [PATCH 20/27] fix specs (part 2) --- app/models/talk.rb | 2 +- circle.yml | 4 ++-- lib/icecast_remote.rb | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/talk.rb b/app/models/talk.rb index 8e7ebd449..93c60447d 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -624,7 +624,7 @@ def after_end venue.require_disconnect! if venue.connected? # experimental - venue.force_disconnect! + venue.force_disconnect! unless public_ip_address.nil? end # FIXME cleanup the wget/cp spec mess with diff --git a/circle.yml b/circle.yml index 17023d1a4..5affc0bd4 100644 --- a/circle.yml +++ b/circle.yml @@ -1,6 +1,6 @@ dependencies: - cache_directories: - - spec/angular/node_modules + #cache_directories: + # - spec/angular/node_modules pre: - sudo apt-get update; sudo apt-get install lame vorbis-tools mplayer - cd lib/vrng && lein cljsbuild once app diff --git a/lib/icecast_remote.rb b/lib/icecast_remote.rb index 111a2a030..bdfedf16a 100644 --- a/lib/icecast_remote.rb +++ b/lib/icecast_remote.rb @@ -3,6 +3,9 @@ class IcecastRemote < Struct.new(:options) def disconnect! + raise "Cannot disconnect without proper address." if + options[:public_ip_address].nil? + faraday.basic_auth('admin', options[:admin_password]) faraday.get(url) end From 1c586915b0ae071bdf30365b5088808a3c3762ea Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 10:29:48 +0200 Subject: [PATCH 21/27] fix specs (part 3) --- app/models/talk.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/talk.rb b/app/models/talk.rb index 93c60447d..00b2ff59f 100644 --- a/app/models/talk.rb +++ b/app/models/talk.rb @@ -624,7 +624,7 @@ def after_end venue.require_disconnect! if venue.connected? # experimental - venue.force_disconnect! unless public_ip_address.nil? + venue.force_disconnect! unless venue.public_ip_address.nil? end # FIXME cleanup the wget/cp spec mess with From 2f6414f787f67f90af21ba2c0f63ed3c023e7e0b Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 10:51:40 +0200 Subject: [PATCH 22/27] redirect old rss links to featured content --- config/routes.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/routes.rb b/config/routes.rb index ace9919af..6d9c6e503 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -17,6 +17,10 @@ get 'terms', to: redirect(blog_url('/terms-of-use')) end + # old rss links + get '/venues/:id.rss', redirect('/root/index.rss') + + get '/pages/:action' => 'pages', as: 'page' # named get '/pages/publish_talk' => 'pages#publish_talk', as: 'publish_talk' From 9d135aaf8f5a251411e1d619f7248b57dd36acf7 Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 10:56:49 +0200 Subject: [PATCH 23/27] make icecast stats parser more resilient --- lib/icecast_stats_parser.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/icecast_stats_parser.rb b/lib/icecast_stats_parser.rb index 4bf70338d..c7a00281d 100644 --- a/lib/icecast_stats_parser.rb +++ b/lib/icecast_stats_parser.rb @@ -14,6 +14,9 @@ def call(json) # find the main source main = sources.find { |s| s['listenurl'].match(/\/live$/) } + # TODO find out why main is sometimes nil + return {} if main.nil? + # initialize stats = { bitrate: main['audio_bitrate'], From a3fa43c3ec19fab14b19000c82a07abf4c86da8c Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 11:01:44 +0200 Subject: [PATCH 24/27] fix redirect --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 6d9c6e503..f006ca734 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,7 +18,7 @@ end # old rss links - get '/venues/:id.rss', redirect('/root/index.rss') + get '/venues/:id.rss', to: redirect('/root/index.rss') get '/pages/:action' => 'pages', as: 'page' From 049ed6c52e3553a9119fe09b73531938015217f0 Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 11:25:37 +0200 Subject: [PATCH 25/27] respond with proper 404 for unknown devices --- app/controllers/devices_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/devices_controller.rb b/app/controllers/devices_controller.rb index 23748bf4b..8bf4cb1a6 100644 --- a/app/controllers/devices_controller.rb +++ b/app/controllers/devices_controller.rb @@ -57,6 +57,9 @@ def show end @device = Device.find_by(identifier: params[:id]) + + not_found if @device.nil? + @devices_count = current_user.organizations.map(&:devices).flatten.count # TODO raise error if @device.nil? end From f1b43c0b3a3cbc95ea825b6b15e3bd3d5f5d948e Mon Sep 17 00:00:00 2001 From: phil Date: Thu, 18 May 2017 12:15:21 +0200 Subject: [PATCH 26/27] fixes --- config/deploy.rb | 4 +++- lib/tasks/deploy.rake | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 23b114738..a39ad9503 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -123,7 +123,9 @@ task :clear_old_caches do on roles(:app) do - execute :rake, "deploy:cleanup:clear_old_caches" + within release_path do + execute :rake, "deploy:cleanup:clear_old_caches" + end end end after :finishing, :clear_old_caches diff --git a/lib/tasks/deploy.rake b/lib/tasks/deploy.rake index 737205350..afb5b40b6 100644 --- a/lib/tasks/deploy.rake +++ b/lib/tasks/deploy.rake @@ -1,8 +1,8 @@ namespace :deploy do namespace :cleanup do task :clear_old_caches do - current_path = Rails.root.join('..', '..', 'current') - releases_path = Rails.root.join('..') + current_path = File.expand_path(File.join(%w(.. .. current)), Dir.pwd) + releases_path = File.expand_path('..', Dir.pwd) active_release_path = File.readlink(current_path) active_release_timestamp = File.basename(active_release_path) Dir.chdir(releases_path) do From 43d97aa9b8235b571577119aedef204e2e2ac200 Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 23 May 2017 11:06:27 +0200 Subject: [PATCH 27/27] provide wav2json to calculate peaks --- bin/wav2json | 18 ++++++++++++++++++ lib/wav2json/Dockerfile | 30 ++++++++++++++++++++++++++++++ lib/wav2json/README.md | 10 ++++++++++ lib/wav2json/run.sh | 14 ++++++++++++++ 4 files changed, 72 insertions(+) create mode 100755 bin/wav2json create mode 100644 lib/wav2json/Dockerfile create mode 100644 lib/wav2json/README.md create mode 100755 lib/wav2json/run.sh diff --git a/bin/wav2json b/bin/wav2json new file mode 100755 index 000000000..3334c67a7 --- /dev/null +++ b/bin/wav2json @@ -0,0 +1,18 @@ +#!/bin/bash + +DIR="$(cd "$(dirname "$0")" && pwd)" + +# if the docker image does not exist build it +if [[ "$(docker images -q branch14/wav2json 2> /dev/null)" == "" ]]; then + docker build -t branch14/wav2json $DIR/../lib/wav2json +fi + +# then run it +docker run --name wav2json \ + -v `pwd`:/share \ + -e INPUT=$1 \ + -e PRECISION=6 \ + branch14/wav2json + +# and cleanup afterwards +docker rm wav2json diff --git a/lib/wav2json/Dockerfile b/lib/wav2json/Dockerfile new file mode 100644 index 000000000..793b33b79 --- /dev/null +++ b/lib/wav2json/Dockerfile @@ -0,0 +1,30 @@ +# docker run -it branch14/wav2json /bin/bash + +FROM debian:jessie-backports + +MAINTAINER Phil Hofmann "phil@voicerepublic.com" + +ENV DEBIAN_FRONTEND noninteractive + +## add our user and group first to make sure their IDs get assigned +## consistently, regardless of whatever dependencies get added +#RUN groupadd -r icecast && \ +# useradd -r -g icecast icecast2 + +# RUN apt-get update && apt-get install -y git +# RUN git clone https://github.com/beschulz/wav2json.git +# RUN cd wav2json/build + +RUN apt-get update && apt-get install -y wget make sudo g++ +RUN wget https://github.com/beschulz/wav2json/archive/master.tar.gz +RUN tar xfvz master.tar.gz +RUN cd wav2json-master/build && make install_dependencies && make all + +ADD ./*.sh / + +RUN mkdir /share +VOLUME /share + +# USER icecast2 + +CMD ["/run.sh"] diff --git a/lib/wav2json/README.md b/lib/wav2json/README.md new file mode 100644 index 000000000..0ed79b290 --- /dev/null +++ b/lib/wav2json/README.md @@ -0,0 +1,10 @@ +# wav2json docker + +## Usage + +There is a wrapper shell script in `bin/wav2json`. It will build the +docker image if nescessary. It takes the name of the wave file as the +first argument. The file has to reside in the current working +directory. + +This will generate `improved_jingle.wav.json` in the same directory. diff --git a/lib/wav2json/run.sh b/lib/wav2json/run.sh new file mode 100755 index 000000000..bed7c8fb2 --- /dev/null +++ b/lib/wav2json/run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +PRESICION="${PRESICION:-2}" +SAMPLES="${SAMPLES:-800}" +CHANNELS="${CHANNELS:-left right}" + +ls -lAh /share + +/wav2json-master/bin/Linux/wav2json -s $SAMPLES \ + --channels $CHANNELS \ + -p $PRESICION \ + -n /share/$INPUT + +ls -lAh /share