Skip to content

Commit 278273c

Browse files
author
welcome-dev
committed
fix(core): Remove the <base> tag.
1 parent 61021e4 commit 278273c

15 files changed

+40
-38
lines changed

modules/articles/client/config/articles.client.routes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
})
1717
.state('articles.list', {
1818
url: '',
19-
templateUrl: 'modules/articles/client/views/list-articles.client.view.html',
19+
templateUrl: '/modules/articles/client/views/list-articles.client.view.html',
2020
controller: 'ArticlesListController',
2121
controllerAs: 'vm',
2222
data: {
@@ -25,7 +25,7 @@
2525
})
2626
.state('articles.view', {
2727
url: '/:articleId',
28-
templateUrl: 'modules/articles/client/views/view-article.client.view.html',
28+
templateUrl: '/modules/articles/client/views/view-article.client.view.html',
2929
controller: 'ArticlesController',
3030
controllerAs: 'vm',
3131
resolve: {

modules/articles/client/services/articles.client.service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
ArticlesService.$inject = ['$resource', '$log'];
99

1010
function ArticlesService($resource, $log) {
11-
var Article = $resource('api/articles/:articleId', {
11+
var Article = $resource('/api/articles/:articleId', {
1212
articleId: '@_id'
1313
}, {
1414
update: {

modules/articles/tests/client/articles.client.routes.tests.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
beforeEach(inject(function ($controller, $state, $templateCache) {
6666
viewstate = $state.get('articles.view');
67-
$templateCache.put('modules/articles/client/views/view-article.client.view.html', '');
67+
$templateCache.put('/modules/articles/client/views/view-article.client.view.html', '');
6868

6969
// create mock article
7070
mockArticle = new ArticlesService({
@@ -104,7 +104,7 @@
104104
});
105105

106106
it('Should have templateUrl', function () {
107-
expect(viewstate.templateUrl).toBe('modules/articles/client/views/view-article.client.view.html');
107+
expect(viewstate.templateUrl).toBe('/modules/articles/client/views/view-article.client.view.html');
108108
});
109109
});
110110

@@ -119,7 +119,7 @@
119119
$rootScope.$digest();
120120

121121
expect($location.path()).toBe('/articles');
122-
expect($state.current.templateUrl).toBe('modules/articles/client/views/list-articles.client.view.html');
122+
expect($state.current.templateUrl).toBe('/modules/articles/client/views/list-articles.client.view.html');
123123
}));
124124
});
125125
});

modules/articles/tests/client/list-articles.client.controller.tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676

7777
it('should send a GET request and return all articles', inject(function (ArticlesService) {
7878
// Set POST response
79-
$httpBackend.expectGET('api/articles').respond(mockArticleList);
79+
$httpBackend.expectGET('/api/articles').respond(mockArticleList);
8080

8181

8282
$httpBackend.flush();

modules/chat/client/config/chat.client.routes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
$stateProvider
1212
.state('chat', {
1313
url: '/chat',
14-
templateUrl: 'modules/chat/client/views/chat.client.view.html',
14+
templateUrl: '/modules/chat/client/views/chat.client.view.html',
1515
controller: 'ChatController',
1616
controllerAs: 'vm',
1717
data: {

modules/chat/client/views/chat.client.view.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h1>Chat Example</h1>
1818
<!-- List all messages -->
1919
<li class="col-xs-12 col-md-offset-4 col-md-4 chat-message" ng-repeat="message in vm.messages">
2020
<small class="pull-right text-muted" ng-bind="message.created | date:'mediumTime'"></small>
21-
<img ng-src="{{message.profileImageURL}}" alt="{{message.username}}" class="pull-left chat-profile-image" />
21+
<img ng-src="/{{message.profileImageURL}}" alt="{{message.username}}" class="pull-left chat-profile-image" />
2222
<div class="pull-left chat-message-details">
2323
<strong ng-bind="message.username"></strong>
2424
<br>

modules/core/client/app/init.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
bootstrapConfig.$inject = ['$compileProvider', '$locationProvider', '$httpProvider', '$logProvider'];
1414

1515
function bootstrapConfig($compileProvider, $locationProvider, $httpProvider, $logProvider) {
16-
$locationProvider.html5Mode(true).hashPrefix('!');
16+
$locationProvider.html5Mode({
17+
enabled: true,
18+
requireBase: false
19+
}).hashPrefix('!');
1720

1821
$httpProvider.interceptors.push('authInterceptor');
1922

modules/core/client/config/core.client.routes.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
$stateProvider
3030
.state('home', {
3131
url: '/',
32-
templateUrl: 'modules/core/client/views/home.client.view.html',
32+
templateUrl: '/modules/core/client/views/home.client.view.html',
3333
controller: 'HomeController',
3434
controllerAs: 'vm'
3535
})
3636
.state('not-found', {
3737
url: '/not-found',
38-
templateUrl: 'modules/core/client/views/404.client.view.html',
38+
templateUrl: '/modules/core/client/views/404.client.view.html',
3939
controller: 'ErrorController',
4040
controllerAs: 'vm',
4141
params: {
@@ -50,7 +50,7 @@
5050
})
5151
.state('bad-request', {
5252
url: '/bad-request',
53-
templateUrl: 'modules/core/client/views/400.client.view.html',
53+
templateUrl: '/modules/core/client/views/400.client.view.html',
5454
controller: 'ErrorController',
5555
controllerAs: 'vm',
5656
params: {
@@ -65,7 +65,7 @@
6565
})
6666
.state('forbidden', {
6767
url: '/forbidden',
68-
templateUrl: 'modules/core/client/views/403.client.view.html',
68+
templateUrl: '/modules/core/client/views/403.client.view.html',
6969
data: {
7070
ignoreState: true,
7171
pageTitle: 'Forbidden'

modules/core/client/views/header.client.view.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ul class="nav navbar-nav navbar-right" ng-show="vm.authentication.user">
3333
<li class="dropdown" uib-dropdown>
3434
<a class="dropdown-toggle user-header-dropdown-toggle" uib-dropdown-toggle role="button">
35-
<img ng-src="{{vm.authentication.user.profileImageURL}}" alt="{{vm.authentication.user.displayName}}" class="header-profile-image" />
35+
<img ng-src="/{{vm.authentication.user.profileImageURL}}" alt="{{vm.authentication.user.displayName}}" class="header-profile-image" />
3636
<span ng-bind="vm.authentication.user.displayName"></span> <b class="caret"></b>
3737
</a>
3838
<ul class="dropdown-menu" role="menu">

modules/core/client/views/home.client.view.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="jumbotron text-center">
33
<div class="row">
44
<div class="col-md-6 col-md-offset-3 col-sm-6 col-sm-offset-3 col-xs-12">
5-
<img alt="MEAN.JS" class="img-responsive text-center" src="modules/core/client/img/brand/logo.png" />
5+
<img alt="MEAN.JS" class="img-responsive text-center" src="/modules/core/client/img/brand/logo.png" />
66
</div>
77
</div>
88
<br>

modules/core/server/views/layout.server.view.html

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
66
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
7-
<base href="/">
87
<title page-title></title>
98
<meta name="description" content="{{description}}">
109
<meta name="fragment" content="!">
@@ -29,10 +28,10 @@
2928
<meta name="twitter:image" content="{{logo}}">
3029

3130
<!-- Fav Icon -->
32-
<link href="{{favicon}}" rel="shortcut icon" type="image/x-icon">
31+
<link href="/{{favicon}}" rel="shortcut icon" type="image/x-icon">
3332

3433
<!-- Application CSS Files -->
35-
{{#each cssFiles}}<link rel="stylesheet" href="{{this}}">{{/each}}
34+
{{#each cssFiles}}<link rel="stylesheet" href="/{{this}}">{{/each}}
3635
</head>
3736

3837
<body class="ng-cloak">
@@ -64,7 +63,7 @@
6463
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
6564

6665
<!--Application JavaScript Files-->
67-
{{#each jsFiles}}<script type="text/javascript" src="{{this}}"></script>{{/each}}
66+
{{#each jsFiles}}<script type="text/javascript" src="/{{this}}"></script>{{/each}}
6867

6968
<!--owasp config sync-->
7069
<script type="text/javascript">

modules/users/client/config/users-admin.client.routes.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
$stateProvider
1313
.state('admin.users', {
1414
url: '/users',
15-
templateUrl: 'modules/users/client/views/admin/list-users.client.view.html',
15+
templateUrl: '/modules/users/client/views/admin/list-users.client.view.html',
1616
controller: 'UserListController',
1717
controllerAs: 'vm',
1818
data: {
@@ -21,7 +21,7 @@
2121
})
2222
.state('admin.user', {
2323
url: '/users/:userId',
24-
templateUrl: 'modules/users/client/views/admin/view-user.client.view.html',
24+
templateUrl: '/modules/users/client/views/admin/view-user.client.view.html',
2525
controller: 'UserController',
2626
controllerAs: 'vm',
2727
resolve: {
@@ -33,7 +33,7 @@
3333
})
3434
.state('admin.user-edit', {
3535
url: '/users/:userId/edit',
36-
templateUrl: 'modules/users/client/views/admin/edit-user.client.view.html',
36+
templateUrl: '/modules/users/client/views/admin/edit-user.client.view.html',
3737
controller: 'UserController',
3838
controllerAs: 'vm',
3939
resolve: {

modules/users/client/config/users.client.routes.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.state('settings', {
1515
abstract: true,
1616
url: '/settings',
17-
templateUrl: 'modules/users/client/views/settings/settings.client.view.html',
17+
templateUrl: '/modules/users/client/views/settings/settings.client.view.html',
1818
controller: 'SettingsController',
1919
controllerAs: 'vm',
2020
data: {
@@ -23,7 +23,7 @@
2323
})
2424
.state('settings.profile', {
2525
url: '/profile',
26-
templateUrl: 'modules/users/client/views/settings/edit-profile.client.view.html',
26+
templateUrl: '/modules/users/client/views/settings/edit-profile.client.view.html',
2727
controller: 'EditProfileController',
2828
controllerAs: 'vm',
2929
data: {
@@ -32,7 +32,7 @@
3232
})
3333
.state('settings.password', {
3434
url: '/password',
35-
templateUrl: 'modules/users/client/views/settings/change-password.client.view.html',
35+
templateUrl: '/modules/users/client/views/settings/change-password.client.view.html',
3636
controller: 'ChangePasswordController',
3737
controllerAs: 'vm',
3838
data: {
@@ -41,7 +41,7 @@
4141
})
4242
.state('settings.accounts', {
4343
url: '/accounts',
44-
templateUrl: 'modules/users/client/views/settings/manage-social-accounts.client.view.html',
44+
templateUrl: '/modules/users/client/views/settings/manage-social-accounts.client.view.html',
4545
controller: 'SocialAccountsController',
4646
controllerAs: 'vm',
4747
data: {
@@ -50,7 +50,7 @@
5050
})
5151
.state('settings.picture', {
5252
url: '/picture',
53-
templateUrl: 'modules/users/client/views/settings/change-profile-picture.client.view.html',
53+
templateUrl: '/modules/users/client/views/settings/change-profile-picture.client.view.html',
5454
controller: 'ChangeProfilePictureController',
5555
controllerAs: 'vm',
5656
data: {
@@ -60,13 +60,13 @@
6060
.state('authentication', {
6161
abstract: true,
6262
url: '/authentication',
63-
templateUrl: 'modules/users/client/views/authentication/authentication.client.view.html',
63+
templateUrl: '/modules/users/client/views/authentication/authentication.client.view.html',
6464
controller: 'AuthenticationController',
6565
controllerAs: 'vm'
6666
})
6767
.state('authentication.signup', {
6868
url: '/signup',
69-
templateUrl: 'modules/users/client/views/authentication/signup.client.view.html',
69+
templateUrl: '/modules/users/client/views/authentication/signup.client.view.html',
7070
controller: 'AuthenticationController',
7171
controllerAs: 'vm',
7272
data: {
@@ -75,7 +75,7 @@
7575
})
7676
.state('authentication.signin', {
7777
url: '/signin?err',
78-
templateUrl: 'modules/users/client/views/authentication/signin.client.view.html',
78+
templateUrl: '/modules/users/client/views/authentication/signin.client.view.html',
7979
controller: 'AuthenticationController',
8080
controllerAs: 'vm',
8181
data: {
@@ -89,7 +89,7 @@
8989
})
9090
.state('password.forgot', {
9191
url: '/forgot',
92-
templateUrl: 'modules/users/client/views/password/forgot-password.client.view.html',
92+
templateUrl: '/modules/users/client/views/password/forgot-password.client.view.html',
9393
controller: 'PasswordController',
9494
controllerAs: 'vm',
9595
data: {
@@ -103,21 +103,21 @@
103103
})
104104
.state('password.reset.invalid', {
105105
url: '/invalid',
106-
templateUrl: 'modules/users/client/views/password/reset-password-invalid.client.view.html',
106+
templateUrl: '/modules/users/client/views/password/reset-password-invalid.client.view.html',
107107
data: {
108108
pageTitle: 'Password reset invalid'
109109
}
110110
})
111111
.state('password.reset.success', {
112112
url: '/success',
113-
templateUrl: 'modules/users/client/views/password/reset-password-success.client.view.html',
113+
templateUrl: '/modules/users/client/views/password/reset-password-success.client.view.html',
114114
data: {
115115
pageTitle: 'Password reset success'
116116
}
117117
})
118118
.state('password.reset.form', {
119119
url: '/:token',
120-
templateUrl: 'modules/users/client/views/password/reset-password.client.view.html',
120+
templateUrl: '/modules/users/client/views/password/reset-password.client.view.html',
121121
controller: 'PasswordController',
122122
controllerAs: 'vm',
123123
data: {

modules/users/client/controllers/settings/change-profile-picture.client.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
vm.upload = function (dataUrl, name) {
1717

1818
Upload.upload({
19-
url: 'api/users/picture',
19+
url: '/api/users/picture',
2020
data: {
2121
newProfilePicture: Upload.dataUrltoBlob(dataUrl, name)
2222
}

modules/users/client/services/users.client.service.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
UsersService.$inject = ['$resource'];
1010

1111
function UsersService($resource) {
12-
var Users = $resource('api/users', {}, {
12+
var Users = $resource('/api/users', {}, {
1313
update: {
1414
method: 'PUT'
1515
},
@@ -78,7 +78,7 @@
7878
AdminService.$inject = ['$resource'];
7979

8080
function AdminService($resource) {
81-
return $resource('api/users/:userId', {
81+
return $resource('/api/users/:userId', {
8282
userId: '@_id'
8383
}, {
8484
update: {

0 commit comments

Comments
 (0)