tileserver-gl-light 4.4.3 → 4.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ct.yml +1 -1
- package/.github/workflows/release.yml +2 -2
- package/package.json +1 -1
- package/src/utils.js +22 -6
package/.github/workflows/ct.yml
CHANGED
|
@@ -80,7 +80,7 @@ jobs:
|
|
|
80
80
|
password: ${{ github.event.inputs.docker_token }}
|
|
81
81
|
|
|
82
82
|
- name: Build and publish Full Version to Docker Hub
|
|
83
|
-
uses: docker/build-push-action@
|
|
83
|
+
uses: docker/build-push-action@v4
|
|
84
84
|
with:
|
|
85
85
|
context: .
|
|
86
86
|
push: true
|
|
@@ -106,7 +106,7 @@ jobs:
|
|
|
106
106
|
NPM_TOKEN: ${{ github.event.inputs.npm_token }}
|
|
107
107
|
|
|
108
108
|
- name: Build and publish Light Version to Docker Hub
|
|
109
|
-
uses: docker/build-push-action@
|
|
109
|
+
uses: docker/build-push-action@v4
|
|
110
110
|
with:
|
|
111
111
|
context: ./light
|
|
112
112
|
file: ./light/Dockerfile
|
package/package.json
CHANGED
package/src/utils.js
CHANGED
|
@@ -6,19 +6,35 @@ import fs from 'node:fs';
|
|
|
6
6
|
import clone from 'clone';
|
|
7
7
|
import glyphCompose from '@mapbox/glyph-pbf-composite';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Generate new URL object
|
|
11
|
+
* @params {object} req - Express request
|
|
12
|
+
* @returns {URL} object
|
|
13
|
+
**/
|
|
14
|
+
const getUrlObject = (req) => {
|
|
15
|
+
const urlObject = new URL(`${req.protocol}://${req.headers.host}/`);
|
|
16
|
+
// support overriding hostname by sending X-Forwarded-Host http header
|
|
17
|
+
urlObject.hostname = req.hostname;
|
|
18
|
+
return urlObject;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getPublicUrl = (publicUrl, req) => {
|
|
22
|
+
if (publicUrl) {
|
|
23
|
+
return publicUrl;
|
|
24
|
+
}
|
|
25
|
+
return getUrlObject(req).toString();
|
|
26
|
+
};
|
|
11
27
|
|
|
12
28
|
export const getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
|
|
29
|
+
const urlObject = getUrlObject(req);
|
|
13
30
|
if (domains) {
|
|
14
31
|
if (domains.constructor === String && domains.length > 0) {
|
|
15
32
|
domains = domains.split(',');
|
|
16
33
|
}
|
|
17
|
-
const
|
|
18
|
-
const hostParts = host.split('.');
|
|
34
|
+
const hostParts = urlObject.host.split('.');
|
|
19
35
|
const relativeSubdomainsUsable =
|
|
20
36
|
hostParts.length > 1 &&
|
|
21
|
-
!/^([0-9]{1,3}\.){3}[0-9]{1,3}(\:[0-9]+)?$/.test(host);
|
|
37
|
+
!/^([0-9]{1,3}\.){3}[0-9]{1,3}(\:[0-9]+)?$/.test(urlObject.host);
|
|
22
38
|
const newDomains = [];
|
|
23
39
|
for (const domain of domains) {
|
|
24
40
|
if (domain.indexOf('*') !== -1) {
|
|
@@ -34,7 +50,7 @@ export const getTileUrls = (req, domains, path, format, publicUrl, aliases) => {
|
|
|
34
50
|
domains = newDomains;
|
|
35
51
|
}
|
|
36
52
|
if (!domains || domains.length == 0) {
|
|
37
|
-
domains = [
|
|
53
|
+
domains = [urlObject.host];
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
const queryParams = [];
|