From e2d7a59b554456dda0c77232874e598f32a12f6b Mon Sep 17 00:00:00 2001 From: Michael Beckemeyer Date: Tue, 15 Jul 2025 12:37:25 +0200 Subject: [PATCH 1/4] Use `apprt-fetch` instead of `apprt-request`. This is required for compatibility with map.apps 4.20.0. --- .../BundleDetailsController.js | 24 ++++++++++++------- .../mapapps-github-manager/BundleStore.js | 6 ++--- .../mapapps-github-manager/manifest.json | 17 +++++++++---- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js b/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js index 7ebc01c..66143b8 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js +++ b/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js @@ -14,8 +14,11 @@ * limitations under the License. */ import Hash from "ct/Hash"; -import apprt_request from "apprt-request"; +import { apprtFetch, apprtFetchJson } from "apprt-fetch"; import { replace } from "apprt-core/string-replace"; +import { sourceId } from "source-info!"; +import { loggerForName } from "apprt-core/Logger"; +const LOG = loggerForName(sourceId); export default class BundleDetailsController { // injected @@ -117,8 +120,8 @@ export default class BundleDetailsController { async _lookupAvailableTags(repositoryName) { const tagsUrl = "https://api.github.com/repos/conterra/" + repositoryName + "/releases"; try { - const response = await apprt_request(tagsUrl, { jsonp: true }); - const releases = response.data.filter((release) => !release.name.includes("SNAPSHOT")); + const data = await apprtFetchJson(tagsUrl); + const releases = data.filter((release) => !release.name.includes("SNAPSHOT")); releases.sort((a, b) => b.name.replace(/\d+/g, (n) => +n + 100000).localeCompare(a.name.replace(/\d+/g, (n) => +n + 100000)) ); @@ -191,10 +194,10 @@ export default class BundleDetailsController { } } - _downloadArchive(url) { - return apprt_request(url, { - handleAs: "blob" - }); + async _downloadArchive(url) { + // Currently throws a CORS error (from GitHub) and then uses the map.apps proxy. + const response = await apprtFetch(url, { checkStatus: true }); + return await response.blob(); } async _uploadBundle(blob, itemName) { @@ -205,8 +208,10 @@ export default class BundleDetailsController { formData.append("file", blob, fileName); formData.append("f", "json"); try { - await apprt_request.post(url, { - data: formData + await apprtFetch(url, { + method: "POST", + body: formData, + checkStatus: true }); this.buttonWidget.set("disabled", false); this.buttonWidget.set("iconClass", "icon-sign-success"); @@ -216,6 +221,7 @@ export default class BundleDetailsController { this.detailWindow.close(); }, 1500); } catch (e) { + LOG.error("Failed to upload bundle", e); this.detailWindow.set("content", this.i18n.integrationFailed); } } diff --git a/src/main/js/bundles/mapapps-github-manager/BundleStore.js b/src/main/js/bundles/mapapps-github-manager/BundleStore.js index 52993bc..71f4ec2 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleStore.js +++ b/src/main/js/bundles/mapapps-github-manager/BundleStore.js @@ -15,7 +15,7 @@ */ import { AsyncInMemoryStore } from "store-api/InMemoryStore"; import TypeFormat from "ct/util/TypeFormat"; -import apprt_request from "apprt-request"; +import { apprtFetchJson } from "apprt-fetch"; import stringEscape from "apprt-core/string-escape"; export default class BundleStoreFactory { @@ -49,8 +49,8 @@ async function fetchBundlesFromGitHub(target, user, topic) { } url = url + "&per_page=100"; try { - const data = await apprt_request(url, { - useProxy: false, + const data = await apprtFetchJson(url, { + proxyMode: "force-off", headers: { Accept: "application/vnd.github.mercy-preview+json" } diff --git a/src/main/js/bundles/mapapps-github-manager/manifest.json b/src/main/js/bundles/mapapps-github-manager/manifest.json index dd46ca9..60805b4 100644 --- a/src/main/js/bundles/mapapps-github-manager/manifest.json +++ b/src/main/js/bundles/mapapps-github-manager/manifest.json @@ -16,7 +16,7 @@ "dataform": "^4.17.0", "dataview": "^4.17.0", "apprt-vue": "^4.17.0", - "apprt-request": "^4.17.0", + "apprt-fetch": "^4.17.0", "apprt-core": "^4.17.0", "apprt-vuetify": "^4.17.0", "store-api": "^4.17.0" @@ -111,7 +111,10 @@ { "name": "GithubBundlesDataView", "impl": "dataview/DataView", - "provides": ["dijit.Widget", "mapapps-github-manager.GithubBundlesDataView"], + "provides": [ + "dijit.Widget", + "mapapps-github-manager.GithubBundlesDataView" + ], "propertiesConstructor": true, "properties": { "id": "githubBundlesDataView", @@ -181,7 +184,10 @@ { "name": "BundlesDataViewController", "impl": "dataview/DataViewController", - "provides": ["ct.framework.api.EventHandler", "mapapps-github-manager.BundlesDataViewController"], + "provides": [ + "ct.framework.api.EventHandler", + "mapapps-github-manager.BundlesDataViewController" + ], "properties": { "Event-Topics": [ { @@ -217,7 +223,10 @@ }, { "name": "BundleDetailsController", - "provides": ["ct.framework.api.EventHandler", "mapapps-github-manager.BundleDetailsController"], + "provides": [ + "ct.framework.api.EventHandler", + "mapapps-github-manager.BundleDetailsController" + ], "properties": { "uploadTarget": "@@applicationURL.noscheme@@/resources/jsregistry/upload", "Event-Topics": [ From 817f17009fd3d63258d9a66754860565b335a1f1 Mon Sep 17 00:00:00 2001 From: Marko Reiprecht Date: Tue, 26 Aug 2025 16:56:57 +0200 Subject: [PATCH 2/4] disable proxy fallback by default, but not at blob fetching --- .../mapapps-github-manager/BundleDetailsController.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js b/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js index 66143b8..043d551 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js +++ b/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js @@ -120,7 +120,9 @@ export default class BundleDetailsController { async _lookupAvailableTags(repositoryName) { const tagsUrl = "https://api.github.com/repos/conterra/" + repositoryName + "/releases"; try { - const data = await apprtFetchJson(tagsUrl); + const data = await apprtFetchJson(tagsUrl, { + proxyMode: "force-off" + }); const releases = data.filter((release) => !release.name.includes("SNAPSHOT")); releases.sort((a, b) => b.name.replace(/\d+/g, (n) => +n + 100000).localeCompare(a.name.replace(/\d+/g, (n) => +n + 100000)) @@ -211,7 +213,8 @@ export default class BundleDetailsController { await apprtFetch(url, { method: "POST", body: formData, - checkStatus: true + checkStatus: true, + proxyMode: "force-off" }); this.buttonWidget.set("disabled", false); this.buttonWidget.set("iconClass", "icon-sign-success"); From aff664ced60ddac03571a23b7f35ac5d22948057 Mon Sep 17 00:00:00 2001 From: Marko Reiprecht Date: Tue, 26 Aug 2025 16:57:24 +0200 Subject: [PATCH 3/4] Use screenshot.png instead of not longer available screenshot.JPG --- .../js/bundles/mapapps-github-manager/BundleTopWidget.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue b/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue index 942408d..871acfb 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue +++ b/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue @@ -112,10 +112,10 @@ class="hidden-xs-and-down" > From f8805fa57f45430e61bfa80e57d1f47ce6dfba91 Mon Sep 17 00:00:00 2001 From: Marko Reiprecht Date: Tue, 26 Aug 2025 17:00:35 +0200 Subject: [PATCH 4/4] update release notes --- README.md | 2 +- RELEASE.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3326dfa..c483060 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This project is intended to be integrated as a bundle to the installation of your map.apps manager. ## Installation Guide -**Requirement: map.apps 4.14** +**Requirement: map.apps 4.17** Before you add the Bundle to your manager, please configure the user and the topic property in the manifest.json to point to your GitHub account. Topic can be left empty. You will have to add a released bundle.jar/zip as a bundle in your map.apps manager. diff --git a/RELEASE.md b/RELEASE.md index 21716f2..9de489e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,4 @@ +✅ Tested for map.apps 4.20.0 / Linie 4 ✅ Tested for map.apps 4.18.3 / Linie 4 #### Release Notes