diff --git a/controller/action/AcquisitionActions.class.php b/controller/action/AcquisitionActions.class.php index 2660b34a..7e999f79 100644 --- a/controller/action/AcquisitionActions.class.php +++ b/controller/action/AcquisitionActions.class.php @@ -30,7 +30,10 @@ class AcquisitionActions extends Actions public static function executeYouTube() { - return ['acquisition/youtube']; + return ['acquisition/youtube', [ + 'reward' => LBRY::youtubeReward(), + 'error_message' => $_GET['error_message'] ?? null + ]]; } public static function executeVerify(string $token) @@ -45,7 +48,11 @@ class AcquisitionActions extends Actions public static function executeYoutubeStatus(string $token) { - return ['acquisition/youtube_status', ['token' => $token]]; + return ['acquisition/youtube_status', [ + 'token' => $token, + 'status_token' => LBRY::statusYoutube($token), + 'error_message' => $_GET['error_message'] ?? null + ]]; } public static function actionYoutubeToken(string $desired_lbry_channel_name) @@ -66,8 +73,9 @@ class AcquisitionActions extends Actions } } - public static function actionYoutubeEdit($status_token, $channel_name, $email, $sync_consent, $current_value) + public static function actionYoutubeEdit($status_token, $channel_name, $email, $sync_consent) { + $current_value = LBRY::statusYoutube($status_token); if($current_value['data']['email'] == $email) { $status = LBRY::editYoutube($status_token, $channel_name, null, $sync_consent); @@ -114,14 +122,4 @@ class AcquisitionActions extends Actions return false; } } - - public static function actionGetLBRYReward() - { - return LBRY::youtubeReward(); - } - - public static function actionGetYoutubeStatus($status_token) - { - return LBRY::statusYoutube($status_token); - } } diff --git a/view/View.class.php b/view/View.class.php index 5e0f1277..2a595e9a 100644 --- a/view/View.class.php +++ b/view/View.class.php @@ -142,8 +142,8 @@ class View $all_css = $scssCompiler->compile(file_get_contents(self::SCSS_DIR . '/all.scss')); file_put_contents(self::CSS_DIR . '/all.css', $all_css); - $yt2_css = $scssCompiler->compile(file_get_contents(self::SCSS_DIR . '/yt2.scss')); - file_put_contents(self::CSS_DIR . '/yt2.css', $yt2_css); + $youtube_css = $scssCompiler->compile(file_get_contents(self::SCSS_DIR . '/youtube.scss')); + file_put_contents(self::CSS_DIR . '/youtube.css', $youtube_css); } public static function gzipAssets() diff --git a/view/template/acquisition/youtube.php b/view/template/acquisition/youtube.php index 60b9cf73..03c10556 100644 --- a/view/template/acquisition/youtube.php +++ b/view/template/acquisition/youtube.php @@ -1,12 +1,11 @@ @@ -77,7 +76,7 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
-
+
@@ -87,7 +86,7 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
-
+
@@ -97,7 +96,7 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
-
+
diff --git a/view/template/acquisition/youtube_edit.php b/view/template/acquisition/youtube_edit.php index 2dfae603..856699ce 100644 --- a/view/template/acquisition/youtube_edit.php +++ b/view/template/acquisition/youtube_edit.php @@ -4,10 +4,10 @@ $channel_name = $_POST['new_preferred_channel']; $email = $_POST['new_email']; $sync_consent = isset($_POST['sync_consent']); -$current_value = AcquisitionActions::actionGetYoutubeStatus($status_token); + if(!preg_match("/@[A-Za-z0-9_-]+$/", $channel_name)){ $channel_name = "@" . $channel_name; } -AcquisitionActions::actionYoutubeEdit($status_token, $channel_name, $email, $sync_consent, $current_value); +AcquisitionActions::actionYoutubeEdit($status_token, $channel_name, $email, $sync_consent); diff --git a/view/template/acquisition/youtube_status.php b/view/template/acquisition/youtube_status.php index 01be9ec7..5cd9e1d7 100644 --- a/view/template/acquisition/youtube_status.php +++ b/view/template/acquisition/youtube_status.php @@ -1,11 +1,10 @@ - + - - +
@@ -79,7 +78,7 @@
" . "The following error occurred: ". $_GET['error_message'] . " For support please send an email to hello@lbry.io" . "
"; + if ($error_message): echo "
" . "The following error occurred: ". $error_message . " For support please send an email to hello@lbry.io" . "
"; endif;?>
diff --git a/web/js/yt2/FormValidation.js b/web/js/yt2/FormValidation.js index 0d5016e5..b9efb00b 100644 --- a/web/js/yt2/FormValidation.js +++ b/web/js/yt2/FormValidation.js @@ -63,7 +63,7 @@ function validateEmail(email) { } function validateLBRYName(lbry_channel_name){ - var re = /[@A-Za-z0-9_-]+$/; + var re = /^[@A-Za-z0-9_-]*$/g; return re.test(lbry_channel_name); } diff --git a/web/js/yt2/youtube_video.js b/web/js/yt2/youtube_video.js index b71d5f01..d4a1ec83 100644 --- a/web/js/yt2/youtube_video.js +++ b/web/js/yt2/youtube_video.js @@ -1,25 +1,8 @@ -function playVideo1(){ - var myVideo = document.getElementById("video1"); +function playVideo(id){ + var myVideo = document.getElementById(id); myVideo.play(); - $('#video1').prop("controls", true); - $('#play-video1').hide(); -} - -function playVideo2(){ - var myVideo = document.getElementById("video2"); - - myVideo.play(); - $('#video2').prop("controls", true); - $('#play-video2').hide(); -} - -function playVideo3() { - var myVideo = document.getElementById("video3"); - - myVideo.play(); - $('#video3').prop("controls", true); - $('#play-video3').hide(); - -} + $('#' + id).prop("controls", true); + $('#play-' + id).hide(); +} \ No newline at end of file diff --git a/web/scss/yt2.scss b/web/scss/youtube.scss similarity index 100% rename from web/scss/yt2.scss rename to web/scss/youtube.scss