diff --git a/public/js/page-controller/group-controller.js b/public/js/page-controller/group-controller.js index be962aa..e5fcaf4 100644 --- a/public/js/page-controller/group-controller.js +++ b/public/js/page-controller/group-controller.js @@ -4,6 +4,7 @@ const DataIdCreator = require("../publish/dataid-creator"); const QueryBuilder = require("../query-builder/query-builder"); const QueryNode = require("../query-builder/query-node"); const QueryTemplates = require("../query-builder/query-templates"); +const DatabusConstants = require("../utils/databus-constants"); const DatabusUtils = require("../utils/databus-utils"); const DatabusWebappUtils = require("../utils/databus-webapp-utils"); const TabNavigation = require("../utils/tab-navigation"); @@ -143,7 +144,7 @@ function GroupPageController($scope, $http, $sce, $interval, $location, collecti $scope.fileSelector.config.columns.push({ field: 'compression', label: 'Compression', width: '6%' }); $scope.groupNode = new QueryNode($scope.group.uri, 'databus:group'); - $scope.groupNode.setFacet('http://purl.org/dc/terms/hasVersion', '$latest', true); + $scope.groupNode.setFacet('http://purl.org/dc/terms/hasVersion', DatabusConstants.FACET_LATEST_VERSION_VALUE, true); $scope.onFacetSettingsChanged = function () { $scope.fileSelector.query = QueryBuilder.build({ diff --git a/server/app/api/module.js b/server/app/api/module.js index 6ac9f94..db24f13 100644 --- a/server/app/api/module.js +++ b/server/app/api/module.js @@ -1,3 +1,4 @@ +const getLinkedData = require('../common/get-linked-data.js'); const ServerUtils = require('../common/utils/server-utils.js'); var cors = require('cors'); @@ -18,5 +19,4 @@ module.exports = function (router, protector, locals, webdav) { }); - } \ No newline at end of file diff --git a/server/app/api/routes/account.js b/server/app/api/routes/account.js index d6e127b..24033ad 100644 --- a/server/app/api/routes/account.js +++ b/server/app/api/routes/account.js @@ -21,6 +21,7 @@ const Constants = require('../../common/constants'); const UriUtils = require('../../common/utils/uri-utils'); const DatabusConstants = require('../../../../public/js/utils/databus-constants'); const publishAccount = require('../lib/publish-account'); +var cors = require('cors'); module.exports = function (router, protector) { @@ -403,7 +404,7 @@ module.exports = function (router, protector) { }); /* GET an account. */ - router.get('/:account', ServerUtils.NOT_HTML_ACCEPTED, async function (req, res, next) { + router.get('/:account', ServerUtils.NOT_HTML_ACCEPTED, cors(), async function (req, res, next) { if (req.params.account.length < 4) { next('route'); diff --git a/server/app/api/routes/artifact.js b/server/app/api/routes/artifact.js index 48747b3..c68aa82 100644 --- a/server/app/api/routes/artifact.js +++ b/server/app/api/routes/artifact.js @@ -10,6 +10,7 @@ const publishArtifact = require('../lib/publish-artifact'); const defaultContext = require('../../common/res/context.jsonld'); const getLinkedData = require("../../common/get-linked-data"); const jsonld = require('jsonld'); +var cors = require('cors'); const sparql = require("../../common/queries/sparql"); @@ -66,7 +67,7 @@ module.exports = function (router, protector) { } }); - router.get('/:account/:group/:artifact', ServerUtils.NOT_HTML_ACCEPTED, async function (req, res, next) { + router.get('/:account/:group/:artifact', ServerUtils.NOT_HTML_ACCEPTED, cors(), async function (req, res, next) { if (req.params.account.length < 4) { next('route'); diff --git a/server/app/api/routes/collection.js b/server/app/api/routes/collection.js index 59de9d9..0f93cd6 100644 --- a/server/app/api/routes/collection.js +++ b/server/app/api/routes/collection.js @@ -16,6 +16,7 @@ var defaultContext = require('./../../common/res/context.jsonld'); const DatabusConstants = require('../../../../public/js/utils/databus-constants'); const DatabusUtils = require('../../../../public/js/utils/databus-utils'); const DatabusMessage = require('../../common/databus-message'); +var cors = require('cors'); module.exports = function (router, protector) { @@ -185,7 +186,7 @@ module.exports = function (router, protector) { } }); - router.get('/:account/collections/:collection', ServerUtils.SPARQL_ACCEPTED, async function (req, res, next) { + router.get('/:account/collections/:collection', ServerUtils.SPARQL_ACCEPTED, cors(), async function (req, res, next) { sparql.collections.getCollectionQuery(req.params.account, req.params.collection).then(function (result) { if (result != null) { @@ -199,7 +200,7 @@ module.exports = function (router, protector) { }); }); - router.get('/:account/collections/:collection', ServerUtils.NOT_HTML_ACCEPTED, function (req, res, next) { + router.get('/:account/collections/:collection', ServerUtils.NOT_HTML_ACCEPTED, cors(), function (req, res, next) { if (req.params.account.length < 4) { next('route'); diff --git a/server/app/api/routes/group.js b/server/app/api/routes/group.js index 9db1133..93f963f 100644 --- a/server/app/api/routes/group.js +++ b/server/app/api/routes/group.js @@ -9,6 +9,7 @@ const publishGroup = require('../lib/publish-group'); const jsonld = require('jsonld'); const getLinkedData = require("../../common/get-linked-data"); const defaultContext = require('../../common/res/context.jsonld'); +var cors = require('cors'); const sparql = require("../../common/queries/sparql"); @@ -57,7 +58,7 @@ module.exports = function (router, protector) { } }); - router.get('/:account/:group', ServerUtils.NOT_HTML_ACCEPTED, async function (req, res, next) { + router.get('/:account/:group', ServerUtils.NOT_HTML_ACCEPTED, cors(), async function (req, res, next) { if (req.params.account.length < 4) { next('route'); diff --git a/server/app/api/routes/version.js b/server/app/api/routes/version.js index 28961d7..acc41ed 100644 --- a/server/app/api/routes/version.js +++ b/server/app/api/routes/version.js @@ -13,6 +13,8 @@ const getLinkedData = require('../../common/get-linked-data.js'); const DatabusLogger = require('../../common/databus-logger.js'); const JsonldUtils = require('../../../../public/js/utils/jsonld-utils.js'); const jsonld = require('jsonld'); +var cors = require('cors'); + module.exports = function (router, protector) { @@ -58,7 +60,7 @@ module.exports = function (router, protector) { } }); - router.get('/:account/:group/:artifact/:version', ServerUtils.NOT_HTML_ACCEPTED, async function (req, res, next) { + router.get('/:account/:group/:artifact/:version', ServerUtils.NOT_HTML_ACCEPTED, cors(), async function (req, res, next) { if (req.params.account.length < 4) { next('route');