Skip to content

Commit 814981b

Browse files
committed
Upgraded To Abp v3.3
1 parent faf1430 commit 814981b

File tree

15 files changed

+151
-20
lines changed

15 files changed

+151
-20
lines changed

src/AbpCompanyName.AbpProjectName.Application/AbpCompanyName.AbpProjectName.Application.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.2.4" />
21-
<PackageReference Include="Abp.AutoMapper" Version="3.2.4" />
20+
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.3.0" />
21+
<PackageReference Include="Abp.AutoMapper" Version="3.3.0" />
2222
</ItemGroup>
2323

2424
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">

src/AbpCompanyName.AbpProjectName.Core/AbpCompanyName.AbpProjectName.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Abp" Version="3.2.4" />
20+
<PackageReference Include="Abp" Version="3.3.0" />
2121
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
2222
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
2323
</ItemGroup>

src/AbpCompanyName.AbpProjectName.EntityFrameworkCore/AbpCompanyName.AbpProjectName.EntityFrameworkCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</ItemGroup>
2222

2323
<ItemGroup>
24-
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.2.4" />
24+
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.3.0" />
2525
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.1" />
2626
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
2727
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.4" />

src/AbpCompanyName.AbpProjectName.Web/AbpCompanyName.AbpProjectName.Web.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<PrivateAssets>All</PrivateAssets>
5050
</PackageReference>
5151
<PackageReference Include="Castle.Core" Version="4.2.1" />
52-
<PackageReference Include="Abp.AspNetCore" Version="3.2.4" />
53-
<PackageReference Include="Abp.Castle.Log4Net" Version="3.2.4" />
52+
<PackageReference Include="Abp.AspNetCore" Version="3.3.0" />
53+
<PackageReference Include="Abp.Castle.Log4Net" Version="3.3.0" />
5454
</ItemGroup>
5555

5656
<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">

src/AbpCompanyName.AbpProjectName.Web/bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"jquery-validation": "^1.15.0",
1414
"blockUI": "jquery.blockUI#*",
1515
"spin.js": "^2.3.2",
16-
"abp-web-resources": "^3.2.2"
16+
"abp-web-resources": "^3.3.0"
1717
}
1818
}

src/AbpCompanyName.AbpProjectName.Web/wwwroot/lib/abp-web-resources/.bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"authors": [
55
"Halil İbrahim Kalkan"
66
],
7-
"version": "3.2.3",
7+
"version": "3.3.0",
88
"description": "Script and style resources for ASP.NET Boilerplate based web projects.",
99
"main": "Abp/Framework/scripts/abp.js",
1010
"moduleType": [],
@@ -25,13 +25,13 @@
2525
".nuget",
2626
"packages"
2727
],
28-
"_release": "3.2.3",
28+
"_release": "3.3.0",
2929
"_resolution": {
3030
"type": "version",
31-
"tag": "v3.2.3",
32-
"commit": "5a6ff004cd1a55384dc8697dee3f06009d72e4ae"
31+
"tag": "v3.3.0",
32+
"commit": "c2ea86e4584fffdbfaa63ef8076e59d464a3ff20"
3333
},
3434
"_source": "https://github.com/aspnetboilerplate/bower-abp-resources.git",
35-
"_target": "^3.2.2",
35+
"_target": "^3.3.0",
3636
"_originalSource": "abp-web-resources"
3737
}

src/AbpCompanyName.AbpProjectName.Web/wwwroot/lib/abp-web-resources/Abp/Framework/scripts/abp.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
/* SESSION */
5656

5757
abp.session = abp.session ||
58-
{
59-
multiTenancySide: abp.multiTenancy.sides.HOST
60-
};
58+
{
59+
multiTenancySide: abp.multiTenancy.sides.HOST
60+
};
6161

6262
/* LOCALIZATION ***********************************************/
6363
//Implements Localization API that simplifies usage of localization scripts generated by Abp.
@@ -775,6 +775,17 @@
775775
document.cookie = cookieValue;
776776
}
777777

778+
/**
779+
* Gets the domain of given url
780+
* @param {string} url
781+
* @returns {string}
782+
*/
783+
abp.utils.getDomain = function (url) {
784+
var domainRegex = /(https?:){0,1}\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i;
785+
var matches = domainRegex.exec(url);
786+
return (matches && matches[2]) ? matches[2] : '';
787+
}
788+
778789
/* TIMING *****************************************/
779790
abp.timing = abp.timing || {};
780791

@@ -906,4 +917,12 @@
906917
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
907918
};
908919

920+
abp.security.antiForgery.shouldSendToken = function (settings) {
921+
if (settings.crossDomain === undefined || settings.crossDomain === null) {
922+
return abp.utils.getDomain(location.href) === abp.utils.getDomain(settings.url);
923+
}
924+
925+
return !settings.crossDomain;
926+
};
927+
909928
})(jQuery);

src/AbpCompanyName.AbpProjectName.Web/wwwroot/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.jquery.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@
195195
return;
196196
}
197197

198+
if (!abp.security.antiForgery.shouldSendToken(settings)) {
199+
return;
200+
}
201+
198202
if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) {
199203
request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token);
200204
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
var abp = abp || {};
2+
(function () {
3+
4+
// Check if SignalR is defined
5+
if (!signalR) {
6+
return;
7+
}
8+
9+
// Create namespaces
10+
abp.signalr = abp.signalr || {};
11+
abp.signalr.hubs = abp.signalr.hubs || {};
12+
13+
// Configure the connection
14+
function configureConnection(connection) {
15+
// Set the common hub
16+
abp.signalr.hubs.common = connection;
17+
18+
// Reconnect if hub disconnects
19+
connection.onclose(function (e) {
20+
if (e) {
21+
abp.log.debug('Connection closed with error: ' + e);
22+
}
23+
else {
24+
abp.log.debug('Disconnected');
25+
}
26+
27+
if (!abp.signalr.autoConnect) {
28+
return;
29+
}
30+
31+
setTimeout(function () {
32+
if ($.connection.hub.state === $.signalR.connectionState.disconnected) {
33+
$.connection.hub.start();
34+
}
35+
}, 5000);
36+
});
37+
38+
// Register to get notifications
39+
connection.on('getNotification', function (notification) {
40+
abp.event.trigger('abp.notifications.received', notification);
41+
});
42+
}
43+
44+
// Connect to the server
45+
abp.signalr.connect = function() {
46+
var url = abp.signalr.url || '/signalr';
47+
48+
// Add query string: https://github.com/aspnet/SignalR/issues/680
49+
if (abp.signalr.qs) {
50+
url += '?' + abp.signalr.qs;
51+
}
52+
53+
// Start the connection.
54+
startConnection(url, configureConnection).then(function (connection) {
55+
abp.log.debug('Connected to SignalR server!'); //TODO: Remove log
56+
abp.event.trigger('abp.signalr.connected');
57+
// Call the Register method on the hub.
58+
connection.invoke('register').then(function () {
59+
abp.log.debug('Registered to the SignalR server!'); //TODO: Remove log
60+
});
61+
})
62+
.catch(error => {
63+
abp.log.debug(error.message);
64+
});
65+
};
66+
67+
// Starts a connection with transport fallback - if the connection cannot be started using
68+
// the webSockets transport the function will fallback to the serverSentEvents transport and
69+
// if this does not work it will try longPolling. If the connection cannot be started using
70+
// any of the available transports the function will return a rejected Promise.
71+
function startConnection(url, configureConnection) {
72+
return function start(transport) {
73+
abp.log.debug(`Starting connection using ${signalR.TransportType[transport]} transport`);
74+
var connection = new signalR.HubConnection(url, {transport: transport});
75+
if (configureConnection && typeof configureConnection === 'function') {
76+
configureConnection(connection);
77+
}
78+
79+
return connection.start()
80+
.then(function() {
81+
return connection;
82+
})
83+
.catch(function(error) {
84+
abp.log.debug(`Cannot start the connection using ${signalR.TransportType[transport]} transport. ${error.message}`);
85+
if (transport !== signalR.TransportType.LongPolling) {
86+
return start(transport + 1);
87+
}
88+
89+
return Promise.reject(error);
90+
});
91+
}(signalR.TransportType.WebSockets);
92+
}
93+
94+
abp.signalr.startConnection = startConnection;
95+
96+
if (abp.signalr.autoConnect === undefined) {
97+
abp.signalr.autoConnect = true;
98+
}
99+
100+
if (abp.signalr.autoConnect) {
101+
abp.signalr.connect();
102+
}
103+
104+
})();

src/AbpCompanyName.AbpProjectName.Web/wwwroot/lib/abp-web-resources/Abp/Framework/scripts/libs/abp.signalr.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
let autoConnect: boolean;
66

7+
let qs: string;
8+
9+
let url: string;
10+
711
function connect(): any;
812

913
namespace hubs {

0 commit comments

Comments
 (0)