Merge pull request #458 from lbryio/feature/yt2_sync_update

Feature/yt2 sync update
This commit is contained in:
Jeremy Kauffman 2018-03-21 18:06:52 -04:00 committed by GitHub
commit 1c863de8fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 1679 additions and 1528 deletions

View file

@ -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);

View file

@ -139,8 +139,11 @@ class View
$scssCompiler->setLineNumberStyle(Leafo\ScssPhp\Compiler::LINE_COMMENTS);
}
$css = $scssCompiler->compile(file_get_contents(self::SCSS_DIR . '/all.scss'));
file_put_contents(self::CSS_DIR . '/all.css', $css);
$all_css = $scssCompiler->compile(file_get_contents(self::SCSS_DIR . '/all.scss'));
file_put_contents(self::CSS_DIR . '/all.css', $all_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()

View file

@ -1,12 +1,11 @@
<?php
Response::setCssAssets(['/css/yt2.css']);
Response::setCssAssets(['/css/youtube.css']);
Response::addJsAsset('/js/yt2/TweenMax.min.js');
Response::addJsAsset('/js/yt2/ScrollToPlugin.min.js');
Response::addJsAsset('/js/yt2/app.js');
Response::addJsAsset('/js/yt2/FormValidation.js');
Response::addJsAsset('/js/yt2/SyncStatus.js');
Response::addJsAsset('/js/yt2/youtube_video.js');
$reward = LBRY::youtubeReward();
Response::setMetaTitle("LBRY YouTube Partner Program");
Response::setMetaDescription("Put your content on the blockchain, experience true content freedom, and earn rewards.");
?>
@ -44,7 +43,7 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
<div class="content">
<?php
if (isset($_GET['error'])): echo "<div>" . "The following error occurred: ". $_GET['error_message'] . " For support please send an email to hello@lbry.io" . "</div>";
if (isset($_GET['error']) && $_GET['error_message']): echo "<div>" . "The following error occurred: ". $_GET['error_message'] . " For support please send an email to hello@lbry.io" . "</div>";
endif;?>
<div class="zigzag"></div>
<h1>Create on a stable platform. For real this time.</h1>
@ -77,8 +76,8 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
<div class="boxes">
<div class="box">
<div class="image" target="_blank">
<div class="to-play" onclick="playVideo1()"><span></span></div>
<video id="video1" width="100%" poster="/img/youtube/01@2x.jpg" src="https://spee.ch/1ac47b8b3def40a25850dc726a09ce23d09e7009/ever-wonder-how-bitcoin-and-other.mp4"/></video>
<div id="play-video1" class="to-play" onclick="playVideo('video1')"><span></span></div>
<video id="video1" width="100%" poster="/img/youtube/01@2x.jpg" src="https://spee.ch/1ac47b8b3def40a25850dc726a09ce23d09e7009/ever-wonder-how-bitcoin-and-other.mp4" style="cursor: pointer" onclick="this.paused ? this.play() : this.pause();"/></video>
</div>
<div class="text">
@ -87,8 +86,8 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
</div>
<div class="box">
<div class="image" target="_blank">
<div class="to-play" onclick="playVideo2()"><span></span></div>
<video id="video2" width="100%" poster="/img/youtube/02@2x.jpg" src="https://spee.ch/3c96f32de285db6c04e80bd6f5fad573250541e9/casually-successful.mp4"/></video>
<div id="play-video2" class="to-play" onclick="playVideo('video2')"><span></span></div>
<video id="video2" width="100%" poster="/img/youtube/02@2x.jpg" src="https://spee.ch/3c96f32de285db6c04e80bd6f5fad573250541e9/casually-successful.mp4" style="cursor: pointer" onclick="this.paused ? this.play() : this.pause();" /></video>
</div>
<div class="text">
@ -97,8 +96,8 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
</div>
<div class="box">
<div class="image" target="_blank">
<div class="to-play" onclick="playVideo3()"><span></span></div>
<video id="video3" width="100%" poster="/img/youtube/03@2x.jpg" src="https://spee.ch/8958c5d573d71f5c2d0c1bfdf752737ce39744cb/the-historical-elements-of-wolfenstein.mp4"></video>
<div id="play-video3" class="to-play" onclick="playVideo('video3')"><span></span></div>
<video id="video3" width="100%" poster="/img/youtube/03@2x.jpg" src="https://spee.ch/8958c5d573d71f5c2d0c1bfdf752737ce39744cb/the-historical-elements-of-wolfenstein.mp4" style="cursor: pointer" onclick="this.paused ? this.play() : this.pause();"></video>
</div>
<div class="text">
<p>@ColinsLastStand</p>
@ -139,10 +138,21 @@ Response::setMetaDescription("Put your content on the blockchain, experience tru
<div class="zigzag"></div>
<h1>Sync &amp; Earn</h1>
<p>LBRY offers a single-click sync process<br>for existing YouTubers</p>
<form class="form" id="sync" method="post" action="http://api.lbry.io/yt/connect">
<div class="form-inner">
<input type="text" hidden name="type" value="sync"/>
<input id="immediate-sync" name="immediate_sync" type="checkbox" value="true"/><label class="block full" for="immediate-sync">I want to sync my content.</label>
<div class="block">
<input type="submit" value="Sync Now"/>
</div>
</div>
</form>
<div class="button">
<a href="https://api.lbry.io/yt/connect?type=sync&immediate_sync=true">Sync now</a>
</div>
<div class="meta">
By syncing, you agree to mirror your content to the LBRY network for 1 year, and acknowledge <a href="/faq/youtube-terms">these terms</a>.
</div>

View file

@ -4,10 +4,10 @@ $channel_name = $_POST['new_preferred_channel'];
$email = $_POST['new_email'];
$sync_consent = isset($_POST['sync_consent']);
$current_value = LBRY::statusYoutube($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);

View file

@ -1,11 +1,10 @@
<?php Response::setMetaDescription('YouTuber? Take back control! LBRY allows publication on your terms. It\'s open-source, decentralized, and gives you 100% of the profit.') ?>
<?php Response::setMetaTitle(__('YouTubers! Take back control.')) ?>
<?php Response::setCssAssets(['/css/yt2.css']) ?>
<?php Response::setCssAssets(['/css/youtube.css']) ?>
<?php Response::addJsAsset('/js/yt2/FormValidation.js')?>
<?php Response::addJsAsset('/js/yt2/youtube_status.js') ?>
<?php Response::addJsAsset('/js/yt2/youtube_video.js')?>
<?php $statusResponse = LBRY::statusYoutube($token); ?>
<?php $statusData = $statusResponse['data'] ?>
<?php $statusData = $status_token['data'] ?>
<?php $isSyncAgreed = false ?>
<?php $isRewardClaimed = $statusData['is_reward_claimed'] ?? false ?>
<main class="channel-settings">
@ -79,7 +78,7 @@
<input type="hidden" name="status_token" id="status_token" value="<?php echo $token?>"/>
</div>
<?php
if (isset($_GET['error'])): echo "<div>" . "The following error occurred: ". $_GET['error_message'] . " For support please send an email to hello@lbry.io" . "</div>";
if ($error_message): echo "<div>" . "The following error occurred: ". $error_message . " For support please send an email to hello@lbry.io" . "</div>";
endif;?>
<div class="block">
<label for="channel-name">LBRY Channel ID</label>

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View file

@ -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);
}

View file

@ -1,31 +1,8 @@
function playVideo1(){
var myVideo = document.getElementById("video1");
if (myVideo.paused){
myVideo.play();
}
else{
myVideo.pause();
}
}
function playVideo2(){
var myVideo = document.getElementById("video2");
if (myVideo.paused){
myVideo.play();
}
else{
myVideo.pause();
}
}
function playVideo3() {
var myVideo = document.getElementById("video3");
if (myVideo.paused) {
myVideo.play();
}
else {
myVideo.pause();
}
function playVideo(id){
var myVideo = document.getElementById(id);
myVideo.play();
$('#' + id).prop("controls", true);
$('#play-' + id).hide();
}

1630
web/scss/youtube.scss Normal file

File diff suppressed because it is too large Load diff