Skip to content

Commit

Permalink
Upgraded To Abp v3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yekalkan committed Dec 25, 2017
1 parent faf1430 commit 814981b
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.2.4" />
<PackageReference Include="Abp.AutoMapper" Version="3.2.4" />
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.3.0" />
<PackageReference Include="Abp.AutoMapper" Version="3.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp" Version="3.2.4" />
<PackageReference Include="Abp" Version="3.3.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.2.4" />
<PackageReference Include="Abp.EntityFrameworkCore" Version="3.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Castle.Core" Version="4.2.1" />
<PackageReference Include="Abp.AspNetCore" Version="3.2.4" />
<PackageReference Include="Abp.Castle.Log4Net" Version="3.2.4" />
<PackageReference Include="Abp.AspNetCore" Version="3.3.0" />
<PackageReference Include="Abp.Castle.Log4Net" Version="3.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
2 changes: 1 addition & 1 deletion src/AbpCompanyName.AbpProjectName.Web/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"jquery-validation": "^1.15.0",
"blockUI": "jquery.blockUI#*",
"spin.js": "^2.3.2",
"abp-web-resources": "^3.2.2"
"abp-web-resources": "^3.3.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"authors": [
"Halil İbrahim Kalkan"
],
"version": "3.2.3",
"version": "3.3.0",
"description": "Script and style resources for ASP.NET Boilerplate based web projects.",
"main": "Abp/Framework/scripts/abp.js",
"moduleType": [],
Expand All @@ -25,13 +25,13 @@
".nuget",
"packages"
],
"_release": "3.2.3",
"_release": "3.3.0",
"_resolution": {
"type": "version",
"tag": "v3.2.3",
"commit": "5a6ff004cd1a55384dc8697dee3f06009d72e4ae"
"tag": "v3.3.0",
"commit": "c2ea86e4584fffdbfaa63ef8076e59d464a3ff20"
},
"_source": "https://github.com/aspnetboilerplate/bower-abp-resources.git",
"_target": "^3.2.2",
"_target": "^3.3.0",
"_originalSource": "abp-web-resources"
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
/* SESSION */

abp.session = abp.session ||
{
multiTenancySide: abp.multiTenancy.sides.HOST
};
{
multiTenancySide: abp.multiTenancy.sides.HOST
};

/* LOCALIZATION ***********************************************/
//Implements Localization API that simplifies usage of localization scripts generated by Abp.
Expand Down Expand Up @@ -775,6 +775,17 @@
document.cookie = cookieValue;
}

/**
* Gets the domain of given url
* @param {string} url
* @returns {string}
*/
abp.utils.getDomain = function (url) {
var domainRegex = /(https?:){0,1}\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i;
var matches = domainRegex.exec(url);
return (matches && matches[2]) ? matches[2] : '';
}

/* TIMING *****************************************/
abp.timing = abp.timing || {};

Expand Down Expand Up @@ -906,4 +917,12 @@
return abp.utils.getCookieValue(abp.security.antiForgery.tokenCookieName);
};

abp.security.antiForgery.shouldSendToken = function (settings) {
if (settings.crossDomain === undefined || settings.crossDomain === null) {
return abp.utils.getDomain(location.href) === abp.utils.getDomain(settings.url);
}

return !settings.crossDomain;
};

})(jQuery);
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@
return;
}

if (!abp.security.antiForgery.shouldSendToken(settings)) {
return;
}

if (!settings.headers || settings.headers[abp.security.antiForgery.tokenHeaderName] === undefined) {
request.setRequestHeader(abp.security.antiForgery.tokenHeaderName, token);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
var abp = abp || {};
(function () {

// Check if SignalR is defined
if (!signalR) {
return;
}

// Create namespaces
abp.signalr = abp.signalr || {};
abp.signalr.hubs = abp.signalr.hubs || {};

// Configure the connection
function configureConnection(connection) {
// Set the common hub
abp.signalr.hubs.common = connection;

// Reconnect if hub disconnects
connection.onclose(function (e) {
if (e) {
abp.log.debug('Connection closed with error: ' + e);
}
else {
abp.log.debug('Disconnected');
}

if (!abp.signalr.autoConnect) {
return;
}

setTimeout(function () {
if ($.connection.hub.state === $.signalR.connectionState.disconnected) {
$.connection.hub.start();
}
}, 5000);
});

// Register to get notifications
connection.on('getNotification', function (notification) {
abp.event.trigger('abp.notifications.received', notification);
});
}

// Connect to the server
abp.signalr.connect = function() {
var url = abp.signalr.url || '/signalr';

// Add query string: https://github.com/aspnet/SignalR/issues/680
if (abp.signalr.qs) {
url += '?' + abp.signalr.qs;
}

// Start the connection.
startConnection(url, configureConnection).then(function (connection) {
abp.log.debug('Connected to SignalR server!'); //TODO: Remove log
abp.event.trigger('abp.signalr.connected');
// Call the Register method on the hub.
connection.invoke('register').then(function () {
abp.log.debug('Registered to the SignalR server!'); //TODO: Remove log
});
})
.catch(error => {
abp.log.debug(error.message);
});
};

// Starts a connection with transport fallback - if the connection cannot be started using
// the webSockets transport the function will fallback to the serverSentEvents transport and
// if this does not work it will try longPolling. If the connection cannot be started using
// any of the available transports the function will return a rejected Promise.
function startConnection(url, configureConnection) {
return function start(transport) {
abp.log.debug(`Starting connection using ${signalR.TransportType[transport]} transport`);
var connection = new signalR.HubConnection(url, {transport: transport});
if (configureConnection && typeof configureConnection === 'function') {
configureConnection(connection);
}

return connection.start()
.then(function() {
return connection;
})
.catch(function(error) {
abp.log.debug(`Cannot start the connection using ${signalR.TransportType[transport]} transport. ${error.message}`);
if (transport !== signalR.TransportType.LongPolling) {
return start(transport + 1);
}

return Promise.reject(error);
});
}(signalR.TransportType.WebSockets);
}

abp.signalr.startConnection = startConnection;

if (abp.signalr.autoConnect === undefined) {
abp.signalr.autoConnect = true;
}

if (abp.signalr.autoConnect) {
abp.signalr.connect();
}

})();
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

let autoConnect: boolean;

let qs: string;

let url: string;

function connect(): any;

namespace hubs {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"authors": [
"Halil İbrahim Kalkan"
],
"version": "v3.2.3",
"version": "v3.3.0",
"description": "Script and style resources for ASP.NET Boilerplate based web projects.",
"main": "Abp/Framework/scripts/abp.js",
"moduleType": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "abp-web-resources",
"version": "3.2.3",
"version": "3.3.0",
"description": "ASP.NET Boilerplate web resources",
"main": "Abp/Framework/scripts/abp.js",
"dependencies": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Abp.Web.Resources" version="3.2.3" targetFramework="net461" />
<package id="Abp.Web.Resources" version="3.3.0" targetFramework="net461" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="xunit.extensibility.execution" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Shouldly" Version="2.8.3" />
<PackageReference Include="Abp.TestBase" Version="3.2.4" />
<PackageReference Include="Abp.TestBase" Version="3.3.0" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Castle.Windsor.MsDependencyInjection" Version="3.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.0.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.1" />
<PackageReference Include="Abp.AspNetCore.TestBase" Version="3.2.4" />
<PackageReference Include="Abp.AspNetCore.TestBase" Version="3.3.0" />
<PackageReference Include="AngleSharp" Version="0.9.9" />
</ItemGroup>

Expand Down

0 comments on commit 814981b

Please sign in to comment.