Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 9405986

Browse files
authored
Merge pull request #331 from appirio-tech/dev
Merging dev into master (members.topcoder.com updates)
2 parents 9ad643a + 6437a28 commit 9405986

File tree

13 files changed

+102
-16
lines changed

13 files changed

+102
-16
lines changed

src/conf/tc-nginx.conf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#include this file in your http block
2+
map_hash_bucket_size 128;
3+
24
upstream rss {
35
server tc1-rss-service.herokuapp.com:443;
46
## server localhost:3333;
@@ -8,15 +10,23 @@ upstream www {
810
server www.topcoder.com:443;
911
}
1012

13+
map $http_origin $cors_header {
14+
default "";
15+
"~(local|members\.local)\.(topcoder|topcoder-dev|topcoder-qa)\.com$" "$http_origin";
16+
}
17+
1118
server {
1219
listen 80;
13-
server_name local.topcoder.com local.topcoder-dev.com local.topcoder-qa.com;
20+
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;
1421
charset UTF-8;
1522

1623
set $app_base /home/vagrant; ## CHANGE ME root apps folder reference
1724
set $root_base $app_base/tc-site;
1825
set $app_review_base $app_base/ap-app-review;
1926
root $root_base/wp;
27+
28+
add_header 'Access-Control-Allow-Origin' "$cors_header";
29+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE';
2030

2131
client_max_body_size 20M;
2232

src/conf/tc-prod-nginx.conf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
map_hash_bucket_size 128;
2+
13
upstream rss {
24
server tc1-rss-service.herokuapp.com:443;
35
}
46

7+
map $http_origin $cors_header {
8+
default "";
9+
"~(www|members)\.(topcoder|topcoder-dev|topcoder-qa)\.com$" "$http_origin";
10+
}
11+
512
server {
613
listen 80 default_server;
714
listen 8080 default_server;
15+
server_name members.topcoder.com topcoder.com members.topcoder-dev.com topcoder-dev.com members.topcoder-qa.com topcoder-qa.com;
816
listen [::]:80 default_server ipv6only=on;
917
listen [::]:8080 default_server ipv6only=on;
1018
charset UTF-8;
@@ -16,6 +24,9 @@ server {
1624
set $root_base /home/ubuntu/tc-site;
1725
root $root_base/wp;
1826

27+
add_header 'Access-Control-Allow-Origin' "$cors_header";
28+
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, PATCH, DELETE';
29+
1930
client_max_body_size 100M;
2031

2132
location = / {
@@ -99,4 +110,4 @@ server {
99110
}
100111

101112
include /etc/nginx/drop.conf;
102-
}
113+
}

src/footer.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,23 @@ <h2>Comment Examples</h2>
153153
<script>
154154
(function() {
155155
var headerApp = angular.module('tc.header', [])
156+
headerApp.config(function($sceDelegateProvider) {
157+
$sceDelegateProvider.resourceUrlWhitelist([
158+
// Allow same origin resource loads.
159+
'self',
160+
// Allow loading from subdomains. Notice the difference between * and **.
161+
'http://*.topcoder.com/**',
162+
'https://*.topcoder.com/**',
163+
'http://*.topcoder-qa.com/**',
164+
'https://*.topcoder-qa.com/**',
165+
'http://*.topcoder-dev.com/**',
166+
'https://*.topcoder-dev.com/**'
167+
]);
168+
});
156169
headerApp.directive('ngHeaderBootstrap', function(){
157170
return {
158171
restrict: 'C',
159-
templateUrl: tcconfig.mainURL + '/mf/js/app/header/partials/header-nav.html',
172+
templateUrl: '/mf/js/app/header/partials/header-nav.html',
160173
controller: function($scope, $timeout){
161174
$scope.vm = vm = {};
162175
$scope.main = {};

src/header.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var myFiltersURL = tcconfig.myFiltersURL;
2424

2525
var siteURL = tcconfig.mainURL;
26+
2627
var communityURL = tcconfig.communityURL;
2728

2829
var base_url = tcconfig.mainURL + '/wp-content/themes/tcs-responsive'; // can use '' ?

src/js/app/challenge-details/app.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,19 @@
3333
.config(['cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
3434
cfpLoadingBarProvider.includeSpinner = false;
3535
}])
36-
.config(['$locationProvider',
37-
function ($locationProvider) {
36+
.config(['$locationProvider', '$sceDelegateProvider',
37+
function ($locationProvider, $sceDelegateProvider) {
38+
$sceDelegateProvider.resourceUrlWhitelist([
39+
// Allow same origin resource loads.
40+
'self',
41+
// Allow loading from subdomains. Notice the difference between * and **.
42+
'http://*.topcoder.com/**',
43+
'https://*.topcoder.com/**',
44+
'http://*.topcoder-qa.com/**',
45+
'https://*.topcoder-qa.com/**',
46+
'http://*.topcoder-dev.com/**',
47+
'https://*.topcoder-dev.com/**'
48+
]);
3849
$locationProvider.html5Mode(true);
3950
}])
4051
.config(DataPreProcessing);

src/js/app/challenge-details/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
<span>1</span> <strong>Register For This Challenge</strong>
2323
</a>
2424
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
25-
ng-href="//www.{{CD.domain}}//challenges/{{CD.challenge.challengeId}}/submit/file">
25+
ng-href="/challenges/{{CD.challenge.challengeId}}/submit/file">
2626
<span>2</span> <strong>Submit Your Entries</strong>
2727
</a>
2828
<a ng-show="CD.isDesign" ng-class="{disabled:CD.challenge.submissionDisabled || !CD.callComplete, disabledNOT:!CD.challenge.submissionDisabled}" class="btn btnAction" target="_blank"
2929
ng-href="//studio.{{CD.domain}}/?module=ViewSubmission&ct={{CD.challenge.challengeId}}">
3030
<span>3</span> <strong>View Your Submission</strong>
3131
</a>
32-
<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">
32+
<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">
3333
<span>3</span><strong>Review This Challenge</strong>
3434
</a>
3535
</div>
@@ -618,7 +618,7 @@ <h2>Reliability Rating and Bonus</h2>
618618
<tr ng-repeat="registrant in CD.challenge.registrants | orderBy:'registrationDate'">
619619
<td ng-class="CD.challengeType == 'design' ? 'handleColumnDesign' : 'handleColumn'">
620620
<span>
621-
<a ng-href="{{CD.siteURL + '/member-profile/' + registrant.handle}}" ng-bind="registrant.handle"></a>
621+
<a ng-href="{{'/member-profile/' + registrant.handle}}" ng-bind="registrant.handle"></a>
622622
</span>
623623
</td>
624624
<td ng-if="!CD.isDesign" class="ratingColumn">

src/js/app/challenge-details/js/controllers/challenge-details-controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
}
204204
}, function (reason) {
205205
if (reason["error"]["details"] === "You should agree with all terms of use.") {
206-
window.location = siteURL + "/challenge-details/terms/" + vm.challenge.challengeId + "?challenge-type=" + challengeType;
206+
window.location = "/challenge-details/terms/" + vm.challenge.challengeId + "?challenge-type=" + challengeType;
207207
} else if (reason["error"]["details"]) {
208208
showError(reason["error"]["details"]);
209209
}
@@ -218,7 +218,7 @@
218218
path: '/',
219219
domain: '.' + tcconfig.domain
220220
});
221-
$('.actionLogin').click();
221+
$('.tc-header-login').click();
222222
}
223223

224224

src/js/app/challenges/module-challenges.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,19 @@
33

44
'use strict';
55
var challengesModule = angular.module('tc.challenges', ['ngRoute', 'ngCookies']);
6-
challengesModule.config(['$httpProvider', '$routeProvider', '$locationProvider',
7-
function ($httpProvider, $routeProvider, $locationProvider) {
6+
challengesModule.config(['$httpProvider', '$routeProvider', '$locationProvider', '$sceDelegateProvider',
7+
function ($httpProvider, $routeProvider, $locationProvider, $sceDelegateProvider) {
8+
$sceDelegateProvider.resourceUrlWhitelist([
9+
// Allow same origin resource loads.
10+
'self',
11+
// Allow loading from subdomains. Notice the difference between * and **.
12+
'http://*.topcoder.com/**',
13+
'https://*.topcoder.com/**',
14+
'http://*.topcoder-qa.com/**',
15+
'https://*.topcoder-qa.com/**',
16+
'http://*.topcoder-dev.com/**',
17+
'https://*.topcoder-dev.com/**'
18+
]);
819

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

src/js/app/header/partials/header-nav.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</div>
4242
<div ng-switch-when="false" class="menu-item-header">
4343
<a href="/register" class="tc-btn tc-btn-s btn-link">JOIN</a>
44-
<a ng-click="vm.login()" class="tc-btn tc-btn-s tc-btn-ghost btn-link">LOG IN</a>
44+
<a ng-click="vm.login()" class="tc-btn tc-btn-s tc-btn-ghost btn-link tc-header-login">LOG IN</a>
4545
</div>
4646
</li>
4747
<li ng-repeat="header in vm.menuHeaders" class="menu-item link-group">

src/js/app/submission-upload/app.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@
2525

2626
.constant("API_URL", tcconfig.apiURL)
2727

28+
.config(['$locationProvider', '$sceDelegateProvider',
29+
function ($locationProvider, $sceDelegateProvider) {
30+
$sceDelegateProvider.resourceUrlWhitelist([
31+
// Allow same origin resource loads.
32+
'self',
33+
// Allow loading from subdomains. Notice the difference between * and **.
34+
'http://*.topcoder.com/**',
35+
'https://*.topcoder.com/**',
36+
'http://*.topcoder-qa.com/**',
37+
'https://*.topcoder-qa.com/**',
38+
'http://*.topcoder-dev.com/**',
39+
'https://*.topcoder-dev.com/**'
40+
]);
41+
$locationProvider.html5Mode(true);
42+
}])
43+
2844
.config(DataPreProcessing);
2945

3046
DataPreProcessing.$inject = ['$httpProvider', 'RestangularProvider', 'API_URL'];

src/js/challenge-detail-software.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ $(function () {
389389
if (data["message"] === "ok") {
390390
showModal("#registerSuccess");
391391
} else if (data["error"]["details"] === "You should agree with all terms of use.") {
392-
window.location = siteURL + "/challenge-details/terms/" + challengeId + "?challenge-type=" + challengeType;
392+
window.location = "/challenge-details/terms/" + challengeId + "?challenge-type=" + challengeType;
393393
} else if (data["error"]["details"]) {
394394
$("#registerFailed .failedMessage").text(data["error"]["details"]);
395395
showModal("#registerFailed");

wp/wp-content/themes/tcs-responsive/footer.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,23 @@ function _kms(u){
239239
<script>
240240
(function() {
241241
var headerApp = angular.module('tc.header', [])
242+
headerApp.config(function($sceDelegateProvider) {
243+
$sceDelegateProvider.resourceUrlWhitelist([
244+
// Allow same origin resource loads.
245+
'self',
246+
// Allow loading from subdomains. Notice the difference between * and **.
247+
'http://*.topcoder.com/**',
248+
'https://*.topcoder.com/**',
249+
'http://*.topcoder-qa.com/**',
250+
'https://*.topcoder-qa.com/**',
251+
'http://*.topcoder-dev.com/**',
252+
'https://*.topcoder-dev.com/**'
253+
]);
254+
});
242255
headerApp.directive('ngHeaderBootstrap', function(){
243256
return {
244257
restrict: 'C',
245-
templateUrl: tcconfig.mainURL + '/mf/js/app/header/partials/header-nav.html',
258+
templateUrl: '/mf/js/app/header/partials/header-nav.html',
246259
controller: function($scope, $timeout){
247260
$scope.vm = vm = {};
248261
$scope.main = {};

wp/wp-content/themes/tcs-responsive/ng-page-challenges.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020

2121
function add_base_url() {
22-
$output = "<base href=\"" . get_site_url() . "/" . ACTIVE_CONTESTS_PERMALINK . "/\" />";
22+
$output = "<base href=\"" . "/" . ACTIVE_CONTESTS_PERMALINK . "/\" />";
2323
echo $output;
2424
}
2525

0 commit comments

Comments
 (0)