Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/conf/tc-nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include this file in your http block
map_hash_bucket_size 128;

upstream rss {
server tc1-rss-service.herokuapp.com:443;
## server localhost:3333;
Expand All @@ -8,15 +10,23 @@ upstream www {
server www.topcoder.com:443;
}

map $http_origin $cors_header {
default "";
"~(local|members\.local)\.(topcoder|topcoder-dev|topcoder-qa)\.com$" "$http_origin";
}

server {
listen 80;
server_name local.topcoder.com local.topcoder-dev.com local.topcoder-qa.com;
server_name members.local.topcoder.com local.topcoder.com members.local.topcoder-dev.com local.topcoder-dev.com members.local.topcoder-qa.com local.topcoder-qa.com;
charset UTF-8;

set $app_base /home/vagrant; ## CHANGE ME root apps folder reference
set $root_base $app_base/tc-site;
set $app_review_base $app_base/ap-app-review;
root $root_base/wp;

add_header 'Access-Control-Allow-Origin' "$cors_header";
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE';

client_max_body_size 20M;

Expand Down
13 changes: 12 additions & 1 deletion src/conf/tc-prod-nginx.conf
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
map_hash_bucket_size 128;

upstream rss {
server tc1-rss-service.herokuapp.com:443;
}

map $http_origin $cors_header {
default "";
"~(www|members)\.(topcoder|topcoder-dev|topcoder-qa)\.com$" "$http_origin";
}

server {
listen 80 default_server;
listen 8080 default_server;
server_name members.topcoder.com topcoder.com members.topcoder-dev.com topcoder-dev.com members.topcoder-qa.com topcoder-qa.com;
listen [::]:80 default_server ipv6only=on;
listen [::]:8080 default_server ipv6only=on;
charset UTF-8;
Expand All @@ -16,6 +24,9 @@ server {
set $root_base /home/ubuntu/tc-site;
root $root_base/wp;

add_header 'Access-Control-Allow-Origin' "$cors_header";
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE';

client_max_body_size 100M;

location = / {
Expand Down Expand Up @@ -99,4 +110,4 @@ server {
}

include /etc/nginx/drop.conf;
}
}
15 changes: 14 additions & 1 deletion src/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,23 @@ <h2>Comment Examples</h2>
<script>
(function() {
var headerApp = angular.module('tc.header', [])
headerApp.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from subdomains. Notice the difference between * and **.
'http://*.topcoder.com/**',
'https://*.topcoder.com/**',
'http://*.topcoder-qa.com/**',
'https://*.topcoder-qa.com/**',
'http://*.topcoder-dev.com/**',
'https://*.topcoder-dev.com/**'
]);
});
headerApp.directive('ngHeaderBootstrap', function(){
return {
restrict: 'C',
templateUrl: tcconfig.mainURL + '/mf/js/app/header/partials/header-nav.html',
templateUrl: '/mf/js/app/header/partials/header-nav.html',
controller: function($scope, $timeout){
$scope.vm = vm = {};
$scope.main = {};
Expand Down
1 change: 1 addition & 0 deletions src/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var myFiltersURL = tcconfig.myFiltersURL;

var siteURL = tcconfig.mainURL;

var communityURL = tcconfig.communityURL;

var base_url = tcconfig.mainURL + '/wp-content/themes/tcs-responsive'; // can use '' ?
Expand Down
15 changes: 13 additions & 2 deletions src/js/app/challenge-details/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,19 @@
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
cfpLoadingBarProvider.includeSpinner = false;
}])
.config(['$locationProvider',
function ($locationProvider) {
.config(['$locationProvider', '$sceDelegateProvider',
function ($locationProvider, $sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from subdomains. Notice the difference between * and **.
'http://*.topcoder.com/**',
'https://*.topcoder.com/**',
'http://*.topcoder-qa.com/**',
'https://*.topcoder-qa.com/**',
'http://*.topcoder-dev.com/**',
'https://*.topcoder-dev.com/**'
]);
$locationProvider.html5Mode(true);
}])
.config(DataPreProcessing);
Expand Down
6 changes: 3 additions & 3 deletions src/js/app/challenge-details/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<span>1</span> <strong>Register For This Challenge</strong>
</a>
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
ng-href="//www.{{CD.domain}}//challenges/{{CD.challenge.challengeId}}/submit/file">
ng-href="/challenges/{{CD.challenge.challengeId}}/submit/file">
<span>2</span> <strong>Submit Your Entries</strong>
</a>
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
ng-href="//studio.{{CD.domain}}/?module=ViewSubmission&ct={{CD.challenge.challengeId}}">
<span>3</span> <strong>View Your Submission</strong>
</a>
<a ng-show="!CD.isDesign && CD.isPeerReviewed" ng-class="{disabled:CD.challenge.peerReviewDisabled || !CD.callComplete, disabledNOT:!CD.challenge.peerReviewDisabled}" class="btn btnAction" ng-href="//www.{{CD.domain}}/challenges/{{CD.challenge.challengeId}}/reviews/" target="_blank">
<a ng-show="!CD.isDesign && CD.isPeerReviewed" ng-class="{disabled:CD.challenge.peerReviewDisabled || !CD.callComplete, disabledNOT:!CD.challenge.peerReviewDisabled}" class="btn btnAction" ng-href="/challenges/{{CD.challenge.challengeId}}/reviews/" target="_blank">
<span>3</span><strong>Review This Challenge</strong>
</a>
</div>
Expand Down Expand Up @@ -618,7 +618,7 @@ <h2>Reliability Rating and Bonus</h2>
<tr ng-repeat="registrant in CD.challenge.registrants | orderBy:'registrationDate'">
<td ng-class="CD.challengeType == 'design' ? 'handleColumnDesign' : 'handleColumn'">
<span>
<a ng-href="{{CD.siteURL + '/member-profile/' + registrant.handle}}" ng-bind="registrant.handle"></a>
<a ng-href="{{'/member-profile/' + registrant.handle}}" ng-bind="registrant.handle"></a>
</span>
</td>
<td ng-if="!CD.isDesign" class="ratingColumn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
}
}, function (reason) {
if (reason["error"]["details"] === "You should agree with all terms of use.") {
window.location = siteURL + "/challenge-details/terms/" + vm.challenge.challengeId + "?challenge-type=" + challengeType;
window.location = "/challenge-details/terms/" + vm.challenge.challengeId + "?challenge-type=" + challengeType;
} else if (reason["error"]["details"]) {
showError(reason["error"]["details"]);
}
Expand All @@ -218,7 +218,7 @@
path: '/',
domain: '.' + tcconfig.domain
});
$('.actionLogin').click();
$('.tc-header-login').click();
}


Expand Down
15 changes: 13 additions & 2 deletions src/js/app/challenges/module-challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@

'use strict';
var challengesModule = angular.module('tc.challenges', ['ngRoute', 'ngCookies']);
challengesModule.config(['$httpProvider', '$routeProvider', '$locationProvider',
function ($httpProvider, $routeProvider, $locationProvider) {
challengesModule.config(['$httpProvider', '$routeProvider', '$locationProvider', '$sceDelegateProvider',
function ($httpProvider, $routeProvider, $locationProvider, $sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from subdomains. Notice the difference between * and **.
'http://*.topcoder.com/**',
'https://*.topcoder.com/**',
'http://*.topcoder-qa.com/**',
'https://*.topcoder-qa.com/**',
'http://*.topcoder-dev.com/**',
'https://*.topcoder-dev.com/**'
]);

$locationProvider.html5Mode(true).hashPrefix('!');

Expand Down
2 changes: 1 addition & 1 deletion src/js/app/header/partials/header-nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</div>
<div ng-switch-when="false" class="menu-item-header">
<a href="/register" class="tc-btn tc-btn-s btn-link">JOIN</a>
<a ng-click="vm.login()" class="tc-btn tc-btn-s tc-btn-ghost btn-link">LOG IN</a>
<a ng-click="vm.login()" class="tc-btn tc-btn-s tc-btn-ghost btn-link tc-header-login">LOG IN</a>
</div>
</li>
<li ng-repeat="header in vm.menuHeaders" class="menu-item link-group">
Expand Down
16 changes: 16 additions & 0 deletions src/js/app/submission-upload/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@

.constant("API_URL", tcconfig.apiURL)

.config(['$locationProvider', '$sceDelegateProvider',
function ($locationProvider, $sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from subdomains. Notice the difference between * and **.
'http://*.topcoder.com/**',
'https://*.topcoder.com/**',
'http://*.topcoder-qa.com/**',
'https://*.topcoder-qa.com/**',
'http://*.topcoder-dev.com/**',
'https://*.topcoder-dev.com/**'
]);
$locationProvider.html5Mode(true);
}])

.config(DataPreProcessing);

DataPreProcessing.$inject = ['$httpProvider', 'RestangularProvider', 'API_URL'];
Expand Down
2 changes: 1 addition & 1 deletion src/js/challenge-detail-software.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ $(function () {
if (data["message"] === "ok") {
showModal("#registerSuccess");
} else if (data["error"]["details"] === "You should agree with all terms of use.") {
window.location = siteURL + "/challenge-details/terms/" + challengeId + "?challenge-type=" + challengeType;
window.location = "/challenge-details/terms/" + challengeId + "?challenge-type=" + challengeType;
} else if (data["error"]["details"]) {
$("#registerFailed .failedMessage").text(data["error"]["details"]);
showModal("#registerFailed");
Expand Down
15 changes: 14 additions & 1 deletion wp/wp-content/themes/tcs-responsive/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,23 @@ function _kms(u){
<script>
(function() {
var headerApp = angular.module('tc.header', [])
headerApp.config(function($sceDelegateProvider) {
$sceDelegateProvider.resourceUrlWhitelist([
// Allow same origin resource loads.
'self',
// Allow loading from subdomains. Notice the difference between * and **.
'http://*.topcoder.com/**',
'https://*.topcoder.com/**',
'http://*.topcoder-qa.com/**',
'https://*.topcoder-qa.com/**',
'http://*.topcoder-dev.com/**',
'https://*.topcoder-dev.com/**'
]);
});
headerApp.directive('ngHeaderBootstrap', function(){
return {
restrict: 'C',
templateUrl: tcconfig.mainURL + '/mf/js/app/header/partials/header-nav.html',
templateUrl: '/mf/js/app/header/partials/header-nav.html',
controller: function($scope, $timeout){
$scope.vm = vm = {};
$scope.main = {};
Expand Down
2 changes: 1 addition & 1 deletion wp/wp-content/themes/tcs-responsive/ng-page-challenges.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

function add_base_url() {
$output = "<base href=\"" . get_site_url() . "/" . ACTIVE_CONTESTS_PERMALINK . "/\" />";
$output = "<base href=\"" . "/" . ACTIVE_CONTESTS_PERMALINK . "/\" />";
echo $output;
}

Expand Down