diff --git a/controller/Controller.class.php b/controller/Controller.class.php index ee44e90e..55d38dcf 100644 --- a/controller/Controller.class.php +++ b/controller/Controller.class.php @@ -98,7 +98,8 @@ class Controller $router->any('/dmca', 'ReportActions::executeDmca'); $router->any('/youtube/thanks', 'AcquisitionActions::executeThanks'); - $router->any('/youtube/sub', 'ReportActions::executeYoutubeSub'); + $router->any('/youtube/sub', 'AcquisitionActions::executeYouTubeSub'); + $router->any('/youtube/{campaignId:c}?', 'AcquisitionActions::executeYouTube'); $router->post('/set-culture', 'i18nActions::setCulture'); diff --git a/controller/Request.class.php b/controller/Request.class.php index 84fbd0d2..7a2f0a8a 100644 --- a/controller/Request.class.php +++ b/controller/Request.class.php @@ -74,6 +74,18 @@ class Request return static::getHttpHeader('User-Agent') ?? ''; } + public static function getRoutingUri() + { + $host = preg_replace('/^www\./', '', $_SERVER['HTTP_HOST']); + switch($host) + { + case 'betteryoutube.com': + case 'lbrycreators.com': + return '/youtube'; + } + return static::getRelativeUri(); + } + public static function getHost(): string { // apparently trailing period is legal: http://www.dns-sd.org/TrailingDotsInDomainNames.html @@ -95,6 +107,11 @@ class Request return static::getHeader('SERVER_NAME'); } + public static function getReferrer(string $fallback = '/') + { + return Request::getHttpHeader('Referer', $fallback); + } + public static function getRelativeUri(): string { return static::getHeader('REQUEST_URI') ? parse_url(static::getHeader('REQUEST_URI'), PHP_URL_PATH) : ''; diff --git a/controller/action/AcquisitionActions.class.php b/controller/action/AcquisitionActions.class.php index 1f193a26..adc6e1a0 100644 --- a/controller/action/AcquisitionActions.class.php +++ b/controller/action/AcquisitionActions.class.php @@ -6,4 +6,37 @@ class AcquisitionActions extends Actions { return ['acquisition/thanks']; } + + + public static function executeYouTubeSub() + { + if (!Request::isPost()) + { + return Controller::redirect('/youtube'); + } + + $email = Request::getPostParam('email'); + + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) + { + Session::setFlash('error', 'Please enter a valid email.'); + return Controller::redirect('/youtube'); + } + + Mailgun::sendYouTubeWarmLead(['email' => $email]); + + Session::setFlash('success', 'Thanks! We\'ll be in touch. The good kind of touch.'); + + return Controller::redirect(Request::getReferrer(), 303); + } + + public static function executeYouTube(string $campaignId = '') + { + $template = 'acquisition/youtube' . ($campaignId ? '-' . $campaignId : ''); + if (!View::exists($template)) + { + return NavActions::execute404(); + } + return [$template]; + } } \ No newline at end of file diff --git a/controller/action/ReportActions.class.php b/controller/action/ReportActions.class.php index 2acb1211..6ff6c68a 100644 --- a/controller/action/ReportActions.class.php +++ b/controller/action/ReportActions.class.php @@ -38,24 +38,4 @@ class ReportActions extends Actions return ['report/dmca', ['errors' => $errors, 'values' => $values]]; } - - public static function executeYouTubeSub() - { - if (!Request::isPost()) - { - return Controller::redirect('/youtube'); - } - - $email = Request::getPostParam('email'); - - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) - { - Session::setFlash('error', 'Please enter a valid email.'); - return Controller::redirect('/youtube'); - } - - Mailgun::sendYouTubeWarmLead(['email' => $email]); - - return Controller::redirect(Request::getRelativeUri(), 303); - } } \ No newline at end of file diff --git a/controller/action/i18nActions.class.php b/controller/action/i18nActions.class.php index 014fea47..e8de8f8b 100644 --- a/controller/action/i18nActions.class.php +++ b/controller/action/i18nActions.class.php @@ -24,6 +24,6 @@ class i18nActions extends Actions //if session changes update domain //english language = www - return Controller::redirect(Request::getHttpHeader('Referer', '/')); + return Controller::redirect(Request::getReferrer()); } } diff --git a/lib/thirdparty/Mailgun.class.php b/lib/thirdparty/Mailgun.class.php index 9703c461..7e2821b8 100644 --- a/lib/thirdparty/Mailgun.class.php +++ b/lib/thirdparty/Mailgun.class.php @@ -50,7 +50,7 @@ class Mailgun { list($status, $headers, $body) = static::post('/' . static::MAIL_DOMAIN . '/messages', [ 'from' => 'LBRY ', - 'to' => 'reilly@lbry.io', + 'to' => 'jeremy@lbry.io', 'subject' => 'Interested YouTuber', 'html' => '
' . var_export($data, true) . '
', 'o:tracking-clicks' => 'no', diff --git a/view/template/page/youtube.php b/view/template/acquisition/youtube-a.php similarity index 100% rename from view/template/page/youtube.php rename to view/template/acquisition/youtube-a.php diff --git a/view/template/acquisition/youtube.php b/view/template/acquisition/youtube.php new file mode 100644 index 00000000..c12f6b87 --- /dev/null +++ b/view/template/acquisition/youtube.php @@ -0,0 +1,95 @@ + + + true, 'isAbsolute' => true]) ?> +
+ +
+
+ +

+ YouTube Creator?
+ Take Back Control. +

+
+ Join thousands of other creators in a world where your content is made available directly to your audience, free of censorship and corporate influence. +
+ +
+
+
+

+ LBRY +

+
+ ['Community Run', 'Share (and optionally monetize) your content via a network powered entirely by users themselves.'], + 'icon-cubes' => ['Blockchain', 'The power of decentralized consensus allows your content to be discovered and accessed by anyone in the world -- on your terms.'], + 'icon-thumbs-up' => ['Take Control', 'Publish your content with whatever terms, price, and quality you desire. Update, re-release, and unpublish at any time.'], + 'icon-money' => ['Make More', 'You control whether your content is free or paid. If paid, you get 100% of the price.'], + 'icon-lock' => ['Secure', 'Made with encryption and love by dozens of bright contributors from MIT, CMU, RPI, Udacity, Dyn and more.'], + 'icon-code' => ['Open Source', 'Entirely open-source and permissively licensed (MIT). Maintained by stewards, not overlords.'], + //Easy + ] as $iconClass => $copyTuple): ?> + +
+
+
+
+ +
+
+

+

+ +

+
+
+ +
+
+
+
+
+
+

I'm in.

+
    +
  1. + Clicking below will authenticate with YouTube and grant permission for your content to be available on the decentralized LBRY network. + You may revoke this permission and unpublish* your content at any time. +
  2. +
  3. + Our team will automate publishing your content to LBRY. When it's done, you'll receive a notification and a login to review, update, and manage it. +
  4. +
+ +
*Unpublishing means removing the ability to decrypt and accessing your content via LBRY, but we cannot guarantee the deletion of all encrypted data.
+
+
+
+
+
+
+

I Have Questions

+

+ Schedule a meeting with Reilly, one of LBRY's founders and an experienced producer. + Or, email him directly. +

+
+ 'email', + 'type' => 'email', + 'label' => 'Email', + 'required' => true, + ]) ?> + +
+ 'reilly-smith-youtube', 'orientation' => 'horizontal']) ?> +
+
+
+
+ diff --git a/view/template/layout/basic.php b/view/template/layout/basic.php index d2e34168..849d24b3 100644 --- a/view/template/layout/basic.php +++ b/view/template/layout/basic.php @@ -51,7 +51,7 @@ - +
diff --git a/view/template/nav/_flashes.php b/view/template/nav/_flashes.php new file mode 100644 index 00000000..0b9ec494 --- /dev/null +++ b/view/template/nav/_flashes.php @@ -0,0 +1,8 @@ + + + + +
+ +
+ \ No newline at end of file diff --git a/view/template/report/dmca.php b/view/template/report/dmca.php index 77cd0003..f406e38c 100644 --- a/view/template/report/dmca.php +++ b/view/template/report/dmca.php @@ -9,49 +9,48 @@

{{dmca.header}}


- -
- -
- 'name', - 'value' => $values['name'] ?? null, - 'error' => $errors['name'] ?? null, - 'label' => __('dmca.form_labels.name'), - 'required' => true, - ]) ?> + + + + 'name', + 'value' => $values['name'] ?? null, + 'error' => $errors['name'] ?? null, + 'label' => __('dmca.form_labels.name'), + 'required' => true, + ]) ?> - 'rightsholder', - 'value' => $values['rightsholder'] ?? null, - 'error' => $errors['rightsholder'] ?? null, - 'label' => __('dmca.form_labels.rightsholder'), - 'help' => __('dmca.form_help.rightsholder'), - 'required' => true, - ]) ?> + 'rightsholder', + 'value' => $values['rightsholder'] ?? null, + 'error' => $errors['rightsholder'] ?? null, + 'label' => __('dmca.form_labels.rightsholder'), + 'help' => __('dmca.form_help.rightsholder'), + 'required' => true, + ]) ?> - 'email', - 'type' => 'email', - 'value' => $values['email'] ?? null, - 'error' => $errors['email'] ?? null, - 'label' => __('dmca.form_labels.email'), - 'help' => __('dmca.form_help.email'), - 'required' => true, - ]) ?> + 'email', + 'type' => 'email', + 'value' => $values['email'] ?? null, + 'error' => $errors['email'] ?? null, + 'label' => __('dmca.form_labels.email'), + 'help' => __('dmca.form_help.email'), + 'required' => true, + ]) ?> - 'identifier', - 'value' => $values['identifier'] ?? null, - 'error' => $errors['identifier'] ?? null, - 'label' => __('dmca.form_labels.identifier'), - 'help' => __('dmca.form_help.identifier'), - 'required' => true, - ]) ?> + 'identifier', + 'value' => $values['identifier'] ?? null, + 'error' => $errors['identifier'] ?? null, + 'label' => __('dmca.form_labels.identifier'), + 'help' => __('dmca.form_help.identifier'), + 'required' => true, + ]) ?> + + +
- - -
diff --git a/web/index.php b/web/index.php index 3122f26d..d24cf0af 100644 --- a/web/index.php +++ b/web/index.php @@ -31,7 +31,7 @@ try { View::compileCss(); } - Controller::dispatch(Request::getRelativeUri()); + Controller::dispatch(Request::getRoutingUri()); } catch(Throwable $e) {