Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote to prod #3128

Merged
merged 9 commits into from
Dec 9, 2024
140 changes: 108 additions & 32 deletions www/assets/css/account.css
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ body.theme-b {
min-height: 30px;
border-right: 1px solid rgb(204, 204, 204);
}

.upgrade-plan-feature-list li:nth-child(odd) {
background-color: #f4f4f4;
}
Expand Down Expand Up @@ -1451,6 +1452,10 @@ table.sortable th:not([aria-sort]) button:hover span::after {
text-align: left;
}

.comparison-table thead tr {
height: 1px;
}

.comparison-table thead th {
vertical-align: bottom;
}
Expand Down Expand Up @@ -1510,6 +1515,10 @@ table.sortable th:not([aria-sort]) button:hover span::after {
padding: 0.8em;
width: 25%;
}
.comparison-table tr .info {
white-space: normal;
line-height: 0.9;
}

.account-upgrade-comparison-table {
width: 100%;
Expand Down Expand Up @@ -1543,23 +1552,32 @@ table.sortable th:not([aria-sort]) button:hover span::after {
}
}

@media screen and (max-width: 768px) {
@media screen and (max-width: 968px) {
.comparison-table thead tr {
height: unset;
}

.comparison-table tr {
display: flex;
flex-flow: row wrap;
justify-content: space-around;
}

.comparison-table tr.prices td {
margin: auto;
}

.signup-step-1-content {
margin: -39px auto 0;
padding: 0;
}

.comparison-table tbody th,
.comparison-table tbody td,
.comparison-table thead th {
display: block;
width: 33%;
font-size: 1rem;
font-size: 0.9rem;
box-sizing: border-box;
position: relative;
}
Expand All @@ -1572,6 +1590,11 @@ table.sortable th:not([aria-sort]) button:hover span::after {
left: 22%;
}

.comparison-table tbody tr,
.comparison-table tbody tr:nth-child(odd) {
background-color: white;
}

.comparison-table thead th:first-child {
display: none;
}
Expand All @@ -1595,6 +1618,13 @@ table.sortable th:not([aria-sort]) button:hover span::after {
background-color: white;
display: flex;
}

.comparison-table tbody tr:last-of-type td {
height: 105px;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
}

@media screen and (max-width: 370px) {
Expand Down Expand Up @@ -1684,11 +1714,11 @@ table.sortable th:not([aria-sort]) button:hover span::after {
}

.comparison-table .signup-button > div {
line-height: 0.5;
line-height: 0.85;
}
.comparison-table .signup-button > div > small {
font-weight: 400;
font-size: small;
font-size: smaller;
}
.comparison-table .signup-button .unit,
span.unit {
Expand Down Expand Up @@ -1726,14 +1756,18 @@ tr.custom-plan-mobile {
display: inline-block;
width: auto;
}
#pro-plan-form {
margin-top: 1rem;
}
#pro-plan-form label {
width: 75px;
margin-right: 0.2rem;
text-align: right;
}
#pro-plan-form select {
width: 150px;
width: 90px;
margin-bottom: 0.2rem;
padding: 0.25em 0.75em;
}

.pro-plans .pro-plans-header,
Expand All @@ -1744,6 +1778,7 @@ tr.custom-plan-mobile {
border: 1px solid #fff;
padding: 1em;
vertical-align: top;
line-height: 1.3;
}
.card-section .pro-plans-header,
.card-section .expert-plan-header {
Expand Down Expand Up @@ -1798,17 +1833,63 @@ th.expert-plan {
padding-top: 2%;
}

@media (max-width: 1176px) {
.pro-plans form > div:not(.hidden) {
width: 47%;
.signup-hed-price {
color: #ffc830;
font-weight: 700;
font-size: 2rem;
}

.signup-special-price {
color: #ffc830;
font-weight: 700;
font-size: 1.5rem;
line-height: 1.25;
margin-bottom: 1rem;
}

@media (max-width: 700px) {
.signup-special-price {
font-size: 1.15rem;
}

#pro-plan-form {
margin-top: 0.5rem;
}

#submit-pro-plan {
white-space: normal;
line-height: 0.85;
}
}

@media (max-width: 860px) {
.pro-plans form div > *:not(.hidden) {
display: block;
width: auto;
text-align: left;
@media (max-width: 620px) {
.signup-special-price {
font-size: 0.9rem;
}

.expert-plan-header .heading {
font-size: 0.95rem;
}

#pro-plan-form label {
width: 56px;
font-size: 0.75rem;
}

#pro-plan-form select {
width: 70px;
font-size: 0.75rem;
}

span.upsell {
font-size: 0.8rem;
line-height: 1.25;
}


.comparison-table tr td,
.comparison-table tr th {
padding: 0.8em 0;
}
}

Expand Down Expand Up @@ -1917,20 +1998,6 @@ p sup {
left: -14px;
}

.signup-hed-price {
color: #ffc830;
font-weight: 700;
font-size: 2rem;
}

.signup-special-price {
color: #ffc830;
font-weight: 700;
font-size: 1.5rem;
line-height: 1.25;
margin-bottom: 1rem;
}

ul.bulleted-list {
list-style: disc;
margin-left: 2rem;
Expand Down Expand Up @@ -1973,10 +2040,9 @@ ul.bulleted-list {
background-repeat: no-repeat;
}
.comparison-table tr:last-child td:last-child .button {
display: block;
margin-top: 1rem;
display: inline-block;
}

.FAQ {
padding: 0 1.5rem 1.5rem;
}
Expand All @@ -1991,8 +2057,18 @@ ul.bulleted-list {
}

.comparison-table .signup-button {
padding: 0.7em 1em;
padding: 0.7em 0.9em;
font-size: 0.85em;
line-height: 0.9;
border-radius: 1.0rem;
}

#submit-expert-plan {
white-space: normal;
}

.signup-button {
border-radius: 1.5rem;
}
}

Expand Down Expand Up @@ -2495,4 +2571,4 @@ form:invalid button[type="submit"] {
pointer-events: none;
cursor: auto;
}
/** END APiKeyForm **/
/** END APiKeyForm **/
11 changes: 7 additions & 4 deletions www/common/AttachUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@
}
}

if ($user->isPaid() || $user->isApiUser()) {
//calculate based on paid priority
$user->setUserPriority((int)Util::getSetting('paid_priority', 0));
if ($user->isApiUser()) {
$user->setUserPriority((int) Util::getSetting('api_priority', 7));
} elseif ($user->isPaid()) {
$user->setUserPriority((int) Util::getSetting('paid_priority', 6));
} elseif ($user->isFree()) {
$user->setUserPriority((int) Util::getSetting('user_priority', 8));
} else {
$user->setUserPriority((int)Util::getSetting('user_priority', 0));
$user->setUserPriority((int) Util::getSetting('anon_priority', 9));
}

$user_email = $user->getEmail();
Expand Down
43 changes: 32 additions & 11 deletions www/runtest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
}
if (array_key_exists('resubmit', $_POST)) {
$test = GetTestInfo(trim($_POST['resubmit']));
if (array_key_exists('key', $test)){
if (array_key_exists('key', $test)) {
$test['key'] = null;
}
if ($test) {
Expand Down Expand Up @@ -221,7 +221,7 @@
$is_private = 0;

$is_private_api_call = !empty($user_api_key) && !empty($req_private) &&
((int)$req_private == 1 || $req_private == 'true');
((int)$req_private == 1 || $req_private == 'true');
$is_private_web_call = $isPaid && ($_POST['private'] == 'on');

if ($is_private_api_call || $is_private_web_call) {
Expand Down Expand Up @@ -671,7 +671,7 @@
if ((isset($test['batch']) && $test['batch']) || (isset($test['batch_locations']) && $test['batch_locations'])) {
$test['priority'] = intval(GetSetting('bulk_priority', 7));
} elseif ($_SERVER['REQUEST_METHOD'] == 'GET' || $xml || $json) {
$test['priority'] = intval(GetSetting('api_priority', 5));
$test['priority'] = intval(GetSetting('api_priority', 7));
}
}

Expand Down Expand Up @@ -900,6 +900,13 @@ function buildSelfHost($hosts)
return $selfHostScript;
}

$isFree = !is_null($request_context->getUser()) && $request_context->getUser()->isFree();

// Allow free user to run test only if email is verified
if ($isFree && !$request_context->getUser()->isVerified()) {
$errorTitle = 'Email address is not verified';
$error = 'Please verify your email address to use WebPageTest.';
}

if (!strlen($error) && CheckIp($test) && CheckUrl($test['url']) && CheckRateLimit($test, $error, $errorTitle)) {
$total_runs = Util::getRunCount($test['runs'], $test['fvonly'], $test['lighthouse'], $test['type']);
Expand Down Expand Up @@ -1628,7 +1635,7 @@ function ValidateKey(&$test, &$error, $key = null)
) {
$test['location'] = $keys[$key]['default location'];
}
$api_priority = intval(GetSetting('api_priority', 5));
$api_priority = intval(GetSetting('api_priority', 7));
$test['priority'] = $api_priority;
if (isset($keys[$key]['priority'])) {
$test['priority'] = intval($keys[$key]['priority']);
Expand Down Expand Up @@ -1719,9 +1726,8 @@ function ValidateKey(&$test, &$error, $key = null)
// Store the account info with the test
$test['accountId'] = $account['accountId'];
$test['contactId'] = $account['contactId'];
// success. See if there is a priority override for redis-based API tests
if (Util::getSetting('paid_priority')) {
$test['priority'] = intval(Util::getSetting('paid_priority'));
if (Util::getSetting('api_priority')) {
$test['priority'] = intval(Util::getSetting('api_priority'));
}
} else {
$error = 'The test request will exceed the remaining test balance for the given API key';
Expand Down Expand Up @@ -1827,9 +1833,24 @@ function ValidateParameters(&$test, $locations, &$error, $destination_url = null

// make sure on/off options are explicitly 1 or 0
$values = array(
'private', 'web10', 'ignoreSSL', 'tcpdump', 'standards', 'lighthouse',
'timeline', 'swrender', 'netlog', 'spdy3', 'noscript', 'fullsizevideo',
'blockads', 'sensitive', 'pngss', 'bodies', 'htmlbody', 'pss_advanced',
'private',
'web10',
'ignoreSSL',
'tcpdump',
'standards',
'lighthouse',
'timeline',
'swrender',
'netlog',
'spdy3',
'noscript',
'fullsizevideo',
'blockads',
'sensitive',
'pngss',
'bodies',
'htmlbody',
'pss_advanced',
'noheaders'
);
foreach ($values as $value) {
Expand Down Expand Up @@ -3555,7 +3576,7 @@ function CheckRateLimit($test, &$error, &$errorTitle)

$errorTemplate = "<p>Don't worry! You can keep testing for free once you log in, which will give you access to other excellent features like:</p>";
$errorTitleTemplate = "You've reached the limit for";

if (!$passesMonthly) {
$errorTitle = "{$errorTitleTemplate} this month";
$error = $errorTemplate;
Expand Down
5 changes: 5 additions & 0 deletions www/src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public function isPaid(): bool
($this->payment_status == 'ACTIVE' || $this->isPendingCancelation());
}

public function isFree(): bool
{
return !$this->isPaid() && !$this->isAnon();
}

public function setPaidClient(bool $is_paid): void
{
$this->is_paid_cp_client = $is_paid;
Expand Down
Loading
Loading