Skip to content

Commit

Permalink
Merge pull request #1051 from geoadmin/develop
Browse files Browse the repository at this point in the history
New Release v1.46.0 - #minor
  • Loading branch information
pakb authored Sep 2, 2024
2 parents b118981 + c2dc9cc commit 7b10584
Show file tree
Hide file tree
Showing 117 changed files with 2,256 additions and 1,702 deletions.
1,311 changes: 443 additions & 868 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,47 @@
"@fortawesome/vue-fontawesome": "^3.0.8",
"@geoblocks/cesium-compass": "^0.5.0",
"@geoblocks/mapfishprint": "^0.2.16",
"@geoblocks/ol-maplibre-layer": "^1.0.0",
"@geoblocks/ol-maplibre-layer": "^1.0.1",
"@ivanv/vue-collapse-transition": "^1.0.2",
"@mapbox/togeojson": "^0.16.2",
"@popperjs/core": "^2.11.8",
"@turf/area": "^7.0.0",
"@turf/bbox": "^7.0.0",
"@turf/boolean-contains": "^7.0.0",
"@turf/boolean-point-in-polygon": "^7.0.0",
"@turf/buffer": "^7.0.0",
"@turf/centroid": "^7.0.0",
"@turf/distance": "^7.0.0",
"@turf/explode": "^7.0.0",
"@turf/helpers": "^7.0.0",
"@turf/nearest-point": "^7.0.0",
"@turf/point-to-line-distance": "^7.0.0",
"@turf/area": "^7.1.0",
"@turf/bbox": "^7.1.0",
"@turf/boolean-contains": "^7.1.0",
"@turf/boolean-point-in-polygon": "^7.1.0",
"@turf/buffer": "^7.1.0",
"@turf/centroid": "^7.1.0",
"@turf/distance": "^7.1.0",
"@turf/explode": "^7.1.0",
"@turf/helpers": "^7.1.0",
"@turf/nearest-point": "^7.1.0",
"@turf/point-to-line-distance": "^7.1.0",
"animate.css": "^4.1.1",
"axios": "^1.7.3",
"axios": "^1.7.5",
"bootstrap": "^5.3.3",
"cesium": "^1.120.0",
"chart.js": "^4.4.3",
"chart.js": "^4.4.4",
"chartjs-plugin-zoom": "^2.0.1",
"dompurify": "^3.1.6",
"file-saver": "^2.0.5",
"form-data": "^4.0.0",
"geographiclib-geodesic": "^2.0.0",
"geographiclib-geodesic": "^2.1.1",
"hammerjs": "^2.0.8",
"jquery": "^3.7.1",
"liang-barsky": "^1.0.5",
"lodash": "^4.17.21",
"maplibre-gl": "^4.5.1",
"ol": "^9.2.4",
"maplibre-gl": "^4.6.0",
"ol": "^10.1.0",
"pako": "^2.1.0",
"print-js": "^1.6.0",
"proj4": "^2.11.0",
"proj4": "^2.12.0",
"reproject": "^1.2.7",
"sortablejs": "^1.15.2",
"tippy.js": "^6.3.7",
"vue": "^3.4.35",
"vue": "^3.4.38",
"vue-chartjs": "^5.3.1",
"vue-i18n": "^9.13.1",
"vue-router": "^4.4.2",
"vue-i18n": "^9.14.0",
"vue-router": "^4.4.3",
"vue3-social-sharing": "^1.1.1",
"vuex": "^4.1.0"
},
Expand All @@ -106,23 +106,23 @@
"@vue/tsconfig": "^0.5.1",
"axios-retry": "^4.5.0",
"chai": "^5.1.1",
"cypress": "^13.13.2",
"cypress": "^13.13.3",
"cypress-browser-permissions": "^1.1.0",
"cypress-real-events": "^1.13.0",
"cypress-recurse": "^1.35.3",
"cypress-vite": "^1.5.0",
"cypress-wait-until": "^3.0.2",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-plugin-cypress": "^3.4.0",
"eslint-plugin-cypress": "^3.5.0",
"eslint-plugin-markdownlint": "^0.6.0",
"eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-prettier-vue": "^5.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-vue": "^9.27.0",
"git-describe": "^4.1.1",
"googleapis": "^140.0.1",
"jsdom": "^24.1.1",
"googleapis": "^142.0.0",
"jsdom": "^25.0.0",
"mime-types": "^2.1.35",
"mocha-junit-reporter": "^2.2.1",
"prettier": "^3.3.3",
Expand All @@ -131,7 +131,7 @@
"sass": "1.77.6",
"start-server-and-test": "^2.0.5",
"typescript": "^5.5.4",
"vite": "^5.3.5",
"vite": "^5.4.2",
"vite-node": "^2.0.5",
"vite-plugin-static-copy": "^1.0.6",
"vitest": "^2.0.5",
Expand Down
9 changes: 5 additions & 4 deletions src/api/features/features.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
ALL_YEARS_TIMESTAMP,
CURRENT_YEAR_TIMESTAMP,
} from '@/api/layers/LayerTimeConfigEntry.class'
import { API_BASE_URL, DEFAULT_FEATURE_COUNT_SINGLE_POINT } from '@/config'
import { getApi3BaseUrl } from '@/config/baseUrl.config'
import { DEFAULT_FEATURE_COUNT_SINGLE_POINT } from '@/config/map.config'
import allCoordinateSystems, { LV95 } from '@/utils/coordinates/coordinateSystems'
import { projExtent } from '@/utils/coordinates/coordinateUtils'
import { createPixelExtentAround } from '@/utils/extentUtils'
Expand Down Expand Up @@ -142,7 +143,7 @@ export async function identifyOnGeomAdminLayer({
}
const imageDisplay = `${screenWidth},${screenHeight},96`
const identifyResponse = await axios.get(
`${API_BASE_URL}rest/services/${layer.getTopicForIdentifyAndTooltipRequests()}/MapServer/identify`,
`${getApi3BaseUrl()}rest/services/${layer.getTopicForIdentifyAndTooltipRequests()}/MapServer/identify`,
{
// params described as https://api3.geo.admin.ch/services/sdiservices.html#identify-features
params: {
Expand Down Expand Up @@ -561,10 +562,10 @@ export const identify = (config) => {
/**
* @param {GeoAdminLayer} layer The layer from which the feature is part of
* @param {String | Number} featureId The feature ID in the BGDI
* @returns {string}
* @returns {String}
*/
function generateFeatureUrl(layer, featureId) {
return `${API_BASE_URL}rest/services/${layer.getTopicForIdentifyAndTooltipRequests()}/MapServer/${layer.id}/${featureId}`
return `${getApi3BaseUrl()}rest/services/${layer.getTopicForIdentifyAndTooltipRequests()}/MapServer/${layer.id}/${featureId}`
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/api/feedback.api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import axios from 'axios'

import { getKmlFromUrl } from '@/api/files.api'
import { API_SERVICES_BASE_URL, APP_VERSION } from '@/config'
import { getViewerDedicatedServicesBaseUrl } from '@/config/baseUrl.config'
import { APP_VERSION } from '@/config/staging.config'
import log from '@/utils/logging'

/** Maximum size allowed by the backend, can be used to do validation up front */
Expand Down Expand Up @@ -48,7 +49,7 @@ export default async function sendFeedback(subject, text, options) {
attachment,
}
log.debug('sending feedback with', data)
const response = await axios.post(`${API_SERVICES_BASE_URL}feedback`, data, {
const response = await axios.post(`${getViewerDedicatedServicesBaseUrl()}feedback`, data, {
headers: {
'Content-Type': 'multipart/form-data',
},
Expand Down
32 changes: 29 additions & 3 deletions src/api/file-proxy.api.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
import axios from 'axios'
import { isString } from 'lodash'

import { API_SERVICE_PROXY_BASE_URL } from '@/config'
import { getServiceProxyBaseUrl } from '@/config/baseUrl.config'
import log from '@/utils/logging'

/**
* Transform a Dropbox URL to a direct download link, replacing dl=0 by dl=1
*
* @param {String} fileUrl
* @returns {String} The transformed URL
* @see https://www.dropbox.com/help/desktop-web/force-download
*/
function transformDropboxUrl(fileUrl) {
const dropboxPattern = /^(https?:\/\/(www\.)?dropbox\.com\/.+)/
if (dropboxPattern.test(fileUrl)) {
try {
const url = new URL(fileUrl)
const params = new URLSearchParams(url.search)
if (params.get('dl') === '0') {
params.set('dl', '1')
url.search = params.toString()
return url.toString()
}
} catch (e) {
log.debug('failed to transformDropboxUrl', e)
return fileUrl
}
}
return fileUrl
}

/**
* Transform our file URL into a path, compatible with a call to service-proxy
*
Expand All @@ -15,7 +41,7 @@ export function transformFileUrl(fileUrl) {
return null
}
// copy from https://github.com/geoadmin/mf-geoadmin3/blob/master/src/components/UrlUtilsService.js#L59-L69
const parts = /^(http|https)(:\/\/)(.+)/.exec(fileUrl)
const parts = /^(http|https)(:\/\/)(.+)/.exec(transformDropboxUrl(fileUrl))
if (parts?.length < 4) {
return null
}
Expand All @@ -29,7 +55,7 @@ export function proxifyUrl(url) {
if (!fileAsPath) {
throw new Error(`Malformed URL: ${url}, can't proxify`)
}
return `${API_SERVICE_PROXY_BASE_URL}${fileAsPath}`
return `${getServiceProxyBaseUrl()}${fileAsPath}`
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/api/files.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import axios, { AxiosError } from 'axios'
import FormData from 'form-data'
import pako from 'pako'

import getFileThroughProxy from '@/api/file-proxy.api.js'
import { API_SERVICE_KML_BASE_URL } from '@/config'
import getFileThroughProxy from '@/api/file-proxy.api'
import { getServiceKmlBaseUrl } from '@/config/baseUrl.config'
import log from '@/utils/logging'

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ export class KmlMetadata {
}
}

const kmlBaseUrl = `${API_SERVICE_KML_BASE_URL}api/kml/`
const kmlBaseUrl = `${getServiceKmlBaseUrl()}api/kml/`

function validateId(id, reject) {
if (!id) {
Expand Down
4 changes: 2 additions & 2 deletions src/api/height.api.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import proj4 from 'proj4'

import { API_SERVICE_ALTI_BASE_URL } from '@/config'
import { getServiceAltiBaseUrl } from '@/config/baseUrl.config'
import { LV95 } from '@/utils/coordinates/coordinateSystems'
import log from '@/utils/logging'
import { round } from '@/utils/numberUtils'
Expand Down Expand Up @@ -34,7 +34,7 @@ export const requestHeight = (coordinates, projection) => {
// we are giving it LV95 coordinates
const lv95coords = proj4(projection.epsg, LV95.epsg, coordinates)
axios
.get(`${API_SERVICE_ALTI_BASE_URL}rest/services/height`, {
.get(`${getServiceAltiBaseUrl()}rest/services/height`, {
params: {
easting: lv95coords[0],
northing: lv95coords[1],
Expand Down
5 changes: 3 additions & 2 deletions src/api/icon.api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios'

import { API_SERVICES_BASE_URL } from '@/config'
import { getViewerDedicatedServicesBaseUrl } from '@/config/baseUrl.config'
import { calculateTextOffset, MEDIUM, RED } from '@/utils/featureStyleUtils'
import log from '@/utils/logging'

Expand Down Expand Up @@ -188,7 +188,8 @@ export async function loadAllIconSetsFromBackend() {
const setPromises = []
const sets = []
try {
const rawSets = (await axios.get(`${API_SERVICES_BASE_URL}icons/sets`)).data.items
const rawSets = (await axios.get(`${getViewerDedicatedServicesBaseUrl()}icons/sets`)).data
.items
for (const rawSet of rawSets) {
const iconSet = new DrawingIconSet(
rawSet.name,
Expand Down
4 changes: 2 additions & 2 deletions src/api/layers/GeoAdmin3DLayer.class.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LayerAttribution } from '@/api/layers/AbstractLayer.class'
import GeoAdminLayer from '@/api/layers/GeoAdminLayer.class'
import LayerTypes from '@/api/layers/LayerTypes.enum'
import { BASE_URL_3D_TILES } from '@/config'
import { get3dTilesBaseUrl } from '@/config/baseUrl.config'

/**
* Metadata for a 3D tile layer (Cesium layer) served by our backend
Expand Down Expand Up @@ -29,7 +29,7 @@ export default class GeoAdmin3DLayer extends GeoAdminLayer {
type: LayerTypes.VECTOR,
technicalName: layerId,
id: layerId,
baseUrl: BASE_URL_3D_TILES,
baseUrl: get3dTilesBaseUrl(),
ensureTrailingSlashInBaseUrl: true,
opacity: 1.0,
visible: true,
Expand Down
4 changes: 2 additions & 2 deletions src/api/layers/GeoAdminVectorLayer.class.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LayerAttribution } from '@/api/layers/AbstractLayer.class'
import GeoAdminLayer from '@/api/layers/GeoAdminLayer.class'
import LayerTypes from '@/api/layers/LayerTypes.enum'
import { VECTOR_TILE_BASE_URL } from '@/config'
import { getVectorTilesBaseUrl } from '@/config/baseUrl.config'

/**
* Metadata for a vector tile layer (MapLibre layer) served by our backend
Expand All @@ -24,7 +24,7 @@ export default class GeoAdminVectorLayer extends GeoAdminLayer {
super({
name: layerId,
type: LayerTypes.VECTOR,
baseUrl: VECTOR_TILE_BASE_URL,
baseUrl: getVectorTilesBaseUrl(),
id: layerId,
technicalName: layerId,
attributions: [
Expand Down
4 changes: 2 additions & 2 deletions src/api/layers/GeoAdminWMSLayer.class.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import GeoAdminLayer from '@/api/layers/GeoAdminLayer.class'
import { InvalidLayerDataError } from '@/api/layers/InvalidLayerData.error'
import LayerTypes from '@/api/layers/LayerTypes.enum'
import { WMS_BASE_URL } from '@/config'
import { getWmsBaseUrl } from '@/config/baseUrl.config'

/**
* Metadata for WMS layer (WMS stands for Web Map Service). It can either be tiled (requested in
Expand Down Expand Up @@ -73,7 +73,7 @@ export default class GeoAdminWMSLayer extends GeoAdminLayer {
opacity = 1.0,
visible = true,
attributions = null,
baseUrl = WMS_BASE_URL,
baseUrl = getWmsBaseUrl(),
format = 'png',
timeConfig = null,
wmsVersion = '1.3.0',
Expand Down
5 changes: 3 additions & 2 deletions src/api/layers/GeoAdminWMTSLayer.class.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import GeoAdminLayer from '@/api/layers/GeoAdminLayer.class'
import { InvalidLayerDataError } from '@/api/layers/InvalidLayerData.error'
import LayerTypes from '@/api/layers/LayerTypes.enum'
import { DEFAULT_GEOADMIN_MAX_WMTS_RESOLUTION, WMTS_BASE_URL } from '@/config'
import { getWmtsBaseUrl } from '@/config/baseUrl.config'
import { DEFAULT_GEOADMIN_MAX_WMTS_RESOLUTION } from '@/config/map.config'
import { TILEGRID_RESOLUTIONS } from '@/utils/coordinates/SwissCoordinateSystem.class'

/**
Expand Down Expand Up @@ -69,7 +70,7 @@ export default class GeoAdminWMTSLayer extends GeoAdminLayer {
format = 'png',
timeConfig = null,
isBackground = false,
baseUrl = WMTS_BASE_URL,
baseUrl = getWmtsBaseUrl(),
isHighlightable = false,
hasTooltip = false,
topics = [],
Expand Down
4 changes: 2 additions & 2 deletions src/api/layers/KMLLayer.class.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AbstractLayer, { LayerAttribution } from '@/api/layers/AbstractLayer.class'
import { InvalidLayerDataError } from '@/api/layers/InvalidLayerData.error'
import LayerTypes from '@/api/layers/LayerTypes.enum'
import { API_SERVICE_KML_BASE_URL } from '@/config'
import { getServiceKmlBaseUrl } from '@/config/baseUrl.config'
import { EMPTY_KML_DATA, parseKmlName } from '@/utils/kmlUtils'

/**
Expand Down Expand Up @@ -48,7 +48,7 @@ export default class KMLLayer extends AbstractLayer {
}
const isLocalFile = !kmlFileUrl.startsWith('http')
const attributionName = isLocalFile ? kmlFileUrl : new URL(kmlFileUrl).hostname
const isExternal = kmlFileUrl.indexOf(API_SERVICE_KML_BASE_URL) === -1
const isExternal = kmlFileUrl.indexOf(getServiceKmlBaseUrl()) === -1
super({
name: 'KML',
id: kmlFileUrl,
Expand Down
2 changes: 1 addition & 1 deletion src/api/layers/WMSCapabilitiesParser.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ExternalWMSLayer, { WMSDimension } from '@/api/layers/ExternalWMSLayer.cl
import { CapabilitiesError } from '@/api/layers/layers-external.api'
import LayerTimeConfig from '@/api/layers/LayerTimeConfig.class'
import LayerTimeConfigEntry from '@/api/layers/LayerTimeConfigEntry.class'
import { WMS_SUPPORTED_VERSIONS } from '@/config'
import { WMS_SUPPORTED_VERSIONS } from '@/config/map.config'
import allCoordinateSystems, { WGS84 } from '@/utils/coordinates/coordinateSystems'
import log from '@/utils/logging'

Expand Down
Loading

0 comments on commit 7b10584

Please sign in to comment.